Skip to content

Fix ReDoS vulnerability in stack trace parsing (Issue #35490)#364

Closed
everettbu wants to merge 1 commit into
mainfrom
main-35538
Closed

Fix ReDoS vulnerability in stack trace parsing (Issue #35490)#364
everettbu wants to merge 1 commit into
mainfrom
main-35538

Conversation

@everettbu

Copy link
Copy Markdown

Mirror of facebook/react#35538
Original author: sujay-bhandari


Summary

How did you test this change?

@greptile-apps

greptile-apps Bot commented Jan 16, 2026

Copy link
Copy Markdown

Greptile Summary

Fixed a ReDoS (Regular Expression Denial of Service) vulnerability in CHROME_STACK_REGEXP by replacing the inefficient pattern /^\s*at .*(\S+:\d+|\(native\))/m with /^\s*at .*(?:\(|:\d+)/m.

The original regex had catastrophic backtracking due to competing greedy quantifiers (.* followed by \S+), which could cause exponential time complexity when processing malicious input. The new pattern simplifies the logic to detect Chrome/V8 stack traces by checking for either ( or :\d+, which are present in all V8 stack frame formats while avoiding the performance vulnerability. The change maintains full compatibility with the existing stack trace parsing logic.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk - it fixes a critical security vulnerability with a well-scoped regex change
  • The change is a focused security fix that eliminates catastrophic backtracking in the regex pattern. The new pattern correctly detects all Chrome/V8 stack formats while avoiding the ReDoS vulnerability. The change is minimal (one line) and maintains backward compatibility
  • No files require special attention

Important Files Changed

Filename Overview
packages/react-devtools-shared/src/backend/utils/parseStackTrace.js Fixed ReDoS vulnerability by simplifying regex pattern from `/^\sat .(\S+:\d+

@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated.

@github-actions github-actions Bot added the Resolution: Stale Automatically closed due to inactivity label Apr 16, 2026
@github-actions

Copy link
Copy Markdown

Closing this pull request after a prolonged period of inactivity. If this issue is still present in the latest release, please ask for this pull request to be reopened. Thank you!

@github-actions github-actions Bot closed this Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Resolution: Stale Automatically closed due to inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants