feat(api-keys): Scope catalogue, kinds, expiry and sha256 keys #70

Merged
sharang merged 1 commits from feat/api-keys-scoped into main 2026-10-13 21:21:17 +00:00
1 Commits
Author SHA1 Message Date
Sharang ParnerkarandClaude Opus 5.5 06d94dcceb feat(api-keys): Scope catalogue, kinds, expiry and sha256 keys
ci / shared (pull_request) Successful in 14s
ci / test (pull_request) Successful in 24m39s
ci / image (pull_request) Skipped
Step 1 of ADR 0001 (tenant-bound, scoped API keys; Werkmeister
prerequisite 1, firmwerk#64 step 1):

- internal/scopes: catalogue <product>:<resource>.<action>, validated
  on create against the tenant's entitlements (422 not_entitled);
  GET /v1/api-keys/scopes for the portal's picker.
- Migration 0015: kind (user|ci|integration), holder, expires_at,
  hash_sha256. New keys are stored as sha256 (indexed lookup); older
  keys keep argon2id and every prefix candidate is checked, so a
  prefix collision no longer breaks a valid key.
- Verify returns key_id, kind, holder, expires_at, tenant_status and
  legacy, and limits scopes to products booked right now. Expired
  keys are invalid. Empty scopes stay a legacy full grant.
- ci keys need scopes and an expiry within 365 days; integration keys
  are refused here (created by their holder product, next step).
- DELETE /v1/api-keys/{id}?tenant_id= refuses another tenant's key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 22:55:58 +02:00