safekeys/secret-creation [built]
Creating a secret is the one flow that touches plaintext, and it deliberately bypasses the model. A human CLI or agent SDK sends plaintext to the sidecar over a local authenticated channel; the sidecar encrypts locally and asks the control plane to allocate an object id and wrapping policy; only a capability token is returned to the agent.
Status: built
Why this exists
If creation flowed through model context — "here is the API key, please store it" — the value would already be compromised at step one, whatever happened afterwards. Routing plaintext caller→sidecar and returning only a token means even the creation moment keeps the model off the path.
Design decisions
local-channel-for-create [accepted]
Decision: Send plaintext from caller to sidecar over the local authenticated Unix socket, never over the network.
Rationale: Keeps the value off the wire entirely during creation and makes the trust boundary a filesystem permission the OS already enforces.
stdin-not-argv [accepted]
Decision: Accept values via stdin or file only; never as a command-line argument.
Rationale: argv is visible in process listings, shell history, and audit logs — a trivially avoidable leak.
create-not-a-web-console-flow [accepted]
Decision: Do not build a web console for creation in the MVP.
Rationale: A browser form would reintroduce a network path for plaintext without changing the security story; the CLI and SDK cover the two real callers.
How it works
Create a secret from the CLI (create-from-cli)
A human supplies a value out-of-band and receives a token.
- Receive — Operator pipes the value to
safekeys createvia stdin or a file — not as an argument. - Send — CLI sends the plaintext to the local sidecar over the Unix socket.
- Receive — Sidecar asks the control plane to allocate an object id and wrapping policy.
- Encrypt — Sidecar generates a DEK, encrypts the plaintext locally, and writes the ciphertext object.
- Transmit — Sidecar sends the DEK for wrapping under the KEK in the key store.
- Receive — A capability token is returned to the caller; the plaintext is discarded.
Create a secret from an agent SDK (create-from-agent)
An agent creates a secret and receives only a token — it never supplies a value it read from context.
- Receive — Agent SDK calls create_secret with metadata and a value source that is not model context (a file path or an out-of-band reference).
- Send — SDK forwards the value to the sidecar over the local channel without it entering the agent's transcript.
- Receive — SDK returns a capability token and folder path to the agent.
- Observe — The agent transcript contains no plaintext.