mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-10 15:10:54 +00:00
reject messages claiming to be from ourselves but not locally published
This commit is contained in:
committed by
Paul Robinson
parent
410e6d4549
commit
e768682ab9
@ -643,6 +643,19 @@ class Pubsub(Service, IPubsub):
|
|||||||
return
|
return
|
||||||
|
|
||||||
self._mark_msg_seen(msg)
|
self._mark_msg_seen(msg)
|
||||||
|
|
||||||
|
# reject messages claiming to be from ourselves but not locally published
|
||||||
|
self_id = self.host.get_id()
|
||||||
|
if (
|
||||||
|
base58.b58encode(msg.from_id).decode() == self_id
|
||||||
|
and msg_forwarder != self_id
|
||||||
|
):
|
||||||
|
logger.debug(
|
||||||
|
"dropping message claiming to be from self but forwarded from %s",
|
||||||
|
msg_forwarder,
|
||||||
|
)
|
||||||
|
return
|
||||||
|
|
||||||
self.notify_subscriptions(msg)
|
self.notify_subscriptions(msg)
|
||||||
await self.router.publish(msg_forwarder, msg)
|
await self.router.publish(msg_forwarder, msg)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user