-
Notifications
You must be signed in to change notification settings - Fork 112
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
Refactor MetaAddr fields to enable security fixes #1849
Comments
This is a fairly large ticket for a security fix. So we should try to work out ways to split it up, delay parts of it, or remove parts of it. If we split it into smaller fixes, it will be easier to review, and less likely to have unintended consequences. A small design doc might also be helpful here. We could add it to the CandidateSet or AddressBook module docs. |
After the split, this is now a small task. |
After the fix in #1871, we can safely used So I've deleted |
Motivation
Zebra updates the same time field for different peer events, making it hard to:
Solution
Desired Changes
Zebra should:
Alternate
andFailed
addresses separately (Security: stop gossiping temporary inbound remote addresses to peers #2120)Zebra should track the following times for each peer:
untrusted_last_seen
remote time gossiped by the peer that told us about this addresslast_success
local time when we last saw a message from this peerlast_attempt
local time when we last attempted to connect to this peerlast_failed
local time when we last failed to connect to this peerWe might want to also refactor the
services
field intountrusted_indirect_services
anduntrusted_direct_services
as part of this change. (Neither field is trusted, but one of them came directly from the peer, and the other came via other peers.)This might be easier to implement using an enum with
Direct
(confirmed addr, claimed services) andIndirect
(definitely unconfirmed) variants.Incidental Changes
It might be difficult to maintain exactly the same next peer address selection behaviour after this change. If we can't keep the same behaviour, we should make the fix in #1876 as part of this change.
Correctness
Correctness:
NeverAttempted...
states. (Updates can only beAttemptPending
,Responded
, orFailed
.)NeverAttempted...
states.NeverAttempted...
peers.Alternatives
It would be nice to keep fewer times for each peer, but these times all seem to be required by upcoming network security fixes. We can provide accessor methods on
MetaAddr
to simplify the interface to these times.We could also keep an
address_entry_creation_time
, but after the fix in #1871, we can safely useuntrusted_last_seen_time
instead, becauseuntrusted_last_seen_time
is earlier than or equal toaddress_entry_creation_time
. Usinguntrusted_last_seen_time
is better when the peer is honest, because it contains useful information about the last time that peer was available.Follow Up
We might want to remove the
Ord
impl, and just use a custom sort function for each different purpose (next address, removing addresses, etc.).Context
zcashd
does not have this issue.The text was updated successfully, but these errors were encountered: