Skip to content

Patch CVE-2024-42002 - #1001

Open
mjcarroll wants to merge 1 commit into
rollingfrom
mjcarroll/reapply_cve_patch
Open

mjcarroll wants to merge 1 commit into
rollingfrom
mjcarroll/reapply_cve_patch

Conversation

@mjcarroll

Copy link
Copy Markdown
Member

Replaces #999

@mjcarroll mjcarroll self-assigned this Apr 3, 2025
@mjcarroll
mjcarroll requested a review from ahcorde April 3, 2025 13:59
@ahcorde

ahcorde commented Apr 3, 2025

Copy link
Copy Markdown
Contributor

Pulls: #1001
Gist: https://gist.githubusercontent.com/ahcorde/418d81fdef70ee2209e3fd6c7d23ab9e/raw/5366d57a0db798da244c1205658c21f84aa69ae2/ros2.repos
BUILD args: --packages-above-and-dependencies ros2topic
TEST args: --packages-above ros2topic
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/15571

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@ahcorde ahcorde mentioned this pull request Apr 3, 2025
@mjcarroll
mjcarroll force-pushed the mjcarroll/reapply_cve_patch branch from 9a17d3e to 0240e86 Compare April 4, 2025 19:13
@mjcarroll

Copy link
Copy Markdown
Member Author
  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@florcabral

Copy link
Copy Markdown
Contributor

Hi @mjcarroll. I noticed there was a CI issue when merging this CVE patch. Any help needed?

@mjcarroll

Copy link
Copy Markdown
Member Author

Hey @florcabral if you wouldn't mind taking a look at the CI issues here, I didn't catch them in my local testing before merging.

@florcabral

florcabral commented May 17, 2025 •

Copy link
Copy Markdown
Contributor

@mjcarroll Trying to drill down into the actual tests that failed after this patch - am I looking at the right build log here? If so, for ros2topic I see some failures related to tests for the echo verb, but the patch only affected the hz verb, plus some linter issues. I am not seeing any failing tests related to the patch itself. Have you looked into this yourself? Maybe I'm missing something.

@mjcarroll

This comment was marked as outdated.

@mjcarroll

Copy link
Copy Markdown
Member Author

@mjcarroll

Copy link
Copy Markdown
Member Author

@ahcorde

ahcorde commented Oct 6, 2025

Copy link
Copy Markdown
Contributor

Pulls: #1001
Gist: https://gist.githubusercontent.com/ahcorde/0a289b20c1051c4fbc33dad3293c0bc3/raw/fef082edf7944539f8bb3200e713c318928b13dd/ros2.repos
BUILD args: --packages-above-and-dependencies ros2topic
TEST args: --packages-above ros2topic
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/17223

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@ahcorde

ahcorde commented Oct 7, 2025

Copy link
Copy Markdown
Contributor
  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@ahcorde

ahcorde commented Oct 7, 2025

Copy link
Copy Markdown
Contributor

@ros-pull-request-builder retest this please

@christophebedard

Copy link
Copy Markdown
Member

IIRC, there was something wrong with this implementation.

@christophebedard

Copy link
Copy Markdown
Member

Also, it severely limits Python expression-based filtering: #1003 (comment)

Comment thread ros2topic/ros2topic/eval/__init__.py Outdated
Comment on lines +78 to +79
print(self.model.attributes)
print(node)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
print(self.model.attributes)
print(node)

@florcabral

Copy link
Copy Markdown
Contributor

Hello,
Coming back to this discussion: I tried to reproduce locally the tests reported to fail due to these changes, specifically these 2:

test_cli/test_cli/ test_cli.TestROS2TopicCLI.test_filtered_topic_hz[rmw_fastrtps_cpp] failed 

test_cli.TestROS2TopicCLI.test_filtered_topic_hz[rmw_zenoh_cpp] failed

I found that ros2topic/eval/__init__.py was printing internal evaluator state every time a filter expression was evaluated due to print statements left in ros2topic/ros2topic/eval/__init__.py. These looked like:

['capitalize', 'casefold', ..., 'data']
<ast.Attribute object at 0x7f...>

These warnings go to stdout, so the launch_testing output checks fail because the expected pattern (ie average rate: ... lines) in tests such as test_filtered_topic_hz expect exact output, so the extra lines caused failures like:

AssertionError: Output does not match:
['capitalize', ..., 'data']
<ast.Attribute ...>
average rate: 0.500

Removing those debug prints should restore the expected behavior. The failures seemed to come from the unexpected stdout pollution, not from the filter logic itself.

As for the evaluation of data msg type, reported on the jazzy PR, I also couldn't reproduce that test failure for this branch, and manual local tests seem to show the filtering logic isn't blocking stuff like m.data.<...>:

# ros2 topic hz /test --filter "int(m.data.partition(':')[-1]) % 2 == 0"
average rate: 1.000
...

If you accept my recent suggestion on ros2topic/ros2topic/eval/__init__.py we should at least get cleaner, easier to validate tests.

Could we run your CI to see exactly what is blocking this PR at this stage?

Thanks!

@florcabral

Copy link
Copy Markdown
Contributor

@christophebedard Any feedback to my last update? Thanks.

@fujitatomoya fujitatomoya left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mjcarroll can you rebase and resolve the comments?

@ahcorde ahcorde left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

conflicts

nevlife added a commit to nevlife/ros2cli that referenced this pull request Nov 8, 2026
…ead of eval() (CVE-2024-42002)

Uses the evaluator of ros2#1001 for both echo and hz.
Replace eval() of the hz --filter expression with a restricted AST
evaluator. Re-apply of #999 (reverted in #1000), rebased onto rolling,
with the leftover debug prints removed from the evaluator.

Signed-off-by: Michael Carroll <[email protected]>
@mjcarroll
mjcarroll force-pushed the mjcarroll/reapply_cve_patch branch from 0240e86 to 7291dba Compare November 17, 2026 00:15
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.

5 participants