Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Ignore yarn audit warning for GHSA-9wv6-86v2-598j #27024

Merged
merged 1 commit into from
Sep 10, 2024
Merged

Conversation

danjm
Copy link
Contributor

@danjm danjm commented Sep 10, 2024

Description

This addresses the following yarn audit failure:

└─ path-to-regexp
   ├─ ID: 1099496
   ├─ Issue: path-to-regexp outputs backtracking regular expressions
   ├─ URL: https://github.com/advisories/GHSA-9wv6-86v2-598j
   ├─ Severity: high
   ├─ Vulnerable Versions: >=0.2.0 <8.0.0
   │ 
   ├─ Tree Versions
   │  └─ 1.7.0
   │ 
   └─ Dependents
      └─ react-router@npm:5.1.2 [12b72]

path-to-Regexp is used in two files within react-router v5.1.2: generatePath.js and matchPath.js. In both cases, path and options variables are passed to a compilePath function. Those are then passed to pathtoRegexp. The variables passed to pathtoRegexp are dependent on props or parameters passed to react-router components and/or methods explictly from the metamask code. So this vulnerability cannot be exploited by an external actor.

Open in GitHub Codespaces

Related issues

Fixes:

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@danjm danjm requested a review from a team as a code owner September 10, 2024 12:22
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

Copy link

sonarcloud bot commented Sep 10, 2024

Copy link

codecov bot commented Sep 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.15%. Comparing base (9f8651c) to head (3e010c4).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop   #27024   +/-   ##
========================================
  Coverage    70.15%   70.15%           
========================================
  Files         1425     1425           
  Lines        49651    49651           
  Branches     13891    13891           
========================================
  Hits         34831    34831           
  Misses       14820    14820           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@metamaskbot
Copy link
Collaborator

Builds ready [3e010c4]
Page Load Metrics (1679 ± 86 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint14812218168118790
domContentLoaded14722146166017684
load14812161167918086
domInteractive135729126
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@danjm danjm changed the title Ignore yarn audit warning for GHSA-9wv6-86v2-598j fix: Ignore yarn audit warning for GHSA-9wv6-86v2-598j Sep 10, 2024
Copy link

@desi desi left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this!

@danjm
Copy link
Contributor Author

danjm commented Sep 10, 2024

Note: it seems the worst case that would be actually possible is that we accidentally set the path property on either a Route component or on the second param to matchPath to a path that would generate an exploitable regexp:

The bad regular expression is generated any time you have two parameters within a single segment, separated by something that is not a period (.). For example, /:a-:b will produce the regular expression /^\/([^\/]+?)-([^\/]+?)\/?$/

So we would have to accidentally set a path to something like /:a-:b or /flights/:from-:to
We don't have any uses of parameters within our paths, so this is very unlikely, and in general (as the security disclosue blog post says): "Thankfully the pattern of using more than one parameter within slashes is extremely rare or non-existent.". So it would be very unlikely for this to happen by accident, but still not totally impossible, so we should probably upgrade to react-router v6 sooner rather than later

@danjm danjm merged commit 9405bc1 into develop Sep 10, 2024
84 of 85 checks passed
@danjm danjm deleted the yarn-audit-fix branch September 10, 2024 14:30
@github-actions github-actions bot locked and limited conversation to collaborators Sep 10, 2024
@metamaskbot metamaskbot added the release-12.6.0 Issue or pull request that will be included in release 12.6.0 label Sep 10, 2024
@gauthierpetetin gauthierpetetin added release-12.5.0 Issue or pull request that will be included in release 12.5.0 and removed release-12.6.0 Issue or pull request that will be included in release 12.6.0 labels Sep 11, 2024
@metamaskbot metamaskbot added release-12.3.0 Issue or pull request that will be included in release 12.3.0 and removed release-12.5.0 Issue or pull request that will be included in release 12.5.0 labels Sep 11, 2024
@metamaskbot
Copy link
Collaborator

Missing release label release-12.3.0 on PR. Adding release label release-12.3.0 on PR and removing other release labels(release-12.5.0), as PR was cherry-picked in branch 12.3.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.3.0 Issue or pull request that will be included in release 12.3.0 team-extension-platform
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants