ROS 2 tool permission lists compare names as exact strings and miss the leading-slash alias
Our code review of RobotecAI/rai at 93b231013f5cf7b268539481351832fa4d074ef0 (current main; src/rai_core/pyproject.toml declares 2.15.0) found the following issue. We found no private security reporting channel (GitHub private vulnerability reporting is disabled, and there is no security email). SECURITY.md asks to "Treat and report vulnerability as any other bug," so we are filing it here.
The ROS 2 tools' readable, writable and forbidden lists are compared by exact string, while the name passed to the tool is forwarded to rclpy unchanged. rclpy accepts a name with or without a leading slash, so a forbidden entry of /cmd_vel does not deny cmd_vel, and the reverse. This is reachable when forbidden is set and the allowlist for that direction is None (the default). With an allowlist set, the other spelling is still denied.
The comparisons are in src/rai_core/rai/tools/ros2/base.py:51-63 (is_readable / is_writable: topic in self.forbidden, then topic in self.readable or self.writable) and :80 (the topic, service and action listing). Those checks are called from tools/ros2/generic/topics.py:93, :117, :140, generic/services.py:111 and generic/actions.py:175; the same string then goes through communication/ros2/connectors/base.py:269-275 and :381-387 to rclpy (api/topic.py:194-197 create_publisher, :102-104 create_subscription, api/service.py:104 and :108 create_client, api/action.py:228 ActionClient). RAI already folds both spellings into one name elsewhere (api/base.py:129-136, api/topic.py:180-188, and ensure_slash in waiters.py:25-26) but not in these permission lists. The project's own docs use both spellings (docs/API_documentation/langchain_integration/ROS_2_tools.md:46 has ["/cmd_vel"]; docs/tutorials/tools.md:230 has ["cmd_vel"]).
The same base.py is byte-identical on the latest GitHub release, 2.12.4. There are no commits after this SHA on main.
This is source review only, nothing was run or compiled.
A possible fix is to compare both sides in one spelling, for example with the existing ensure_slash helper, in is_readable, is_writable and _check_permission_and_include. A more complete suggestion is available on request. It has not been compiled or run.
Credit: Ugur Celik (ucsurf), @ucsurf — Ugur Celik (ucsurf) · https://uc.surf We find and report security issues in open source before attackers do. If our work helped you, a small contribution keeps it going and makes the internet a little safer for everyone: https://buymeacoffee.com/ucsurf