feat: vault exec — inject secrets as env vars at launch#49
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
6 tasks
…ars at launch Adds `vault exec [--profile P] -- <cmd>`, which resolves every var in a configurable `[exec.profiles.<name>]` mapping against the agent and injects the plaintext only into the launched child's environment — never the invoking shell, never disk — instead of exporting API keys into a shell session for its lifetime. Mappings are edited via `vault config exec set/unset/list`. Each mapping is an item spec: `<item name>` (password field, default) or `<item name>#<field>` where `<field>` is `username`/`notes`/`totp`/ `custom:<name>`. The last resolves a named custom field, which required a new `Field::Custom(String)` wire variant (vault-ipc) plus custom-field decryption support in vault-core (`PlainCipher::fields`, `DecryptOptions::custom_fields`) and vault-agent. Every var is resolved before the child spawns — a missing item, missing field, or ambiguous name aborts first, so the child never sees a partially-populated environment. See docs/exec.md for the grammar and what env-var injection does and doesn't protect against. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Format fixes for the vault-exec commit that CI's rustfmt check caught. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
UnbreakableMJ
force-pushed
the
vault-exec
branch
from
July 19, 2026 12:13
d234155 to
e1622fc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
vault exec [--profile P] -- <cmd>verb resolves every var in a[exec.profiles.<name>]mapping against the agent and injects the plaintext only into the launched child's environment — never the invoking shell, never disk. Mappings are edited viavault config exec set/unset/list(new nested subcommand).<item name>or<item name>#<field>, field =password/username/notes/totp/custom:<name>) is parsed in a newcrates/vault-cli/src/env_exec.rs.custom:<name>requires a newField::Custom(String)wire variant (vault-ipc), plus custom-field decryption support added tovault-core(PlainCipher::fields,DecryptOptions::custom_fields) and resolved invault-agent.docs/exec.md,README.mdusage section,PRD.md§7.1 verb-table rows,CHANGELOG.mdentry.Test plan
cargo build --workspacecargo clippy --workspace --all-targets --all-features -- -D warnings(CI-exact, fresh isolatedtarget/clippy)cargo test --workspace --all-targets— all green, including new tests invault-config(exec_set_get_unset_round_trips,exec_profiles_absent_until_set) andvault-cli::env_exec(spec-grammar unit tests)reuse lint— compliantvault config exec set/listround-trip, andvault exec --against a locked/unregistered agent confirmed the fail-closed path (resolves → hitsLocked→ aborts before the child ever spawns)🤖 Generated with Claude Code