-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Have a configuration option for Subscriptions receiving duplicate messages #216
Comments
Messages are not content-addressed, so to make this secure we'll need to call the validators every time we intend to deliver a duplicate (otherwise, an attacker could send a different message with the same ID, and have it delivered as a duplicate). Alternatively, we could require signatures to be enabled to use this feature -- that would guarantee message integrity. We still need to cache validation results, though. |
With signatures we can easily cache validation results (ie have a second time cache that tracks |
Maybe I'm just missing something, but how are signatures going to help here? Is it because of the message hash? If so, it's possible that protobuf's lack of canonical serialization will hurt us here. Is it because of the signature over the sequence number? If so, then there's some potential attack avenues here. |
The message signature is over the entire message & not just the SeqNo as written here. I think what @raulk means is that the key in the validated messages cache should also incorporate the validated message signature(unlike using the hash, this also solves the 'canonical serialization' problem) in addition to the source peer & sequence number so that a user can not send another message with the same sequence number but different content/signature & have us treat it as a duplicate thus by-passing validation. Wdyt ? |
@vyzo So, for the validated messages cache:
Wdyt ? |
The key should be just the message Id, no need for anything else. |
@vyzo Not sure what you mean. If the key is just the messageID and a peer sends us a message with the same seqNo as before but with different content & hence a different signature, how do we decide whether to validate that message or not ? |
We would still have to validate the signature, but in general we use messageID's for tracking things internally. A peer sending us a message with the same seqNo and different content is buggy, and will result to this message being ignored by the seen cache. |
@vyzo I understand what you mean. But, a malicious peer could send us a message with the same ID and different content to skip validation as mentioned by @raulk here. Having the signature as part of the "validated messages cache" key protects us from this attack when duplicate message delivery is turned on. But, maybe there is another way to do this. |
@aschmahmann came up with a good question during our discussion. Assuming a threat model where peers can send "false duplicates"(same seqNo, different data), what do we do when we receive a false duplicate ? Should we simply drop the message, blacklist the peer or send an event to the user about this etc etc ? |
Drop the message and |
Assuming #215 is implemented there may be reasons why subscribers will want to see all the peers that sent them messages, not just the first peer to send them a given message.
The simplest way to do this seems to be just having a
SubOpt
that allows us to send messages even if we've seen themgo-libp2p-pubsub/pubsub.go
Line 676 in 2247a54
Unfortunately, this the logic for ignoring duplicates exists in the pubsub logic instead of the subscription logic so this means some code will have to get moved around.
The text was updated successfully, but these errors were encountered: