reject messages claiming to be from ourselves but not locally published

This commit is contained in:
mystical-prog
2024-11-06 17:29:13 +05:30
committed by Paul Robinson
parent 410e6d4549
commit e768682ab9

View File

@ -643,6 +643,19 @@ class Pubsub(Service, IPubsub):
return
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)
await self.router.publish(msg_forwarder, msg)