-
-
Notifications
You must be signed in to change notification settings - Fork 203
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
get mutable value: onreply rely on salt, but its not defined in bep #167
Comments
chr15m
added a commit
to chr15m/bittorrent-dht
that referenced
this issue
Nov 2, 2017
chr15m
added a commit
to chr15m/bittorrent-dht
that referenced
this issue
Nov 2, 2017
chr15m
added a commit
to chr15m/bittorrent-dht
that referenced
this issue
Nov 2, 2017
This was referenced Nov 2, 2017
chr15m
added a commit
to chr15m/bittorrent-dht
that referenced
this issue
Feb 17, 2018
chr15m
added a commit
to chr15m/bittorrent-dht
that referenced
this issue
Feb 17, 2018
Code to replicate and demonstrate this bug in action: https://github.com/chr15m/bittorrent-dht-salt-bug |
chr15m
added a commit
to chr15m/bittorrent-dht
that referenced
this issue
Feb 19, 2018
chr15m
added a commit
to chr15m/bittorrent-dht
that referenced
this issue
Feb 19, 2018
chr15m
added a commit
to chr15m/bittorrent-dht
that referenced
this issue
Feb 19, 2018
thanks @chr15m |
chr15m
added a commit
to chr15m/bittorrent-dht
that referenced
this issue
May 17, 2018
chr15m
added a commit
to chr15m/bittorrent-dht
that referenced
this issue
May 17, 2018
chr15m
added a commit
to chr15m/bittorrent-dht
that referenced
this issue
May 17, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hi,
in DHT.get method https://github.com/webtorrent/bittorrent-dht/blob/master/client.js#L223 when handling the reply, it calls for encodesigdata https://github.com/webtorrent/bittorrent-dht/blob/master/client.js#L261, defined at https://github.com/webtorrent/bittorrent-dht/blob/master/client.js#L649
ensodeSigData rely on the presence of the salt value in the reply packet to reproduce the bencoded value, but the bep44 does not define the salt field in the mutable get reply,
the salt value in this case must be provided by the person who initiates the get query, with the pbkey.
I had to change a little bit the module, such as,
In the onreply of get method,
if (!verify(r.sig, encodeSigDataSalt(r, opts.salt), r.k)) return true
finally added,
I also changed the hash test equality to
if (equals(hash(opts.salt ? Buffer.concat([r.k, Buffer.from(opts.salt, 'utf-8')]) : r.k), key)) {
because salt is string.BTW, can we improve the doc for mutable message usage with the module ?
thanks.
So yes there are more changes to apply because in case of mutable items, the target is derived from those two data: pbk + salt
the current implementation assume it receives the target directly.
The text was updated successfully, but these errors were encountered: