fix: author account-scoped requests with an ephemeral key, not the identity key - #173
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. WalkthroughRestore and last-trade-index requests now use fresh ephemeral keys for outer DM authorship and response handling. Long-lived identity keys remain encrypted identity proofs. Documentation describes the key separation and privacy rules. ChangesAccount-scoped DM privacy
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to Restore and trade-index requests now use fresh ephemeral authors and reply keys while preserving encrypted identity proofs, preventing permanent identity exposure in relay-visible events and isolating restore replies between runs. No current merge-blocking risk remains. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. A rabbit sends a fleeting key, Comment |
|
Good pick! Well scoped, safely mergeable. LGTM! |
Close #172
The three account-scoped requests (
Action::LastTradeIndex,Action::RestoreSession, and the restore stage-2Action::Ordersfetch) passedidentity_keysas both the identity and the trade-key argument ofsend_dm, so the outer kind-14 was authored by the permanent identity pubkey and the identity proof was silently dropped (mostro-core only includes it when the keys differ)Each call site now generates a fresh
Keys::generate()that authors the event, and the whole trio switches togethersend_dm,wait_for_dmandparse_dm_eventsall use the same ephemeral key, since the daemon replies NIP-44-encrypted toevent.sender.identity_keysstay where the protocol wants them: inside the encrypted proof, which is what the daemon resolves the account from (event.identity).No daemon or dependency changes, no public signature changes, and no wallet index burned (
check_trade_indexonly coversNewOrder | TakeBuy | TakeSell). Thesender != mostro_pubkeychecks are untouched.Bonus hardening on restore (the only flow with no
request_id): a stale restore reply replayed by a relay used to be decryptable by the identity key and could seed outdatedRestoreData; a per-run ephemeral key cannot decrypt replies addressed to earlier runs, so they can never be consumedTwo notes, neither a behavior regression:
prune_closed_pending_waiters.Verified with
cargo fmt --check,cargo clippy --all-targets(clean) and the fullcargo testsuite (all green)Summary by CodeRabbit
Security & Privacy
Documentation