on
Designing auditable, policy-driven golden paths in Backstage
Golden paths make the routine faster and safer: they capture platform best practice as templates, scaffold new projects, and codify defaults so developers spend time on features, not plumbing. Backstage provides the key building blocks for golden paths — the Scaffolder (Software Templates), TechDocs for documentation, and now an Auditor service for capturing critical events. This article explains a recent, practical approach: combining Scaffolder templates, policy-as-code, and Backstage’s auditor to create golden paths that are both easy to use and auditable. (backstage.io)
Why auditable, policy-driven golden paths matter
- Predictability: Teams receive a consistent starting point (CI, deploy manifests, observability hooks) without each engineer reinventing the wheel. Backstage’s Software Templates are the common mechanism for that consistency. (backstage.io)
- Compliance by design: Policies (security, dependencies, runtime configuration) encoded or checked at template-time reduce manual review overhead and drift.
- Traceability: Knowing who created what, with which choices, helps incident investigation and governance. The Auditor service in Backstage records these high-value events into a queryable audit log. (backstage.io)
Core Backstage building blocks to combine
- Scaffolder (Software Templates): Templates define prompts, files, and actions run to create a repo and kick off pipelines; they are the “golden path” authoring surface. (backstage.io)
- Auditor service: A platform-level API to emit events (with severity, actionType, entityRef, and meta) so template runs and key lifecycle actions become first-class audit entries. The Auditor is integrated with the Catalog and Scaffolder so common events are already tracked. (backstage.io)
- Policy integrations: Policy-as-code engines (for example OPA/rego or other enforcement tools) can be invoked as part of scaffolding or CI to verify infra and deploy-time rules. Backstage ecosystems increasingly surface RBAC/policy integrations; many teams pair template-time checks with CI policy gates. (backstage.io)
A design pattern: template + policy check + audit event The following pattern balances developer ergonomics with platform guardrails.
1) Template surface: present only necessary choices
- Keep the template form small and opinionated. Fewer choices lower the chance of non-compliant configurations. Backstage’s create-app golden path guidance emphasizes a focused first experience. (backstage.io)
2) Pre-commit policy checks (local / template dry-run)
- Run lightweight policy verification (linting, dependency policy checks, simple OPA rules) during template dry-run to catch obvious issues before repository creation. Many teams prefer fail-fast feedback at the form validation or dry-run stage to avoid manual remediation later. (backstage.io)
3) Template-time enforcement hooks
- When a template performs a final “create” action, include steps that:
- Annotate the resulting catalog entity with policy metadata (policy profile, exceptions).
- Trigger a policy-enforcer workflow (server-side) that records the result (pass/fail).
- Those steps should emit auditor events describing the action and its outcome.
4) Emit structured audit events
- The Auditor API supports a createEvent() approach with structured fields such as eventId, severityLevel, actionType, entityRef, and meta. Example usage looks like:
const event = await auditor.createEvent({ eventId: ‘entity.created’, severityLevel: ‘high’, request: req, meta: { actionType: ‘create’, entityRef: ‘component:default/my-service’ } });
await event.success(); // or event.fail({ error })
This produces a searchable record of the creation and outcome. (backstage.spotify.com)
Example (conceptual) template fragment
-
A Scaffolder template typically defines parameters, steps, and actions. The following is a conceptual YAML fragment (illustrative, not copy-paste ready):
parameters:
- title: Service name name: name type: string
steps:
-
id: validate-policy name: Run policy checks action: run:policy-check input: serviceName: $
-
id: create-repo name: Create repository action: github:create-repo input: name: $
-
id: audit name: Emit audit event action: backstage:auditor-create input: eventId: ‘scaffolder.task’ severity: ‘medium’ meta: actionType: ‘create’ entityRef: $
This shows three concerns separated: policy verification, resource creation, and audit logging. The scaffolder supports custom actions (and many community actions exist); the Auditor integration can be called programmatically to capture the final result. (backstage.io)
What good audit records capture
- Who initiated the run (actor id) and whether it was a user or service principal.
- Template reference and parameters used (so the same audit entry can be tied back to the generated repo).
- ActionType and outcome (create/dry-run/fail) and any exception context.
- A minimal set of searchable meta fields (Backstage’s Auditor promotes some fields to dedicated columns such as actionType and entityRef; keep those populated where possible). (backstage.spotify.com)
Pitfalls and cautions
- Treat template inputs as untrusted: the Scaffolder runs server-side actions that may access service credentials. The Backstage threat model warns about risks from untrusted inputs and recommends auditing and pinning installed actions. Template authors should avoid executing arbitrary user-supplied code without strict validation. (backstage.io)
- Audit log noise: excessively high-volume events (e.g., frequent dry-runs) can overwhelm audit stores. Use severity levels and exclusion rules (supported in Portal/Backstage audit guides) to keep logs useful. (backstage.spotify.com)
- Plugin hygiene: record which plugin and action produced an event. Keep plugins pinned and reviewed; many real-world Backstage rollouts include periodic plugin audits. (backstage.io)
Real-world signal
- Case studies and community examples show the pattern in practice: teams using Backstage scaffolder to create a reusable backend skeleton or onboarding template report faster, more consistent service creation, and the ability to trace who created what. Some customers have moved entire platform onboarding and migrations to templated golden paths for predictable outcomes. (backstage.spotify.com)
Closing summary Backstage’s Scaffolder plus the Auditor service makes it straightforward to design golden paths that are both developer-friendly and traceable. The practical pattern separates validation (policy checks), creation (template actions), and observability (structured audit events). The result: a golden path that preserves velocity while providing a clear compliance and investigation trail. (backstage.io)
References (selected)
- Backstage Golden Path / create-app and Scaffolder docs. (backstage.io)
- Backstage release notes introducing the Auditor service and Scaffolder integrations. (backstage.io)
- Spotify/Portal audit logs guide with createEvent usage and recommended meta fields. (backstage.spotify.com)
- Backstage threat model and security guidance on treating Scaffolder inputs as untrusted. (backstage.io)
- A PagerDuty case example of using Backstage Scaffolder to deliver golden paths inside an organization. (backstage.spotify.com)