Skip to content

Reject unknown P2P message codes as malicious - #2428

Open
a-shannon wants to merge 11 commits into
ergoplatform:v6.0.7from
a-shannon:fix/unknown-p2p-message-code
Open

a-shannon wants to merge 11 commits into
ergoplatform:v6.0.7from
a-shannon:fix/unknown-p2p-message-code

Conversation

@a-shannon

@a-shannon a-shannon commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Classify unregistered P2P message codes as malicious protocol input so the existing permanent-penalty, blacklist and connection-teardown path handles them. Previously MessageSerializer returned Failure(Error); PeerConnectionHandler logged that generic failure, resumed reading and retained the invalid prefix, parsing it again as later data accumulated. Returning MaliciousBehaviorException selects the existing penalty/teardown behavior. Known codes, incomplete frames, payload bounds and the wire format are unchanged.

Head b2e0c4690a836f124ba7bf831887a32140873776 remains targeted at v6.0.7, base e927ab38e652423adcb79a41e8a052e348545320. The original two-file correction, including its complete zero-payload unknown-code regression, is unchanged.

The new eleven-file prerequisite increment adds settled-seed/isolation D, owned by #2535, plus G, owned by #2511, and X, owned by #2549. G corrects full-summary anchors, tip/mode cache identity and retained-common-ancestor download scheduling. X revisits cached sections after their headers arrive. This adds four shared production paths and their tests to the cumulative PR; it does not alter the message-code correction.

Review the exact shared reader prerequisite R, owned by #2535, before G, then merge the owning #2511/#2549 corrections before this consumer. Existing H, U and T remain unchanged. Selected-header targets, all convergence assertions and original deadlines are retained. T's separate 2.5-second failure-only collection still rethrows the original timeout. Exact common commits avoid importing unrelated owner branches.

At 6fe05788, native IT passed 49/50 with one ignored case; DeepRollBack alone timed out at minimum 221. The older IT job passed 12/13 with one ignored case and failed the flattened stored-header comparison. These observations are historical; G/X are independently demonstrated corrections, not exclusive attribution of either CI failure.

Related scopes remain distinct: #2320 substitutes ErgoException, which still takes the log-only path; #2366 checks peer versions after message identification; declared-length bounds are upstream via #2306, covering closed #2381; and #2404/#2405 reject trailing payload bytes.

The actual final composition passed normal compilation and 49/49 focused synchronizer/history/cache tests, including UTXO and Digest wake-up cases. Its preceding D composition passed normal IT compilation and H/D 33/33. Unchanged prior H/T 37/37, MessageSerializer 5/5 and network 71/71 evidence remains historical and input-qualified; the original negative control failed with java.lang.Error before the correction. Independent source review found no blockers. Local checks did not run Docker or establish full CI success. New-head native CI remains pending in #2533.

@kushti
kushti changed the base branch from v6.0.5 to v6.0.7 August 31, 2026 17:44
@a-shannon
a-shannon force-pushed the fix/unknown-p2p-message-code branch from bec4041 to da4c5ae Compare September 4, 2026 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants