fix(durable): wire control-entry HMAC to a production key with read-side verification#6130
Merged
Merged
Conversation
…ide verification LocalBackend::with_hmac_key had no production caller, so the row-level control-entry HMAC documented in INV-8 was never computed, and no read-side verification existed at all. Derive the key as a BLAKE3 subkey of the vault-resolved ZEPH_DURABLE_KEY, wire it at the same choke points as the AEAD payload cipher, gate it on the existing shared_db policy, and verify every EffectIntent row on read. An unkeyed reader that encounters a row still carrying a stamped HMAC now fails closed instead of silently trusting it.
bug-ops
force-pushed
the
fix/6043-durable-control-hmac-wiring
branch
from
July 12, 2026 11:53
8fa4eab to
5047732
Compare
11 tasks
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
LocalBackend::with_hmac_key(the row-level control-entry HMAC documented at INV-8 for shared-DB deployments) had no production caller, so thehmacfield onEffectIntentcontrol rows was always stampedNone, and no code path ever recomputed or verified it on read — the spec's claim that this closes theEffectIntent-forgery attack vector (security HIGH-2b) was false in code.derive_keysubkey of the same vault-resolvedZEPH_DURABLE_KEYused for the AEAD payload cipher (distinct domain-separation context, no new vault secret).zeph durable list/show/inspect/prune/resume).shared_db/postgres://detection policy — no new config surface, so no--init/--migrate-configchanges were needed.LocalBackend::row_to_entry: everyEffectIntentrow is recomputed and constant-time-compared against its stored HMAC, failing closed with a newDurableError::ControlIntegrityvariant on mismatch.shared_dbconfig drift between a writer and a reader over the same physical file).Single-user local SQLite is unaffected —
hmacstaysNoneand unverified, matching the documented INV-8 stance.Closes #6043
Closes #6044
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 --workspace --features "desktop,ide,server,chat,pdf,scheduler" --lib --bins— 13008 passed, 0 failedcargo test --doc --workspace --features "desktop,ide,server,chat,pdf,scheduler"— all doc-tests passRUSTFLAGS="-D warnings" RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps --workspace --features "desktop,ide,server,chat,pdf,scheduler"