Repository navigation
fix(vault): x25519 recipients can open their vault; rotate fails closed - #114
Merged
Merged
Conversation
An identity added with `vault add-recipient --gpub` could not open the vault: load_recipients_for only matched symmetric recipients, so the added key got an authentication failure on verify/list/cat/open/rotate. Rotating with the original key while dropping itself then left a vault that no key could read. - load_recipients_for unwraps the epoch key from the X25519 recipient whose public matches the identity (ISK-derived X25519 secret). - vault rotate reseals from the epoch key it actually unwrapped instead of re-deriving it from the operator ISK (which reset the manifest when an X25519 identity rotated). - vault rotate refuses, before any write, a kept symmetric recipient it cannot re-wrap, an unusable X25519 public, or a kept set nobody can open; verifies the new wraps, manifest and resealed objects before the header commit; and restores the old epoch on any failure. - geode open writes extracted plaintext owner-only (0600 for a 0644 entry), created with that mode. Regression tests: add-recipient key reads; drop old + reseal keeps the new key and locks out the old; lockout rotate refused with the vault unchanged; open output is 0600.
VirtualMachinist
marked this pull request as ready for review
October 26, 2026 20:22
This was referenced Oct 26, 2026
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.
Problem
An identity added with
geode vault add-recipient --gpubcould not use the vault.verify,list,cat,openandrotatewith its.gkeyall exited 2 (authentication / integrity failure).vault rotate --drop-recipient <original> --reseal, run with the original key, then reported success but left a vault that no key could read.Root cause
crates/geode-cli/src/cmd/mod.rs:300(load_recipients_for) only matchedRecipient::Symmetricentries bykey_id. An X25519 recipient was never unwrapped, so the added identity always fell through toError::AuthFail. A second issue in the CLI rotate path made it worse: it resealed fromoutcome.old_ek, whichrotate::plan_rotationre-derives from the operator's ISK (crates/geode-core/src/rotate.rs:139). That is only correct for the vault's original symmetric identity. A rotation run by an X25519 identity therefore produced an empty manifest and silently mis-wrapped any symmetric recipient it kept.Fix
load_recipients_fornow also unwraps the X25519 recipient whose public key matches the identity, using the ISK-derived X25519 secret (key::x25519_secret, shared with.gpubgeneration).ctx.ek).recipients.json,header.jsonand the sealed policy, and removes the new epoch dir.geode open: extracted files are written owner-only ((mode & 0o700) | 0o600, so 0644 becomes 0600). The file is created 0600 before any plaintext is written.Unreleasedentries added. No version bump.Tests (
crates/geode-cli/tests/rotate_cli.rs)add_recipient_new_key_reads: after add-recipient, the new key can verify, list and cat.rotate_drop_old_reseal_new_key_still_reads: drop the original + reseal; the new key still reads, the old key exits 2, and the new key can rotate again.rotate_lockout_refused_vault_unchanged: a rotate that would lock out the symmetric recipient is refused (exit 1), the vault is byte-identical afterwards, and both keys still read.open_writes_plaintext_0600: a 0644 source comes out ofopenas 0600.Local: fmt clean; clippy
-D warningsclean both with default features and with--features test-trusted-root;cargo test --workspace --exclude geode-cli,cargo test -p geode-cli --features test-trusted-rootandcargo test -p geode-cliall pass.