Skip to content

fix(vault): require --force to overwrite an existing secret - #6191

Merged
bug-ops merged 1 commit into
mainfrom
feat/issue-5955/zeph-vault-set-silently-overwr
Jul 12, 2026
Merged

fix(vault): require --force to overwrite an existing secret#6191
bug-ops merged 1 commit into
mainfrom
feat/issue-5955/zeph-vault-set-silently-overwr

Conversation

@bug-ops

@bug-ops bug-ops commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • AgeVaultProvider::set_secret_mut now takes an explicit overwrite: bool and returns AgeVaultError::AlreadyExists when a key already exists and overwrite wasn't requested, instead of silently replacing it — the guard lives in the shared zeph-vault crate, so every current and future caller (CLI, OAuth token refresh, durable-key wizard) must state its intent explicitly.
  • CLI zeph vault set <key> <value> gained a --force flag; without it, an existing key is left untouched and the error names the key without ever printing its value.
  • src/bootstrap/oauth.rs (managed OAuth token refresh) and src/init/durable.rs::store_durable_key (already gated by the pre-existing zeph init silently overwrites ZEPH_DURABLE_KEY, permanently orphaning existing durable journal payloads #5874/fix(init): require confirmation before overwriting ZEPH_DURABLE_KEY #5880 rotate-confirmation flow) pass overwrite: true explicitly, with an inline comment justifying why unconditional overwrite is correct there.

This closes the same defect class as the ZEPH_DURABLE_KEY incident (#5874/#5880), one layer down from that fix's wizard-specific gate — any current or future caller of the vault's set-style API now inherits the protection by default.

Closes #5955

Test plan

  • cargo +nightly fmt --check
  • cargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warnings
  • cargo nextest run --config-file .github/nextest.toml -p zeph-vault -p zeph --features "desktop,ide,server,chat,pdf,scheduler" --lib --bins (828 passed)
  • cargo test --doc -p zeph-vault (17 passed)
  • Rustdoc gate (RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links") clean for zeph-vault
  • New unit tests: set_secret_mut reject/replace paths (crates/zeph-vault/src/age.rs), CLI-level reject/overwrite (src/commands/vault.rs), CLI-parsing (src/tests.rs)
  • .local/testing/playbooks/vault.md and .local/testing/coverage-status.md updated (main repo root) with a live-testing scenario for the overwrite guard

@github-actions github-actions Bot added documentation Improvements or additions to documentation rust Rust code changes bug Something isn't working size/L Large PR (201-500 lines) labels Jul 12, 2026
@bug-ops
bug-ops enabled auto-merge (squash) July 12, 2026 23:25
@bug-ops
bug-ops force-pushed the feat/issue-5955/zeph-vault-set-silently-overwr branch from d2e69f8 to 4383099 Compare July 12, 2026 23:31
AgeVaultProvider::set_secret_mut now takes an explicit overwrite flag
and returns AgeVaultError::AlreadyExists when a key already exists and
overwrite is not requested, instead of silently replacing it. The CLI
`zeph vault set <key> <value>` command gained a --force flag to opt in;
without it, an existing key is left untouched and the error names the
key without ever printing its value.

The guard lives in the shared vault crate rather than a single call
site, so every current and future caller (CLI, OAuth token refresh,
durable-key wizard) must state its overwrite intent explicitly. This
closes the same defect class as the ZEPH_DURABLE_KEY incident (#5874),
one layer down from that fix's wizard-specific gate.

Closes #5955
@bug-ops
bug-ops force-pushed the feat/issue-5955/zeph-vault-set-silently-overwr branch from 4383099 to 5b4de12 Compare July 12, 2026 23:40
@bug-ops
bug-ops merged commit 34a4aaa into main Jul 12, 2026
47 checks passed
@bug-ops
bug-ops deleted the feat/issue-5955/zeph-vault-set-silently-overwr branch July 12, 2026 23:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation rust Rust code changes size/L Large PR (201-500 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

zeph vault set silently overwrites an existing key with no confirmation or diff

1 participant