fix(vault): require --force to overwrite an existing secret - #6191
Merged
Conversation
bug-ops
enabled auto-merge (squash)
July 12, 2026 23:25
bug-ops
force-pushed
the
feat/issue-5955/zeph-vault-set-silently-overwr
branch
from
July 12, 2026 23:31
d2e69f8 to
4383099
Compare
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
force-pushed
the
feat/issue-5955/zeph-vault-set-silently-overwr
branch
from
July 12, 2026 23:40
4383099 to
5b4de12
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
AgeVaultProvider::set_secret_mutnow takes an explicitoverwrite: booland returnsAgeVaultError::AlreadyExistswhen a key already exists and overwrite wasn't requested, instead of silently replacing it — the guard lives in the sharedzeph-vaultcrate, so every current and future caller (CLI, OAuth token refresh, durable-key wizard) must state its intent explicitly.zeph vault set <key> <value>gained a--forceflag; 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) andsrc/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) passoverwrite: trueexplicitly, with an inline comment justifying why unconditional overwrite is correct there.This closes the same defect class as the
ZEPH_DURABLE_KEYincident (#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 --checkcargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warningscargo 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)RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links") clean forzeph-vaultset_secret_mutreject/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.mdand.local/testing/coverage-status.mdupdated (main repo root) with a live-testing scenario for the overwrite guard