Open
Conversation
Fix 4 High severity audit findings in src/sync/fetcher.rs: 1. JSON-RPC Batch Reordering: Match responses by JSON-RPC id field instead of assuming positional order. 2. RPC Block-Number Spoofing: Verify block.header.number matches requested height after id-based matching. 3. Truncated Batch Response: Verify response count matches request count; error if blocks are missing. 4. Per-Item Receipt Batch Errors: Check each batch response item for error field and propagate failures instead of silently dropping. Amp-Thread-ID: https://ampcode.com/threads/T-019d458d-01b9-76ca-9fb1-b08263a4d59c Co-authored-by: Amp <amp@ampcode.com>
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
Fixes 4 High severity audit findings in
src/sync/fetcher.rsrelated to RPC batch response validation.Findings Fixed
JSON-RPC Batch Reordering —
get_blocks_batchandget_receipts_batchassumed responses arrive in request order. Now matches responses by JSON-RPCidfield.RPC Block-Number Spoofing — No validation that the returned block's
header.numbermatched the requested height. Now verifies after id-based matching.Truncated Batch Response — If the RPC returned fewer items than requested, sync would report success with gaps. Now verifies response count matches request count.
Per-Item Receipt Batch Errors Silently Dropped — Individual error entries in batch receipt responses were ignored. Now checks each item for
errorfield and propagates failures.Tests Added (7 total)