Skip to content

Commit

Permalink
asset_uri_whitelist -> asset_uri_allowlist
Browse files Browse the repository at this point in the history
  • Loading branch information
achim-k committed Jul 6, 2023
1 parent 903579e commit 38efea3
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
4 changes: 2 additions & 2 deletions ros1_foxglove_bridge/launch/foxglove_bridge.launch
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<arg name="nodelet_manager" default="foxglove_nodelet_manager" />
<arg name="num_threads" default="0" />
<arg name="capabilities" default="[clientPublish,parameters,parametersSubscribe,services,connectionGraph,assets]" />
<arg name="asset_uri_whitelist" default="['package://(/?\w+)+\.(dae|stl|urdf|xacro)']" />
<arg name="asset_uri_allowlist" default="['package://(/?\w+)+\.(dae|stl|urdf|xacro)']" />

<node pkg="nodelet" type="nodelet" name="foxglove_nodelet_manager" args="manager"
if="$(eval nodelet_manager == 'foxglove_nodelet_manager')">
Expand All @@ -35,6 +35,6 @@
<rosparam param="service_whitelist" subst_value="True">$(arg service_whitelist)</rosparam>
<rosparam param="client_topic_whitelist" subst_value="True">$(arg client_topic_whitelist)</rosparam>
<rosparam param="capabilities" subst_value="True">$(arg capabilities)</rosparam>
<rosparam param="asset_uri_whitelist" subst_value="True">$(arg asset_uri_whitelist)</rosparam>
<rosparam param="asset_uri_allowlist" subst_value="True">$(arg asset_uri_allowlist)</rosparam>
</node>
</launch>
2 changes: 1 addition & 1 deletion ros1_foxglove_bridge/src/ros1_foxglove_bridge_nodelet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class FoxgloveBridge : public nodelet::Nodelet {
}

const auto assetUriWhitelist = nhp.param<std::vector<std::string>>(
"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");
Expand Down
2 changes: 1 addition & 1 deletion ros1_foxglove_bridge/tests/smoke.test
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<launch>
<node name="foxglove_bridge" pkg="foxglove_bridge" type="foxglove_bridge" output="screen">
<param name="port" value="9876" />
<rosparam param="asset_uri_whitelist" subst_value="True">['file://.*']</rosparam>
<rosparam param="asset_uri_allowlist" subst_value="True">['file://.*']</rosparam>
</node>

<test test-name="smoke_test" pkg="foxglove_bridge" type="smoke_test" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
4 changes: 2 additions & 2 deletions ros2_foxglove_bridge/launch/foxglove_bridge_launch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<arg name="use_sim_time" default="false" />
<arg name="capabilities" default="[clientPublish,parameters,parametersSubscribe,services,connectionGraph,assets]" />
<arg name="include_hidden" default="false" />
<arg name="asset_uri_whitelist" default="['package://(\\w+/?)+\\.(dae|stl|urdf|xacro)']" /> <!-- Needs double-escape -->
<arg name="asset_uri_allowlist" default="['package://(\\w+/?)+\\.(dae|stl|urdf|xacro)']" /> <!-- Needs double-escape -->

<node pkg="foxglove_bridge" exec="foxglove_bridge">
<param name="port" value="$(var port)" />
Expand All @@ -34,6 +34,6 @@
<param name="use_sim_time" value="$(var use_sim_time)" />
<param name="capabilities" value="$(var capabilities)" />
<param name="include_hidden" value="$(var include_hidden)" />
<param name="asset_uri_whitelist" value="$(var asset_uri_whitelist)" />
<param name="asset_uri_allowlist" value="$(var asset_uri_allowlist)" />
</node>
</launch>
4 changes: 2 additions & 2 deletions ros2_foxglove_bridge/src/param_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string>({"package://(/?\\w+)+\\.(dae|stl|urdf|xacro)"}),
paramWhiteListDescription);
}
Expand Down
2 changes: 1 addition & 1 deletion ros2_foxglove_bridge/src/ros2_foxglove_bridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion ros2_foxglove_bridge/tests/smoke_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string>({"file://.*"}));
auto node = componentFactory->create_node_instance(nodeOptions);
executor->add_node(node.get_node_base_interface());
Expand Down

0 comments on commit 38efea3

Please sign in to comment.