Skip to content

Groot2Publisher: add a constructor that takes the bind address - #1251

Merged
facontidavide merged 1 commit into
masterfrom
feat/groot2-bind-address
Oct 24, 2026
Merged

facontidavide merged 1 commit into
masterfrom
feat/groot2-bind-address

Conversation

@facontidavide

Copy link
Copy Markdown
Collaborator

Motivation

Groot2Publisher always binds its sockets to tcp://*:<port> and tcp://*:<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's tick() is skipped. Applications had no way to restrict this short of firewall rules.

Change

  • New overload 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 "*".
  • The existing 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.
  • The class comment now spells out the security implications: anyone who can reach the port can override node results.

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 to 127.0.0.1 answers FULLTREE.
  • Groot2PublisherIntegration.InvalidBindAddressThrows: an invalid interface throws zmq::error_t instead of falling back silently.
  • Full suite: 549 passed. pre-commit is clean.

🤖 Generated with Claude Code

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>
@sonarqubecloud

Copy link
Copy Markdown

@facontidavide
facontidavide merged commit c9dd2bf into master Oct 24, 2026
17 of 18 checks passed
@facontidavide
facontidavide deleted the feat/groot2-bind-address branch October 24, 2026 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant