hbbs: enforce outbound initiator whitelist by peer ID#1
Open
hbbs: enforce outbound initiator whitelist by peer ID#1
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
whitelist.txt) that is easy to edit on the server and only affects hbbs logic.Description
whitelist.txtat hbbs startup (one ID per line, ignore empty lines and lines beginning with#) and store it inRendezvousServer::outbound_whitelistviaload_outbound_whitelist.PunchHoleRequestinhandle_punch_hole_request, resolve the source peer ID from the requestSocketAddrusing a new helperPeerMap::get_id_by_socket_addrand reject the request if the source ID is missing or not in the whitelist.PeerMap::get_id_by_socket_addrto map aSocketAddrto the peer ID by scanning the in-memoryPeerMap.whitelist.txtand updatedsrc/rendezvous_server.rsandsrc/peer.rsto implement the feature.Testing
rustfmton the modified files withrustfmt --edition 2021 src/rendezvous_server.rs src/peer.rswhich completed successfully.cargo fmt --allwhich failed in this environment because the workspace memberlibs/hbb_commonis missing, so full workspace formatting could not be performed.cargo check -p hbbswhich failed for the same reason (libs/hbb_common/Cargo.tomlmissing), so a full build/check could not be completed here.Codex Task