Skip to content

[Request]: declarative bearer/API-key auth with scopes, expiry and revocation #571

Closed

Description

@jimhoyd

Problem or use case

Evidence comes from a first-party hosted URLCode service (private repository) built on core 0.5.9. It had to hand-write the code named below. routes.*.auth is session-only, so an API that authenticates agents with bearer tokens needs two trusted modules (token parsing and peppered-hash lookup, plus a scope check per route) and an out-of-band issuing/revoking script. Every route repeats the check.

Proposed behavior and alternatives

A declarative credential mode, e.g. auth: {bearer: {scopes: [reference]}}, backed by an operator-supplied token store (hashed at rest, with expiry and revocation) and exposing the principal/scopes to the handler context. Alternative: an extension package on the existing contract. Either way the scope check and the 401/403 shapes should be host-owned.

Activity

  1. added
    enhancement
    ai-first
    needs-decision
    on Sep 23, 2026
  2. jimhoyd commented on Sep 24, 2026

    @jimhoyd
    CollaboratorAuthor

    Triage decision: accept bearer/API-key authentication as an optional auth extension capability, not a core YAML feature. The extension owns credential hashing, expiry/revocation, scope enforcement, principal context, and consistent 401/403 responses. An operator supplies the credential store and its configuration outside route YAML. This preserves core portability and its dependency boundary. Leave open for extension contract/evidence work and remove needs-decision.

  3. removed
    needs-decision
    on Sep 24, 2026
  4. jimhoyd commented on Sep 24, 2026

    @jimhoyd
    CollaboratorAuthor

    Opened #635: bearer/API-key authentication as an optional auth extension
    capability, per the triage decision — credential hashing (scrypt, same
    derivation as passwords, looked up by a public id rather than a hash of the
    secret), expiry, revocation, scope enforcement, and RFC 6750-shaped 401/403
    responses, plus operator CLI commands and the auth: {bearer: {scopes:[...]}}
    route short form.

    Scoped down one piece: the triage decision also asks the extension to expose
    "the principal/scopes to the handler context." Implementing this found that no
    extension has any mechanism today to hand data into a route's own trusted
    function/middleware context — only to gate the request. Closing that
    cleanly needs a small but genuine new core seam (and touches a boundary
    SECURITY.md documents as deliberate: Authorization is already always
    stripped before a guest sees it). Filed that as its own issue, #618, with a
    traced design, rather than bundling an unreviewed core change into this PR.
    #635's gate still fully enforces authentication and scopes — a protected
    route just can't yet read which key authenticated it.

  5. jimhoyd commented on Sep 24, 2026

    @jimhoyd
    CollaboratorAuthor

    Implemented in #635: bearer/API-key authentication as an optional capability of the auth extension. One follow-up was scoped out and tracked separately in #618 (exposing the authenticated principal/scopes to the route's own handler) since it touches a documented core security boundary (credentials never crossing into application guests) and needs its own design review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ai-firstenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions