From 38efea3fdc1c422c8f81e5526bc6744fded0a147 Mon Sep 17 00:00:00 2001 From: Hans-Joachim Krauch Date: Thu, 6 Jul 2023 21:22:36 +0000 Subject: [PATCH] asset_uri_whitelist -> asset_uri_allowlist --- README.md | 2 +- ros1_foxglove_bridge/launch/foxglove_bridge.launch | 4 ++-- ros1_foxglove_bridge/src/ros1_foxglove_bridge_nodelet.cpp | 2 +- ros1_foxglove_bridge/tests/smoke.test | 2 +- ros2_foxglove_bridge/include/foxglove_bridge/param_utils.hpp | 2 +- ros2_foxglove_bridge/launch/foxglove_bridge_launch.xml | 4 ++-- ros2_foxglove_bridge/src/param_utils.cpp | 4 ++-- ros2_foxglove_bridge/src/ros2_foxglove_bridge.cpp | 2 +- ros2_foxglove_bridge/tests/smoke_test.cpp | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 33e02a3..4ca0ac0 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ Parameters are provided to configure the behavior of the bridge. These parameter * __send_buffer_limit__: Connection send buffer limit in bytes. Messages will be dropped when a connection's send buffer reaches this limit to avoid a queue of outdated messages building up. Defaults to `10000000` (10 MB). * __use_compression__: Use websocket compression (permessage-deflate). Suited for connections with smaller bandwith, at the cost of additional CPU load. * __capabilities__: List of supported [server capabilities](https://github.com/foxglove/ws-protocol/blob/main/docs/spec.md). Defaults to `[clientPublish,parameters,parametersSubscribe,services,connectionGraph,assets]`. - * __asset_uri_whitelist__: List of regular expressions ([ECMAScript grammar](https://en.cppreference.com/w/cpp/regex/ecmascript)) of allowed asset URIs. Uses the [resource_retriever](https://index.ros.org/p/resource_retriever/github-ros-resource_retriever) to resolve `package://`, `file://` or `http(s)://` URIs. Note that this list should be carefully configured such that no secret files can be fetched. Defaults to `["package://(\w+/?)+\.(dae|stl|urdf|xacro)"]`. + * __asset_uri_allowlist__: List of regular expressions ([ECMAScript grammar](https://en.cppreference.com/w/cpp/regex/ecmascript)) of allowed asset URIs. Uses the [resource_retriever](https://index.ros.org/p/resource_retriever/github-ros-resource_retriever) to resolve `package://`, `file://` or `http(s)://` URIs. Note that this list should be carefully configured such that no secret files can be fetched. Defaults to `["package://(\w+/?)+\.(dae|stl|urdf|xacro)"]`. * (ROS 1) __max_update_ms__: The maximum number of milliseconds to wait in between polling `roscore` for new topics, services, or parameters. Defaults to `5000`. * (ROS 2) __num_threads__: The number of threads to use for the ROS node executor. This controls the number of subscriptions that can be processed in parallel. 0 means one thread per CPU core. Defaults to `0`. * (ROS 2) __min_qos_depth__: Minimum depth used for the QoS profile of subscriptions. Defaults to `1`. This is to set a lower limit for a subscriber's QoS depth which is computed by summing up depths of all publishers. See also [#208](https://github.com/foxglove/ros-foxglove-bridge/issues/208). diff --git a/ros1_foxglove_bridge/launch/foxglove_bridge.launch b/ros1_foxglove_bridge/launch/foxglove_bridge.launch index 708b2de..1637109 100644 --- a/ros1_foxglove_bridge/launch/foxglove_bridge.launch +++ b/ros1_foxglove_bridge/launch/foxglove_bridge.launch @@ -13,7 +13,7 @@ - + @@ -35,6 +35,6 @@ $(arg service_whitelist) $(arg client_topic_whitelist) $(arg capabilities) - $(arg asset_uri_whitelist) + $(arg asset_uri_allowlist) diff --git a/ros1_foxglove_bridge/src/ros1_foxglove_bridge_nodelet.cpp b/ros1_foxglove_bridge/src/ros1_foxglove_bridge_nodelet.cpp index 0c360ea..e812040 100644 --- a/ros1_foxglove_bridge/src/ros1_foxglove_bridge_nodelet.cpp +++ b/ros1_foxglove_bridge/src/ros1_foxglove_bridge_nodelet.cpp @@ -102,7 +102,7 @@ class FoxgloveBridge : public nodelet::Nodelet { } const auto assetUriWhitelist = nhp.param>( - "asset_uri_whitelist", {"package://(/?\\w+)+\\.(dae|stl|urdf|xacro)"}); + "asset_uri_allowlist", {"package://(/?\\w+)+\\.(dae|stl|urdf|xacro)"}); _assetUriWhitelistPatterns = parseRegexPatterns(assetUriWhitelist); if (assetUriWhitelist.size() != _assetUriWhitelistPatterns.size()) { ROS_ERROR("Failed to parse one or more asset URI whitelist patterns"); diff --git a/ros1_foxglove_bridge/tests/smoke.test b/ros1_foxglove_bridge/tests/smoke.test index b530b12..a7f0230 100644 --- a/ros1_foxglove_bridge/tests/smoke.test +++ b/ros1_foxglove_bridge/tests/smoke.test @@ -1,7 +1,7 @@ - ['file://.*'] + ['file://.*'] diff --git a/ros2_foxglove_bridge/include/foxglove_bridge/param_utils.hpp b/ros2_foxglove_bridge/include/foxglove_bridge/param_utils.hpp index d34a775..f2389de 100644 --- a/ros2_foxglove_bridge/include/foxglove_bridge/param_utils.hpp +++ b/ros2_foxglove_bridge/include/foxglove_bridge/param_utils.hpp @@ -23,7 +23,7 @@ constexpr char PARAM_USE_COMPRESSION[] = "use_compression"; constexpr char PARAM_CAPABILITIES[] = "capabilities"; constexpr char PARAM_CLIENT_TOPIC_WHITELIST[] = "client_topic_whitelist"; constexpr char PARAM_INCLUDE_HIDDEN[] = "include_hidden"; -constexpr char PARAM_ASSET_URI_WHITELIST[] = "asset_uri_whitelist"; +constexpr char PARAM_ASSET_URI_ALLOWLIST[] = "asset_uri_allowlist"; constexpr int64_t DEFAULT_PORT = 8765; constexpr char DEFAULT_ADDRESS[] = "0.0.0.0"; diff --git a/ros2_foxglove_bridge/launch/foxglove_bridge_launch.xml b/ros2_foxglove_bridge/launch/foxglove_bridge_launch.xml index 5f4a8ac..a1d3dfb 100644 --- a/ros2_foxglove_bridge/launch/foxglove_bridge_launch.xml +++ b/ros2_foxglove_bridge/launch/foxglove_bridge_launch.xml @@ -15,7 +15,7 @@ - + @@ -34,6 +34,6 @@ - + diff --git a/ros2_foxglove_bridge/src/param_utils.cpp b/ros2_foxglove_bridge/src/param_utils.cpp index eecc51f..bb40a2d 100644 --- a/ros2_foxglove_bridge/src/param_utils.cpp +++ b/ros2_foxglove_bridge/src/param_utils.cpp @@ -148,12 +148,12 @@ void declareParameters(rclcpp::Node* node) { node->declare_parameter(PARAM_INCLUDE_HIDDEN, false, includeHiddenDescription); auto assetUriWhiteListDescription = rcl_interfaces::msg::ParameterDescriptor{}; - assetUriWhiteListDescription.name = PARAM_ASSET_URI_WHITELIST; + assetUriWhiteListDescription.name = PARAM_ASSET_URI_ALLOWLIST; assetUriWhiteListDescription.type = rcl_interfaces::msg::ParameterType::PARAMETER_STRING_ARRAY; assetUriWhiteListDescription.description = "List of regular expressions (ECMAScript) of whitelisted asset URIs."; assetUriWhiteListDescription.read_only = true; - node->declare_parameter(PARAM_ASSET_URI_WHITELIST, + node->declare_parameter(PARAM_ASSET_URI_ALLOWLIST, std::vector({"package://(/?\\w+)+\\.(dae|stl|urdf|xacro)"}), paramWhiteListDescription); } diff --git a/ros2_foxglove_bridge/src/ros2_foxglove_bridge.cpp b/ros2_foxglove_bridge/src/ros2_foxglove_bridge.cpp index e11d724..404d5d4 100644 --- a/ros2_foxglove_bridge/src/ros2_foxglove_bridge.cpp +++ b/ros2_foxglove_bridge/src/ros2_foxglove_bridge.cpp @@ -47,7 +47,7 @@ FoxgloveBridge::FoxgloveBridge(const rclcpp::NodeOptions& options) this->get_parameter(PARAM_CLIENT_TOPIC_WHITELIST).as_string_array(); const auto clientTopicWhiteListPatterns = parseRegexStrings(this, clientTopicWhiteList); _includeHidden = this->get_parameter(PARAM_INCLUDE_HIDDEN).as_bool(); - const auto assetUriWhitelist = this->get_parameter(PARAM_ASSET_URI_WHITELIST).as_string_array(); + const auto assetUriWhitelist = this->get_parameter(PARAM_ASSET_URI_ALLOWLIST).as_string_array(); _assetUriWhitelistPatterns = parseRegexStrings(this, assetUriWhitelist); const auto logHandler = std::bind(&FoxgloveBridge::logHandler, this, _1, _2); diff --git a/ros2_foxglove_bridge/tests/smoke_test.cpp b/ros2_foxglove_bridge/tests/smoke_test.cpp index fab35a9..3d40c43 100644 --- a/ros2_foxglove_bridge/tests/smoke_test.cpp +++ b/ros2_foxglove_bridge/tests/smoke_test.cpp @@ -606,7 +606,7 @@ int main(int argc, char** argv) { auto componentFactory = componentManager.create_component_factory(componentResources.front()); rclcpp::NodeOptions nodeOptions; // Explicitly allow file:// asset URIs for testing purposes. - nodeOptions.append_parameter_override("asset_uri_whitelist", + nodeOptions.append_parameter_override("asset_uri_allowlist", std::vector({"file://.*"})); auto node = componentFactory->create_node_instance(nodeOptions); executor->add_node(node.get_node_base_interface());