fix(gossipsub): reject key field in anonymous validation mode - #6621
Merged
Merged
Conversation
jxs
force-pushed
the
fix/gossipsub-validation
branch
from
September 14, 2026 17:40
49681ba to
dce07e5
Compare
`ValidationMode::Anonymous` (the StrictNoSign policy) requires the `signature`, `key`, `from` and `seqno` envelope fields to be absent, but the decoder only checked three of them. A message carrying a non-empty `key` was accepted at ingress and re-emitted verbatim to mesh peers on forward, causing conformant peers to penalise the relaying node for traffic it did not author. Add `ValidationError::KeyPresent` and reject a non-empty `key` in the `Anonymous` validation arm, aligning with the libp2p pubsub spec.
jxs
force-pushed
the
fix/gossipsub-validation
branch
from
September 14, 2026 22:02
dce07e5 to
1e39f32
Compare
dknopik
requested changes
Sep 16, 2026
dknopik
reviewed
Sep 16, 2026
jxs
commented
Sep 16, 2026
jxs
commented
Sep 16, 2026
jxs
force-pushed
the
fix/gossipsub-validation
branch
from
September 16, 2026 14:05
1c6744f to
4be67c8
Compare
Contributor
Merge Queue Status
This pull request spent 24 seconds in the queue, including 4 seconds running CI. Required conditions to merge
|
3esmit
pushed a commit
to 3esmit/rust-libp2p
that referenced
this pull request
Sep 18, 2026
…2p#6621) `ValidationMode::Anonymous` [(the StrictNoSign policy)](https://github.com/libp2p/specs/blob/master/pubsub/README.md#message-signing) requires the `signature`, `key`, `from` and `seqno` envelope fields to be absent, but the decoder only checked three of them. A message carrying a non-empty `key` was accepted at ingress and re-emitted verbatim to mesh peers on forward, causing conformant peers to penalise the relaying node for traffic it did not author. Add `ValidationError::KeyPresent` and reject a non-empty `key` in the `Anonymous` validation arm, aligning with the libp2p pubsub spec and the documented `ValidationMode::Anonymous` behaviour. Approved-by: dknopik <107140945+dknopik@users.noreply.github.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.
ValidationMode::Anonymous(the StrictNoSign policy) requires thesignature,key,fromandseqnoenvelope fields to be absent,but the decoder only checked three of them. A message carrying a
non-empty
keywas accepted at ingress and re-emitted verbatim tomesh peers on forward, causing conformant peers to penalise the
relaying node for traffic it did not author.
Add
ValidationError::KeyPresentand reject a non-emptykeyin theAnonymousvalidation arm, aligning with the libp2p pubsub spec andthe documented
ValidationMode::Anonymousbehaviour.