Skip to content

Control Plane Data Model ​

The Postgres schema backing the control plane. It stores identifiers, policy, and outcomes only — never plaintext, never an unwrapped key. Wrapped DEKs live in the folder manifest; the KEK lives in the key store.

WARNING

No table has a column capable of holding plaintext, a DEK, or a KEK. This is asserted by a schema-level test in CI, not by convention.

objects ​

Registered secret objects. One row per object or folder.

ColumnTypeNotes
idtext PKObject identifier; matches a token's sid. Pattern ^[A-Za-z0-9][A-Za-z0-9._:-]*$.
folder_idtext NULLGroups objects into a folder transport unit.
owner_principaltextIssuing principal for attribution (e.g. example-org/agent-a).
content_typetext NULLHint mirrored from the manifest. Never used to gate decryption.
wrapping_kidtextThe KEK that wraps this object's DEK. Routes the unwrap; holds no key material.
created_attimestamptzRow creation.
revoked_attimestamptz NULLSet when the object is retired.

tokens ​

Issued capability tokens, keyed by the unique jti.

ColumnTypeNotes
jtitext PKUnique token id. Never reused across issuers.
sidtext FKTarget object -> objects(id).
isstextIssuer identifier.
subtext NULLSubject principal, for attribution.
scopetext[]Granted scopes; subset of read, unwrap, inject-env, inject-file, sign.
audtextAudience / environment binding.
nbftimestamptzNot-before.
exptimestamptzExpiry. TTL is minutes to hours, never days.
issued_attimestamptzMint time.
revoked_attimestamptz NULLSet on revocation. Non-null means denied.

INFO

A partial index on (jti) WHERE revoked_at IS NOT NULL is the lookup that runs on every resolve. It stays small because it holds only actively revoked ids, which is why v1 stores a denylist rather than an allowlist of live tokens.

audit ​

Append-only. No update or delete path is exposed through the application.

ColumnTypeNotes
idbigserial PKMonotonic; also the ordering key.
attimestamptzEvent time.
eventtextissue, revoke, resolve, deny, or policy_deny.
jtitext NULLToken involved, when applicable.
sidtext NULLObject involved.
principaltext NULLRequester.
hosttext NULLResolving host.
scopetext NULLRequested scope.
outcometextallowed or denied.
reasontext NULLMachine-readable denial reason (exp, aud, revoked, ...).
detailjsonb NULLExtra non-secret context. Validated against a denylist of keys before insert.

DANGER

The application role has no UPDATE or DELETE grant on audit. Immutability is enforced by database grant, not by application convention, so a compromised application cannot rewrite history.

policy_rules ​

Resolution policy, evaluated at issuance and again locally at resolve.

ColumnTypeNotes
idtext PKRule identifier; referenced in audit reason on denial.
effecttextallow or deny.
principaltext NULLMatch requester (null = any).
sidtext NULLMatch object (null = any).
scopetext[]Scopes this rule governs.
audtext NULLAudience / environment the rule applies to.
injection_methodtext NULLRestrict to one of env, file, socket, exec.
priorityintegerEvaluation order; higher wins.
created_attimestamptzRow creation.

Invariants ​

  1. No secret material — no table has a column capable of holding plaintext, a DEK, or a KEK.
  2. Append-only audit — the application role has no UPDATE or DELETE grant on audit.
  3. Revocation is immediate — a resolve checks tokens.revoked_at and the denylist index in the same transaction as policy evaluation.
  4. Deny by default — policy_rules is an allow/deny list with no implicit permit.
  5. No orphan tokens — tokens.sid is a foreign key to objects.id.

INFO

The wrapped DEK lives in the folder's manifest.json, so the database never holds key-shaped data and the folder stays the single portable unit. Postgres stores only wrapping_kid — an identifier, not material — to route an unwrap to the right KEK.