Skip to content

feat: vault exec — inject secrets as env vars at launch#49

Merged
UnbreakableMJ merged 2 commits into
mainfrom
vault-exec
Jul 19, 2026
Merged

feat: vault exec — inject secrets as env vars at launch#49
UnbreakableMJ merged 2 commits into
mainfrom
vault-exec

Conversation

@UnbreakableMJ

Copy link
Copy Markdown
Contributor

Summary

  • New 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 via vault config exec set/unset/list (new nested subcommand).
  • Item-spec grammar (<item name> or <item name>#<field>, field = password/username/notes/totp/custom:<name>) is parsed in a new crates/vault-cli/src/env_exec.rs.
  • custom:<name> requires a new Field::Custom(String) wire variant (vault-ipc), plus custom-field decryption support added to vault-core (PlainCipher::fields, DecryptOptions::custom_fields) and resolved in vault-agent.
  • Fail-closed: every var is resolved before the child spawns — a missing item, missing field, or ambiguous name aborts first, so the child never starts with a partially-populated environment.
  • Docs: new docs/exec.md, README.md usage section, PRD.md §7.1 verb-table rows, CHANGELOG.md entry.

Test plan

  • cargo build --workspace
  • cargo clippy --workspace --all-targets --all-features -- -D warnings (CI-exact, fresh isolated target/clippy)
  • cargo test --workspace --all-targets — all green, including new tests in vault-config (exec_set_get_unset_round_trips, exec_profiles_absent_until_set) and vault-cli::env_exec (spec-grammar unit tests)
  • reuse lint — compliant
  • Manual end-to-end: vault config exec set/list round-trip, and vault exec -- against a locked/unregistered agent confirmed the fail-closed path (resolves → hits Locked → aborts before the child ever spawns)

🤖 Generated with Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

UnbreakableMJ and others added 2 commits July 19, 2026 15:12
…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
UnbreakableMJ merged commit 6010981 into main Jul 19, 2026
9 checks passed
@UnbreakableMJ
UnbreakableMJ deleted the vault-exec branch July 19, 2026 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant