safekeys/secret-injection [built]
Injection is how a resolved secret reaches a consumer without passing through model context. The MVP supports four methods — environment variable, 0600 temp file, Unix socket/pipe, and exec wrapper — chosen by what the consuming process needs. The agent receives only a success code, a placeholder name, or a path it cannot usefully read.
Status: built
Why this exists
A resolved secret is useless unless the process that needs it can actually get it. Most such processes are CLIs and services that expect an env var or a file path, not an in-process API — and returning the value to the agent would defeat the design. Injection bridges that gap while keeping the value on the non-LLM side of the boundary.
Design decisions
four-methods-not-one [accepted]
Decision: Support env, 0600 temp file, socket/pipe, and exec rather than a single injection mode.
Rationale: Consumers differ — some read env, some need a file path, some are long-running services. Forcing one mode would push integrators to work around the tool and handle plaintext themselves, which is the failure mode being designed out.
exec-wrapper-preferred [accepted]
Decision: Make the exec wrapper the preferred and best-documented path.
Rationale: It gives the strongest guarantee — the value exists only in the child's environment for the life of the command — and keeps the caller's return surface to an exit code.
placeholder-over-value [accepted]
Decision: Return a placeholder name or path instead of a value whenever a return is needed.
Rationale: It preserves the ergonomics of "here is something to use" without giving the agent anything sensitive.
mvp-scope-socket-pipe-deferred [accepted]
Decision: Ship env, file, and exec injection in the MVP; defer the long-running socket/pipe method.
Rationale: The three shipped methods cover every CLI and service consumer the two-agent demo exercises. The socket/pipe method exists for long-running local services, which is not an MVP shape, and the injector explicitly refuses the method rather than silently falling back to another — so a caller cannot be misled about which channel was used.
Consequences: inject: socket injection is not implemented in the MVP. The method enum is closed and the injector errors on it.
Date: 2026-09-22
How it works
Inject as an environment variable (inject-env)
For a child process that already reads env — CLIs and SDKs.
- Receive — Sidecar receives a resolve request scoped to inject-env for a named variable.
- Setup — Resolve and decrypt the object.
- Send — Spawn the consumer with the value in its environment; do not inherit it in the agent's env.
- Observe — Return a success code only.
Inject as a 0600 temp file (inject-file)
For tools that require a file — kubeconfig, certificates.
- Receive — Sidecar receives a resolve request scoped to inject-file.
- Setup — Write the value to a temporary file owned by the consumer with mode 0600.
- Send — Return the path to the consumer.
- Delete — Remove the file when the consumer exits.
Inject over a Unix socket or pipe (inject-socket)
For long-running local services.
- Receive — Sidecar receives a resolve request scoped for a socket or pipe consumer.
- Send — Deliver the value over the established local channel.
- Delete — Zeroise after delivery.
Inject via the exec wrapper (inject-exec)
Run a command with secrets injected and the environment scrubbed.
- Receive — Sidecar receives safekeys exec --token ... -- <command>.
- Resolve — Resolve all tokens required by the command.
- Setup — Spawn the command as a child of the sidecar with a minimal environment and injected values.
- Observe — Return the command's exit code; values never reach the caller.