1---2name: backstage-auth-23description: Use when editing Backstage sign-in, identity resolution, service authentication, or permission boundaries.4---56<!-- Generated from harness/github-copilot/plugins/open-horizons-platform/instructions/backstage-auth.instructions.md by harness/claude-code/scripts/convert_from_copilot.py. Edit the source, not this file. -->78# Backstage Authentication and Authorization910## Conventions1112- Derive user identity from a validated Backstage auth context, never from request bodies or untrusted headers.13- Keep sign-in identity resolution separate from delegated access to GitHub, Azure, or other providers.14- Require explicit, deterministic ownership or group resolution; ambiguous matches must fail without silently choosing a user.15- Authenticate backend-to-backend calls with service credentials and validate issuer, audience, expiry, and approved caller.16- Apply permission checks at backend resource and action boundaries; hiding a frontend control is not authorization.17- Keep guest access local-only and visibly isolated from production overlays.18- Resolve client secrets and signing material from environment-backed secret stores, not source or frontend-visible config.19- Return generic authentication errors externally while retaining redacted correlation evidence internally.2021## Verification2223- Tests cover valid sign-in, unresolved identity, wrong audience, expired credentials, and denied permissions.24- Production configuration has no guest fallback or literal credential.25- Trusted actor and trusted service identities remain distinct throughout requests.2627## Do / Do Not2829| Do | Do not |30| --- | --- |31| Validate identity and authorization independently at backend boundaries. | Trust request identity fields, hidden UI, or a successful sign-in as authorization. |32| Keep secrets external and errors safely redacted. | Put credentials in source, browser configuration, or user-visible errors. |3334## Checklist Before Opening a PR3536- [ ] The change matches this instruction's `applyTo` scope.37- [ ] Actor, service, delegated-provider, and permission identities remain distinct.38- [ ] Valid, unresolved, expired, wrong-audience, and denied cases are tested.39- [ ] Production configuration contains no guest fallback or literal credential.40- [ ] No unrelated edits or unresolved placeholders remain.