feat(api): the customer API accepts portal-issued API keys #564

Merged
sharang merged 2 commits from feat/api-key-acceptance into main 2026-10-13 22:22:22 +00:00
2 Commits
Author SHA1 Message Date
Sharang ParnerkarandClaude Opus 5.5 2254e1c8ff fix(api): cap the API-key verdict cache at 10,000 entries
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Successful in 10m7s
Callers choose the keys, so cached invalid verdicts must not grow without
end: at the cap expired verdicts are dropped first, and if none are, the
new verdict is answered but not kept.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
2026-10-14 00:07:09 +02:00
Sharang ParnerkarandClaude Opus 5.5 ae8761c15c feat(api): the customer API accepts portal-issued API keys (bp_…)
Step 5 of tenant-registry ADR 0001. A `Bearer bp_…` token is verified
with the registry (pruefwerk-svc) and becomes a tenant context carrying
the key; every other bearer goes through the JWT path unchanged.

- Verdicts, valid and invalid, are cached for 60 s by the key's SHA-256;
  an unreachable registry with no fresh verdict means 503. The Werkbank
  runner shares the same cached verify.
- Tenant, scopes and ladder status come only from the verify answer; the
  support header is never read for a key, and a key holds no org role.
- role_gate gets a method + route -> scope table; every other route
  answers 403 scope_missing. x.write implies x.read. Legacy keys (no
  scopes) get the read scopes only.
- The entitlement check is skipped for keys (verify already intersects
  scopes with entitlements). Key writes are audited like support writes,
  as apikey:<key_id> with the holder and X-BP-Actor as on_behalf_of.
- Guide page docs/guide/api-keys.md.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
2026-10-14 00:07:09 +02:00