notifications/libp2p: Punish notification protocol misbehavior on outbound substreams (#7781)
This PR punishes behaviors that deviate from the notification spec. When a peer misbehaves by writing data on an unidirectional read stream, the peer is banned and disconnected immediately. In this PR: - The `NotificationOutError` is enriched with termination reason and made publically available for higher levels - The protocol misbehavior is propagated through the `CloseDesired` events - The network behavior of the protocol is responsible for banning the peer. - The peer is banned immediately and, as a result, the reputation system disconnects the malicious / misbehaving peer - Logs are enriched with protocol names Closes: https://github.com/paritytech/polkadot-sdk/issues/7722 cc @paritytech/networking --------- Signed-off-by:Alexandru Vasile <alexandru.vasile@parity.io> Co-authored-by:
Bastian Köcher <git@kchr.de>
parent
64dc0eff
Pipeline
#518963
waiting for manual action
with stages
in
20 minutes and 38 seconds
Stage:
Stage:
Stage:
Stage:
Stage:
Showing
- prdoc/pr_7781.prdoc 10 additions, 0 deletionsprdoc/pr_7781.prdoc
- substrate/client/network/src/protocol.rs 22 additions, 1 deletionsubstrate/client/network/src/protocol.rs
- substrate/client/network/src/protocol/notifications/behaviour.rs 18 additions, 2 deletions...te/client/network/src/protocol/notifications/behaviour.rs
- substrate/client/network/src/protocol/notifications/handler.rs 42 additions, 10 deletions...rate/client/network/src/protocol/notifications/handler.rs
- substrate/client/network/src/protocol/notifications/upgrade.rs 2 additions, 0 deletions...rate/client/network/src/protocol/notifications/upgrade.rs
- substrate/client/network/src/protocol/notifications/upgrade/notifications.rs 15 additions, 6 deletions...twork/src/protocol/notifications/upgrade/notifications.rs
Please register or sign in to comment