Skip to content

Authenticate API principals and enforce scoped permissions #15

Description

@fly1d

Problem

The API currently trusts caller-supplied actor fields. A caller can impersonate an operator, agent, or reviewer, so durable audit records do not yet prove who performed an action.

Scope

  • add a framework-neutral bearer authentication adapter backed by SHA-256 token fingerprints
  • map authenticated subjects to explicit permissions
  • require authentication and authorization for /v1 endpoints when configured
  • reject write requests whose actor does not match the authenticated subject
  • keep health endpoints public
  • fail startup when PostgreSQL is configured without authentication
  • keep an explicit unauthenticated in-memory development mode

Acceptance criteria

  • missing and invalid credentials return indistinguishable 401 responses with WWW-Authenticate: Bearer
  • insufficient permissions and actor mismatches return structured 403 responses
  • raw bearer tokens are never stored in repository or server configuration
  • unit, API security, container, and existing PostgreSQL checks pass
  • security and deployment documentation identifies the static-token adapter as a bootstrap mechanism, with OIDC remaining behind the owned interface

Risk

High: authentication and authorization boundary. Requires the high-risk review path in docs/QUALITY_GATES.md.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions