safekeys/control-plane-api [built]
The Control Plane API is the authority service: it allocates object ids, issues and revokes capability tokens, evaluates policy, and exposes the audit log. Sidecars and CLIs authenticate to it with an API key in the MVP and mTLS later. It never accepts or stores plaintext.
Status: built
Why this exists
Tokens need an issuing authority, policy needs a central place to live and change, and audit needs an append-only home. Centralising those makes the sidecar simple and stateless about authority, and keeps the only network-exposed component entirely outside the decryption path.
Design decisions
go-and-postgres [accepted]
Decision: Implement the control plane as a Go service on Postgres.
Rationale: A single static binary and a battle-tested transactional store, sharing a toolchain with the sidecar and CLI. Policy and audit both need transactions, which rules out a simpler embedded store for the MVP.
no-create-with-value-endpoint [accepted]
Decision: Deliberately omit any endpoint that accepts a secret value.
Rationale: The API's shape is part of the security design — if values cannot be posted, integrators cannot accidentally route plaintext through the control plane. Value creation belongs on the local sidecar channel.
api-key-then-mtls [accepted]
Decision: Start with API keys and add mTLS for sidecars alongside hardware binding.
Rationale: API keys are enough for an MVP where the sidecar is operator-installed, and mTLS earns its complexity only once device identity needs to be attested.
How it works
Allocate an object id and wrapping policy (allocate-object)
The sidecar asks the control plane to register a new secret object.
- Receive — Sidecar requests an object id with an intended wrapping policy and owning principal.
- Validate — Authenticate the sidecar and authorise object creation for that principal.
- Generate — Allocate and persist an object id and its policy record.
- Receive — Sidecar receives the object id; no secret material is involved.
Issue a capability token (issue-token)
The control plane mints a signed token for an object, scope, and audience.
- Receive — Receive a mint request with object id, scope, audience, and TTL.
- Validate — Evaluate policy for the requester, scope, object, and audience.
- Generate — Build claims and sign the token with the active kid.
- Record — Record the jti and the issuance event.
- Send — Return the token URI.
Revoke a token (revoke-token)
The control plane adds a jti to the denylist.
- Receive — Receive a revoke request for a jti or object.
- Record — Add to the denylist and write an audit record.
- Observe — Subsequent resolves with that jti are denied.
Guarantees
no-plaintext-in-api
No endpoint may accept or return plaintext secret material.
Acceptance criteria:
- [ ] Request and response bodies carry identifiers, scopes, and metadata only
- [ ] The API has no create-with-value endpoint
- [ ] Contract enforced by schema tests on every handler
authenticated-clients
Every endpoint requires an authenticated, authorised client.
Acceptance criteria:
- [ ] API key authentication in the MVP; mTLS for sidecars later
- [ ] Per-client scopes limit which operations are reachable
- [ ] Unauthenticated requests are rejected before any state change
idempotent-issue-and-revoke
Issue and revoke tolerate retries without duplicating or corrupting state.
Acceptance criteria:
- [ ] Revoking an already-revoked jti is not an error
- [ ] A retried issue does not mint two live tokens for one logical request
- [ ] State changes are transactional in Postgres
token-issuance-is-audited
Every issuance and revocation is recorded.
Acceptance criteria:
- [ ] Principal, object, scope, audience, jti, and timestamp are recorded
- [ ] Records are append-only
- [ ] Records never contain secret material
Test specifications
no-endpoint-accepts-plaintext
Given:
- attempt: "POST /v1/objects with a value field"
When: allocate-object
Then:
- assertion: the request is rejected
- assertion: no value is persisted
Contracts verified: no-plaintext-in-api
unauthenticated-request-rejected
Given:
- credentials: "none"
When: issue-token
Then:
- assertion: the request is rejected with an authentication error
- assertion: no token is minted
Contracts verified: authenticated-clients
revoke-twice-is-safe
Given:
- revoke_calls: 2
When: revoke-token
Then:
- assertion: both calls succeed
- assertion: the jti is denied
Contracts verified: idempotent-issue-and-revoke
issuance-audited
When: issue-token
Then:
- assertion: an audit record exists for the issuance
- assertion: it contains the jti and scope
Contracts verified: token-issuance-is-audited
Implementation
- Primary: apps/control-plane/internal/api/api.go
- Test code: apps/control-plane/internal/inttest/control_plane_test.go
- Test code status: manual
See Also
- safekeys/capability-token
- safekeys/policy-engine
- safekeys/audit-logging