Step 1b of ADR 0001 (docs/adr/0001-tenant-scoped-api-keys.md), with the user's decisions D1–D3 recorded in the ADR. It follows #70.
CI licences by API key (unblocks firmwerk#64 step 1)
POST /v1/licences/ci is PUBLIC_EXPLICIT, like the heartbeat. requireAuth stays JWT-only.
Credential: the bearer is a bp_ key with scope <product>:licence. The tenant comes from the key, and device is stored as ci:<device>.
The licence:
lives 24 h and carries kind: "ci", sub: apikey:<id>;
has no heartbeat and is not a seat (D1);
the registry records the usage event ci.licence once per key and day.
Reuse: one licence per (key, device, UTC day) — 201 for a new one, 200 for a reused one. At most 60 calls per key and hour (429 above that).
Werkpilot (D2): the licence carries the tenant's LiteLLM key.
The key has duration: 1d in LiteLLM.
Its secret is stored sealed on the licence (AES-256-GCM, internal/secretbox, licence id as AAD, migration 0017), so the reused licence hands out the same key again.
Cost cap: at most 10 LiteLLM keys per API key and day.
New env SECRETS_ENCRYPTION_KEY (base64, 32 bytes): optional. Without it, a reuse comes without the LLM key (warning llm_key_not_repeatable).
Integration keys (Werkmeister)
Who: a tenant admin's user token from a holder product's web client (werkmeister-<env>) can create, list and revoke that holder's key, for their own tenant only.
Limits: scopes come from a holder allowlist, and the holder product must be booked. The key has a fixed name (= holder), no expiry, and no product.
AUTHZ: a user token on /v1/api-keys* is classified as the group api-keys.integration, so the plain api-keys group stays a service grant (cross-tenant).
Migration 0016
(tenant_id, name) is now unique only among active keys. Before, revoke-then-create with the same name failed: the re-issue of an integration key, and also a portal user reusing a name.
Tests
The CI test command passes locally with -race; golangci-lint v2.12.2 reports 0 issues.
New tests:
CI licence: reuse per device/day, claims, refusals, end of booking, rate limit, ci.licence instead of a seat;
Werkpilot: same key on reuse, the case without an encryption key, the daily cap;
integration: an admin creates, plus refusals (not booked, not an admin, other tenant, allowlist, wrong client, service client), list and revoke own keys only;
secretbox (AAD, wrong key);
name reuse after revoke on both stores.
Deploy (stage)
The companion orca-platform PR (AUTHZ line, SECRETS_ENCRYPTION_KEY, tenant-registry-audience for werkmeister-stage) follows after the merge. The project secret goes in first: orca secrets set -p platform-stage TENANT_REGISTRY_SECRETS_KEY ….
Step 1b of ADR 0001 (`docs/adr/0001-tenant-scoped-api-keys.md`), with the user's decisions D1–D3 recorded in the ADR. It follows #70.
## CI licences by API key (unblocks firmwerk#64 step 1)
- **`POST /v1/licences/ci`** is PUBLIC_EXPLICIT, like the heartbeat. `requireAuth` stays JWT-only.
- **Credential:** the bearer is a `bp_` key with scope `<product>:licence`. The tenant comes from the key, and `device` is stored as `ci:<device>`.
- **The licence:**
- lives 24 h and carries `kind: "ci"`, `sub: apikey:<id>`;
- has no heartbeat and is **not a seat** (D1);
- the registry records the usage event `ci.licence` once per key and day.
- **Reuse:** one licence per (key, device, UTC day) — 201 for a new one, 200 for a reused one. At most 60 calls per key and hour (429 above that).
- **Werkpilot (D2):** the licence carries the tenant's LiteLLM key.
- The key has `duration: 1d` in LiteLLM.
- Its secret is stored sealed on the licence (AES-256-GCM, `internal/secretbox`, licence id as AAD, migration 0017), so the reused licence hands out the same key again.
- Cost cap: at most 10 LiteLLM keys per API key and day.
- **New env `SECRETS_ENCRYPTION_KEY`** (base64, 32 bytes): optional. Without it, a reuse comes without the LLM key (warning `llm_key_not_repeatable`).
## Integration keys (Werkmeister)
- **Who:** a tenant admin's **user token** from a holder product's web client (`werkmeister-<env>`) can create, list and revoke **that holder's** key, **for their own tenant only**.
- **Limits:** scopes come from a holder allowlist, and the holder product must be booked. The key has a fixed name (= holder), no expiry, and no product.
- **AUTHZ:** a user token on `/v1/api-keys*` is classified as the group `api-keys.integration`, so the plain `api-keys` group stays a service grant (cross-tenant).
## Migration 0016
`(tenant_id, name)` is now unique only among **active** keys. Before, revoke-then-create with the same name failed: the re-issue of an integration key, and also a portal user reusing a name.
## Tests
- The CI test command passes locally with `-race`; golangci-lint v2.12.2 reports 0 issues.
- New tests:
- CI licence: reuse per device/day, claims, refusals, end of booking, rate limit, `ci.licence` instead of a seat;
- Werkpilot: same key on reuse, the case without an encryption key, the daily cap;
- integration: an admin creates, plus refusals (not booked, not an admin, other tenant, allowlist, wrong client, service client), list and revoke own keys only;
- secretbox (AAD, wrong key);
- name reuse after revoke on both stores.
## Deploy (stage)
The companion orca-platform PR (AUTHZ line, `SECRETS_ENCRYPTION_KEY`, `tenant-registry-audience` for `werkmeister-stage`) follows after the merge. The project secret goes in first: `orca secrets set -p platform-stage TENANT_REGISTRY_SECRETS_KEY …`.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
CODEOWNERS rules
requested review from Benjamin_Boenisch 2026-10-13 21:21:39 +00:00
Step 1b of ADR 0001, with the user's decisions D1–D3 recorded:
- POST /v1/licences/ci (PUBLIC_EXPLICIT, the bearer is a tenant API key
with scope <product>:licence): 24 h licence with kind "ci", no
heartbeat, not a seat (D1; the registry records ci.licence usage once
per key and day). Reused per key, device and UTC day; at most 60
calls per key and hour. Unblocks firmwerk#64 step 1.
- Werkpilot CI licences carry the tenant's LiteLLM key (D2) with a
1-day LiteLLM expiry; the secret is sealed on the licence row
(AES-256-GCM, new SECRETS_ENCRYPTION_KEY, migration 0017) so the
reused licence hands out the same key. At most 10 keys per API key
and day. Without the encryption key a reuse comes without the key.
- Integration keys: a tenant admin's user token from a holder product's
web client (werkmeister-<env>) creates, lists and revokes that
holder's key for its own tenant only; scopes from a per-holder
allowlist, the holder product must be booked. A user token on the key
routes is classified as AUTHZ group api-keys.integration, so plain
api-keys stays a service grant.
- Migration 0016: key names are unique among active keys only, so a
revoked name can be reused (re-issue = revoke, then create).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Step 1b of ADR 0001 (
docs/adr/0001-tenant-scoped-api-keys.md), with the user's decisions D1–D3 recorded in the ADR. It follows #70.CI licences by API key (unblocks firmwerk#64 step 1)
POST /v1/licences/ciis PUBLIC_EXPLICIT, like the heartbeat.requireAuthstays JWT-only.bp_key with scope<product>:licence. The tenant comes from the key, anddeviceis stored asci:<device>.kind: "ci",sub: apikey:<id>;ci.licenceonce per key and day.duration: 1din LiteLLM.internal/secretbox, licence id as AAD, migration 0017), so the reused licence hands out the same key again.SECRETS_ENCRYPTION_KEY(base64, 32 bytes): optional. Without it, a reuse comes without the LLM key (warningllm_key_not_repeatable).Integration keys (Werkmeister)
werkmeister-<env>) can create, list and revoke that holder's key, for their own tenant only./v1/api-keys*is classified as the groupapi-keys.integration, so the plainapi-keysgroup stays a service grant (cross-tenant).Migration 0016
(tenant_id, name)is now unique only among active keys. Before, revoke-then-create with the same name failed: the re-issue of an integration key, and also a portal user reusing a name.Tests
-race; golangci-lint v2.12.2 reports 0 issues.ci.licenceinstead of a seat;Deploy (stage)
The companion orca-platform PR (AUTHZ line,
SECRETS_ENCRYPTION_KEY,tenant-registry-audienceforwerkmeister-stage) follows after the merge. The project secret goes in first:orca secrets set -p platform-stage TENANT_REGISTRY_SECRETS_KEY ….🤖 Generated with Claude Code
5f8613f7e6tob89dd2ae4cb89dd2ae4ctoe37e2944e1