Skip to content

fix(init): require confirmation before overwriting ZEPH_DURABLE_KEY#5880

Merged
bug-ops merged 1 commit into
mainfrom
fix/5874-durable-key-overwrite
Jul 10, 2026
Merged

fix(init): require confirmation before overwriting ZEPH_DURABLE_KEY#5880
bug-ops merged 1 commit into
mainfrom
fix/5874-durable-key-overwrite

Conversation

@bug-ops

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

Copy link
Copy Markdown
Owner

Summary

  • zeph init's durable-execution wizard step unconditionally overwrote ZEPH_DURABLE_KEY in the age vault on every re-run, with no check for a pre-existing key and no warning. Since this key seals every payload in durable_journal, silently rotating it permanently and irrecoverably orphaned all previously-sealed payloads (replay integrity check failed: sealed payload did not authenticate).
  • The wizard now checks for an existing key via a new vault_has_durable_key() helper before generating a new one. If a key already exists, it warns about permanent, irrecoverable payload loss and requires the user to type the exact confirmation phrase rotate (validated by a newly-extracted pure wants_rotation() function) before proceeding. Any other input reuses the existing key, leaving the vault untouched.
  • Confirmed via grep that src/init/durable.rs is the only production write site for ZEPH_DURABLE_KEY — no other bypass path exists.

Closes #5874

Test plan

  • cargo +nightly fmt --check — clean
  • cargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warnings — clean
  • cargo nextest run --config-file .github/nextest.toml --workspace --features "desktop,ide,server,chat,pdf,scheduler" --lib --bins — 12445 passed
  • RUSTFLAGS="-D warnings" RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps --workspace --features "desktop,ide,server,chat,pdf,scheduler" — clean
  • Added regression tests for vault_has_durable_key(), store_durable_key()'s reuse/rotate/fresh-setup vault-mutation contract, and wants_rotation()'s exact/case-sensitive match semantics (21 tests total in the durable filter)

@github-actions github-actions Bot added documentation Improvements or additions to documentation bug Something isn't working size/L Large PR (201-500 lines) labels Jul 10, 2026
@bug-ops
bug-ops enabled auto-merge (squash) July 10, 2026 16:20
zeph init's durable-execution wizard step unconditionally overwrote
ZEPH_DURABLE_KEY in the age vault on every re-run, silently and
irrecoverably orphaning every previously-sealed durable_journal
payload with no backup and no warning.

The wizard now detects an existing key via vault_has_durable_key()
before generating a new one. If a key already exists, it warns about
permanent payload loss and requires typing the exact confirmation
phrase "rotate" (checked via the new wants_rotation() pure function)
before proceeding; any other input reuses the existing key untouched.

Closes #5874
@bug-ops
bug-ops force-pushed the fix/5874-durable-key-overwrite branch from ce5b850 to 77dda5b Compare July 10, 2026 16:28
@bug-ops
bug-ops merged commit f62d57c into main Jul 10, 2026
43 checks passed
@bug-ops
bug-ops deleted the fix/5874-durable-key-overwrite branch July 10, 2026 16:36
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 size/L Large PR (201-500 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

zeph init silently overwrites ZEPH_DURABLE_KEY, permanently orphaning existing durable journal payloads

1 participant