Repository navigation
fix(id-worlds): refuse replication payloads carrying over-version entries at admission (#7970) - #10944
Conversation
…ries at admission (#7970) ReplicationTracker::accept chained snapshot/tail payloads without checking that each entry is admitted by the frame header version: chain_payload proved only that every line decodes. Restore refuses any entry whose journal_version_required_by exceeds the journal header version, so a signed in-range frame could carry an entry its header does not admit, advance the verified cursor over it, and brick the replica at its next restore. Add validate_payload_entry_versions, mirroring the #4486 journal-header check: Snapshot/Tail payloads are refused with the new typed ReplicationError::EntryRequiresNewerJournal when an entry requires more than envelope.header_version. Wired into both accept and validate_envelope_local, so the production signer also refuses to produce such frames (#6469). Regression tests mirror the #4486 set: over-version snapshot and tail refused with state untouched, signer refusal, and a version-10 control snapshot accepted.
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 32 minutes. View limit details
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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Closes #7970.
Problem
ReplicationTracker::acceptchained Snapshot/Tail payloads without checking that each entry is admitted by the frame's journal header version —chain_payloadproved only that every line decodes as aJournalEntry. Restore refuses any entry whosejournal_version_required_byexceeds the journal header version, so a signed, in-range frame could carry an entry its header does not admit (e.g. aPortalGrantSet, requires version 10, under a version-1 header): the verified cursor advances over it, the durable receiver commits it, and the replica then refuses its own journal at the next restore — the same brick-at-next-open shape #4486 closed for journal headers. A real writer can never produce this frame (it bumps the header before appending such an entry); this is the writer-bug / forged-stream hole, closed at admission.Change
validate_payload_entry_versionsinworld/replication.rs, mirroring the id(replication): ReplicationTracker::accept never checks the payload's own journal header — a snapshot with no header, a foreign world's header, a version-99 header or a duplicate header is verified and advances the cursor, though WorldCore::restore refuses every one #4486validate_payload_journal_header: for Snapshot/Tail payloads, decode each entry and refuse the first whosejournal_version_required_byexceedsenvelope.header_version.ReplicationError::EntryRequiresNewerJournal { required, header }(the dedicated variant the issue left to the implementer).accept(Snapshot and Tail arms, alongside the header check, before any state changes) andvalidate_envelope_local, so the production signer also refuses to produce a frame every receiver would refuse (id(world/replication): SignedReplicationEnvelope::sign signs envelopes every receiver rejects — version, header version, payload digest, cursor chain, terminal and snapshot-base rules unchecked #6469).Tests
snapshot_and_tail_payloads_must_not_carry_over_version_entries, mirroring the id(replication): ReplicationTracker::accept never checks the payload's own journal header — a snapshot with no header, a foreign world's header, a version-99 header or a duplicate header is verified and advances the cursor, though WorldCore::restore refuses every one #4486 set: over-version snapshot refused with cursor untouched; over-version tail refused after a valid snapshot; production signer returnsNonefor the same envelope; control — the same entry under a version-10 snapshot is accepted end to end.id-worldssuite results in the PR thread / issue note.cargo fmt -p id-worlds --checkclean.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.