Repository navigation
Groot2Publisher: add a constructor that takes the bind address - #1251
Merged
Merged
Conversation
The publisher always bound its two ZeroMQ sockets to tcp://*, so they were reachable from every network interface. The Groot2 protocol has no authentication, and a client that can reach the port can not only read the tree and its blackboards but also insert hooks that replace node results. Add Groot2Publisher(tree, server_port, bind_address), e.g. "127.0.0.1" to accept local connections only. The existing constructor delegates to it with "*", so its behavior and exported symbol are unchanged. Document the security implications in the class comment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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
Groot2Publisheralways binds its sockets totcp://*:<port>andtcp://*:<port+1>, so they are reachable from every network interface. The Groot2 protocol has no authentication. A client that can reach the request port can read the tree XML and the blackboards (FULLTREE,BLACKBOARD). It can also insert hooks (HOOK_INSERT) that replace a node's result, so the node'stick()is skipped. Applications had no way to restrict this short of firewall rules.Change
Groot2Publisher(const Tree&, unsigned server_port, const std::string& bind_address). It accepts any ZeroMQ tcp interface spec:"127.0.0.1"for local connections only, an interface name such as"eth0", or"*".Groot2Publisher(tree, port = 1667)delegates to it with"*". No behavior change and no ABI change: the old symbol is still exported, and the new state lives in the existing PImpl.Switching the default to loopback would be safer. It would also break everyone who runs Groot2 on a different machine than the robot, so that's left for a separate discussion.
Tests
Groot2PublisherIntegration.BindToLoopbackAddress: a publisher bound to127.0.0.1answersFULLTREE.Groot2PublisherIntegration.InvalidBindAddressThrows: an invalid interface throwszmq::error_tinstead of falling back silently.🤖 Generated with Claude Code