Skip to content

fix(floodsub): bind the message key to the author peer id#3575

Merged
tabcat merged 1 commit into
libp2p:mainfrom
tabcat:fix/floodsub-key-binding
Jul 18, 2026
Merged

fix(floodsub): bind the message key to the author peer id#3575
tabcat merged 1 commit into
libp2p:mainfrom
tabcat:fix/floodsub-key-binding

Conversation

@tabcat

@tabcat tabcat commented Jul 18, 2026

Copy link
Copy Markdown
Member

Description

Under the StrictSign signature policy, messagePublicKey returned the public
key from a message's key field without checking that it corresponds to the
message's from peer id. When from carries its own public key (Ed25519,
secp256k1), that key is authoritative and should be used instead.

Prefer from's own public key when it is present, and otherwise require the
supplied key to derive to from, so a signed message is always verified against
the key its from peer id commits to. @libp2p/gossipsub performs the
equivalent check.

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if necessary (this includes comments as well)
  • I have added tests that prove my fix is effective or that my feature works

StrictSign validation did not verify that a supplied message key
corresponds to the `from` peer id when `from` inlines its public key
(Ed25519, secp256k1). Bind the key to the author for all peer id types.
@tabcat
tabcat marked this pull request as ready for review July 18, 2026 00:07
@tabcat
tabcat requested a review from a team as a code owner July 18, 2026 00:07
@tabcat
tabcat merged commit 5459e13 into libp2p:main Jul 18, 2026
34 checks passed
@tabcat tabcat mentioned this pull request Jul 18, 2026
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.

1 participant