Commit Graph

63 Commits

Author SHA1 Message Date
Raghav Gulati 3c78c237ce
Remove empty line in imports 2019-05-08 10:09:30 -07:00
Raghav Gulati 08c4a28ee3
Better comment for signing with a different key
Note that the second message is the incorrectly signed message.
2019-05-08 09:27:57 -07:00
Raghav Gulati a726a896db
Use names rather than index
We've aliased array elements, use the explicit names instead.
2019-05-08 09:27:26 -07:00
Raghav Gulati 594e6a4ab9
Add a note why we're expecting two messages
As the adversary has turned of signature verification, we should expect
to see two messages (the correctly signed and the incorrectly signed
one) when we publish. Those that have verification on, should only see
one.
2019-05-08 09:00:25 -07:00
Raghav Gulati 84bb35ebf4
Bump wait from 10 -> 50ms
This matches the waits in the rest of the package.
2019-05-08 09:00:00 -07:00
Raghav Gulati b136dae80c
Remove erroneous subscribe 2019-05-08 08:59:47 -07:00
Raghav Gulati 8272eb583e
Change test name to reflect no relaying
Improperly named test. In this test, we're only testing that we reject
malicious messages.
2019-05-08 08:59:12 -07:00
Raghav Gulati 516c32e854
Remove commented out code
bhost import was commented out.
2019-05-07 15:05:00 -07:00
Raghav Gulati 6b2635b6ac
adversaryPeer -> adversary 2019-05-07 10:17:55 -07:00
Raghav Gulati d740f53531
adversarial -> adversary 2019-05-07 10:14:37 -07:00
Raghav Gulati b44471d7ce
Ensure that the received message is the correct one 2019-05-07 10:10:05 -07:00
Raghav Gulati ed746477f9
Reduce time to wait
2 seconds per wait seemed a bit aggressive. Halved the total time of the test.
2019-05-07 10:09:40 -07:00
Raghav Gulati c33d8a8353
Add test for improperly signed message
Test the case where an adversarial peer signs a message with a key they
didn't originally register with. First, we test that an adversarial peer
will allow the message to pass through validation as they turn off
strict verification (putting themselves at risk), but an honest peer
with strict verification on will never see the message!
2019-05-07 09:56:09 -07:00
vyzo 8405014ffe extend validator interface to include message source 2019-01-17 14:44:34 +02:00
vyzo 2621f893e6 rework peer tracking logic to handle multiple connections 2018-12-13 19:53:12 +02:00
Steven Allen 017e522caa test nonsensical options 2018-10-25 16:57:00 -07:00
Steven Allen fba434025b rework message signing options
Previously, there was no non-breaking upgrade path to enable message signing by
default while still providing a way to disable it. This patch breaks the options
into:

1. WithMessageSigning - actually enable message signing.
2. WithStrictSignatureVerification - enforce strict signature verification.
3. WithMessageAuthor - set the message author (independent of signing).

Now, users can explicitly set all three options and any changes we make to the
defaults will never override these explicit settings.

This patch *also* enables *signing* by default but not strict signature
verification. We obviously can't enable verification by default yet but I see no
reason not to enable signing. Basically, we're either hurting performance or
security by default. Security issues are generally only noticed once it's too
late. Performance issues can be caught ahead of time.
2018-10-25 06:41:49 -07:00
Steven Allen bd1a4630b9 move to go-libp2p-pubsub
Updates for move from go-floodsub to go-libp2p-pubsub.

fixes https://github.com/libp2p/go-libp2p-pubsub/issues/4
2018-10-18 21:10:16 +01:00
vyzo 3788f504a5 strict mode for message signing 2018-10-14 02:22:20 +03:00
vyzo 4addc898c1 test floodsub with message signing 2018-10-14 02:22:20 +03:00
Kevin Atkinson 0827f5e955 gx publish 0.9.31 2018-10-04 19:23:53 -04:00
Kevin Atkinson 1abb0209ce gx publish 0.9.30 2018-10-04 18:41:48 -04:00
vyzo 0a82522cf6 basic gossipsub tests 2018-06-12 08:00:17 -07:00
Erin Swenson-Healey 75fcbf0c2c New -> NewFloodsubWithProtocols 2018-06-07 09:21:08 -07:00
Erin Swenson-Healey 6840b190db allow FloodSubRouter to be configured with protocols 2018-06-07 09:21:08 -07:00
Steven Allen d02440c25d fix tests for swarm refactor 2018-06-05 15:53:25 -07:00
vyzo ed1dd154b6 add test for UnregisterTopicValidator 2018-02-28 22:26:42 +02:00
Steven Allen c82e67dcd3
Merge pull request #55 from libp2p/feat/validators
Message Validators
2018-01-24 06:03:20 +00:00
vyzo bbdec3fda2 implement per topic validators 2018-01-18 19:12:36 +02:00
Raghav Gulati 99a4f9e5ed Increase timeout in TestSubscribeMultipleTimes
Increase delay to 10ms; makes go test -race happy.
2018-01-16 11:46:33 +02:00
vyzo cb365a5fee remove faulty tests 2018-01-14 02:01:42 +02:00
vyzo 856a25c8eb WithMaxConcurrency is WithValidatorConcurrency
and defaultMaxConcurrency is defaultValidateConcurrency.
2018-01-13 20:56:03 +02:00
vyzo 982c4de960 per subscription validation throttle and more efficient dispatch logic 2018-01-13 14:31:34 +02:00
keks 88274db0bb make maximum concurrency configurable, split loop 2018-01-13 12:15:27 +02:00
keks fe09d1eea3 make validator timeout configurable 2018-01-13 12:13:54 +02:00
keks 6e8b9f2d5c fix timeout 2018-01-13 12:13:54 +02:00
keks 02877cda71 complete validator functions
- make validators time out after 100ms
  - add context param to validator functions
  - add type Validator func(context.Context, *Message) bool
- drop message if more than 10 messages are already being validated
2018-01-13 12:13:54 +02:00
keks 89e6a06f3c better tests for validation 2018-01-13 12:12:21 +02:00
keks 197a5982a4 ungxify 2018-01-13 12:12:21 +02:00
keks 7dd4e0bfeb vet
used for range variable inside goroutine, now passed as argument
2018-01-13 12:12:21 +02:00
keks 647bb98655 optionally allow caller to validate messages 2018-01-13 12:12:21 +02:00
Steven Allen a01778ac78 test peer disconnect 2017-10-14 09:32:31 -07:00
Jeromy 01af0dc890 remove basichost dep, update go-multistream 2017-01-10 14:45:25 -08:00
Jan Winkelmann 32d57f202a update to go-libp2p-netutil 2016-11-21 16:35:43 +01:00
Jan Winkelmann 25b8aad61f add ctx to sub.Next for cancellation 2016-11-18 02:23:38 +01:00
Jan Winkelmann 539e4b6b45 longer sleep in test so race becomes less likely 2016-11-18 02:23:38 +01:00
Jan Winkelmann ae48a15d7b make Subscribe go through SubscribeByTopicDescriptor 2016-11-18 02:23:38 +01:00
Jan Winkelmann 1c9a576526 Test, SubscribeByTopicDescriptor and minor improvement 2016-11-18 02:23:38 +01:00
Jan Winkelmann c9b2c6c8fd make go vet happy (t.Fatal was provided a formatting string) 2016-11-18 02:23:38 +01:00
Jan Winkelmann b71e3adbd7 first cleanup wave 2016-11-18 02:23:38 +01:00