Repository navigation
Description
API product implementation work · roadmap #1008 · use parent dependency order; not a separate product rank.
Part of #857. Stack rank 9 of 13. Depends on: T1 (the ApiKeyWire struct is what makes the list endpoint unable to leak key_hash). Runs in parallel with T2–T4.
Color
Today "a user sets up their own connection" is: ask the operator. create_key is operator-only (operator_only(&principal), not an org guard), there is no GET list endpoint at all (only POST + DELETE are routed), and no frontend surface mentions API keys anywhere. This is the product half of the epic — a customer admin mints a key, sees the plaintext once, and connects — and it is what the docs surface (T10) documents as the getting-started flow.
Scope
Backend (er-server):
create_keydropsoperator_onlyforguard(&principal, &org, Role::Admin)with a role ceiling: a minted key's role ≤ the minter's (operator already unmintable viaparse_key_role). The operator path keeps working — operator passes any org guard.- New
GET /v1/orgs/{org}/api-keys(Admin) returningApiKeyWirerows — id, role, created_at, revoked_at; neverkey_hash, enforced by T1's wire struct rather than by care. revoke_keygets the same admin path.- Doc comments in the house
Role: summary (`METHOD /path`)shape — the manifest, envelope and OpenAPI gates all regenerate from them, so the new route fails CI until described. - Audit:
key.issue/key.revokealready write audit rows — extend assertions, don't rebuild.
Frontend:
- BFF routes under
src/app/api/orgs/[org]/api-keys/…with authz entries (check-bff-authz.mjsfails without them). - Settings page cloning the webhook show-once pattern (
webhooks-content.tsx:254renderscreated.secretexactly once): mint → plaintext displayed once with a copy affordance → list shows metadata only → revoke. Grayscale per the design system; registered in the axe gate.
Skills in this PR: er-server-control-plane (minting rules change), frontend-bff (new routes).
Out of scope
Key rotation, expiry, scoped/limited keys — file follow-ups if wanted. The docs page itself (T10).
Testing
pg_auth.rs harness (one test per pg_*.rs file, sequential phases):
- Admin mints for own org → 201 with plaintext.
- Admin cannot mint for another org → 404 (the cross-org rule — not 403).
- Steward/viewer cannot mint → 403.
- Ceiling: admin cannot mint operator → 422 (already enforced; keep the regression).
- Plaintext appears in exactly one response and never again; the list returns no hash and no plaintext.
- Audit rows for issue + revoke asserted.
Frontend: component tests for the show-once flow; Playwright functional path (mint → copy → list → revoke) against the mock; make frontend.
Definition of done
Epic DoD, plus: a fresh org's admin can mint → copy → successfully call GET /v1/orgs/{org} with the new key, and that flow is written down as the getting-started content T10 publishes.
Activity
test(api): launch proof, a tenant resolves its data with its own key …
test(api): launch proof — a tenant resolves its data with its own key…
athvin commentedon Nov 25, 2026
Claimed — working in the draft PR linked above (closing it releases the claim).
feat(api): org admins mint, list and revoke their own API keys (#866)
feat(frontend): API keys settings page — mint, show once, list, revoke (
chore: keep key management off the agent surface; skills; generated r…
test(frontend): re-baseline config studio for the API keys settings t…
style: cargo fmt (#866)
chore(span): the er.statement bound counts the new api_key by_org sta…
chore(api): regenerate schema.d.ts for the api-keys list (#866)
feat(api): self-service API keys — admin mint/list/revoke with a role…
test(security): key-route authz, and no wholesale serialization on th…
test(security): key-route authz, and no wholesale serialization on th…
test(security): regression pass over the OpenAPI, visibility and key …