fix: authenticate p2p full-state sync responses#2155
Open
createkr wants to merge 1 commit intoScottcjn:mainfrom
Open
fix: authenticate p2p full-state sync responses#2155createkr wants to merge 1 commit intoScottcjn:mainfrom
createkr wants to merge 1 commit intoScottcjn:mainfrom
Conversation
e3dcc85 to
277f685
Compare
Contributor
Author
|
For bounty payout, please use RTC wallet: RTC1d48d848a5aa5ecf2c5f01aa5fb64837daaf2f35. |
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.
fix(p2p): require authenticated signatures for full state sync
Problem
The full-state sync path accepted unauthenticated remote state and merged it directly into local CRDTs.
request_full_sync()built aGossipMessagewith an empty signature and passed the remote state into_handle_state()without authenticating the response first._handle_state()then merged the payload into local attestation, epoch, and balance state.Because
_sync_loop()calls this path regularly, any state sync response could inject arbitrary CRDT values into a node.Fix
Harden the full-state sync path in three places:
_handle_state()now rejects empty or invalid signatures before any merge_handle_get_state()returns signed state responsesrequest_full_sync()verifies the returned state signature before forwarding the payload for mergeChanges
node/rustchain_p2p_gossip.pytest_f1_state_sync_bypass.pyTesting
Compatibility
No schema changes. This only tightens the trust boundary for state sync and preserves the existing signed-message model already used elsewhere in the gossip layer.