fix(deps): update dependency path-to-regexp to v8 [security] - abandoned#317
fix(deps): update dependency path-to-regexp to v8 [security] - abandoned#317renovate[bot] wants to merge 2 commits intomainfrom
Conversation
Edited/Blocked NotificationRenovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR. You can manually request rebase by checking the rebase/retry box above. |
| "@podium/utils": "5.2.0", | ||
| "abslog": "2.4.4", | ||
| "path-to-regexp": "6.2.2" | ||
| "path-to-regexp": "8.1.0" |
There was a problem hiding this comment.
I see that since this PR was opened, the maintainer has backported the fix to 6.x as well:
https://github.com/pillarjs/path-to-regexp/releases/tag/v6.3.0
If we feel this is too risky for a patch release we could adopt that one instead.
Autoclosing SkippedThis PR has been flagged for autoclosing. However, it is being skipped due to the branch being already modified. Please close/delete it manually or report a bug if you think this is in error. |
|
The vulnerability was fixed in #319, this is no longer as pressing |
41c3cb2 to
f11099a
Compare
|
Replaced by #314 |
This PR contains the following updates:
6.2.2->8.0.0Old CVE description (fixed in #319)
GitHub Vulnerability Alerts
CVE-2024-45296
Impact
A 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.Patches
For users of 0.1, upgrade to
0.1.10. All other users should upgrade to8.0.0.These versions add backtrack protection when a custom regex pattern is not provided:
They do not protect against vulnerable user supplied capture groups. Protecting against explicit user patterns is out of scope for this library and not considered a vulnerability.
Version 7.1.0 can enable
strict: trueand get an error when the regular expression might be bad.Version 8.0.0 removes the features that can cause a ReDoS.
Workarounds
All versions can be patched by providing a custom regular expression for parameters after the first in a single segment. As long as the custom regular expression does not match the text before the parameter, you will be safe. For example, change
/:a-:bto/:a-:b([^-/]+).If paths cannot be rewritten and versions cannot be upgraded, another alternative is to limit the URL length. For example, halving the attack string improves performance by 4x faster.
Details
Using
/:a-:bwill produce the regular expression/^\/([^\/]+?)-([^\/]+?)\/?$/. This can be exploited by a path such as/a${'-a'.repeat(8_000)}/a. OWASP has a good example of why this occurs, but the TL;DR is the/aat the end ensures this route would never match but due to naive backtracking it will still attempt every combination of the:a-:bon the repeated 8,000-a.Because JavaScript is single threaded and regex matching runs on the main thread, poor performance will block the event loop and can lead to a DoS. In local benchmarks, exploiting the unsafe regex will result in performance that is over 1000x worse than the safe regex. In a more realistic environment using Express v4 and 10 concurrent connections, this translated to average latency of ~600ms vs 1ms.
References
Release Notes
pillarjs/path-to-regexp (path-to-regexp)
v8.0.0: Simpler APICompare Source
Heads up! This is a fairly large change (again) and I need to apologize in advance. If I foresaw what this version would have ended up being I would not have released version 7. A longer blog post and explanation will be incoming this week, but the pivot has been due to work on Express.js v5 and this will the finalized syntax used in Express moving forward.
Added
*namesyntax, aligns with:behavior but using an asterisk insteadChanged
?,+, and*- only optional exists moving forward (use wildcards for+,{*foo}for*)Added
:"foo-bar"Removed
loosemodev7.2.0: Support array inputs (again)Compare Source
Added
matchandpathToRegexp3fdd88fv7.1.0: Strict modeCompare Source
Added
strictoption to detect potential ReDOS issuesFixed
suffix + prefixwhen not specifiedTokenDataTokenDatamanually, previouslyparsefilled it in automaticallyComments
strict: trueand I'm probably releasing a V8 with it enabled by default ASAP as a necessary security mitigationv7.0.0: Wildcard, unicode, and modifier changesCompare Source
Hi all! There's a few major breaking changes in this release so read carefully.
Breaking changes:
compileonly accepts strings as values (i.e. no numbers, useString(value)before compiling a path)encode !== false, it must be an array of strings\p{XID_Continue}).?,*,+) must be used after a param explicitly wrapped in{}/or.*) has been added back and matches Express.js expected behaviorendsWithoptionstrict: truetotrailing: false;,,,!, and@for future use-casestokensToRegexp,tokensToFunctionandregexpToFunctionin favor of simplifying exports/can be repeated multiple times in a matched path (i.e./fooworks like//foo, etc)encodeanddecodeno longer receive the token as the second parameterencodeURIComponentand decode defaults todecodeURIComponentAdded:
encodePathto fix an issue aroundencodebeing used for both path and parameters (the path and parameter should be encoded slightly differently)looseas an option to support arbitrarily matching the delimiter in paths, e.g.foo/barandfoo///barshould work the sameencodeanddecodeto be set tofalsewhich skips all processing of the parameters input/outputTokenData(exported, returned byparse) as inputRequests for feedback:
{}is an obvious drawback but I'm seeking feedback on whether it helps make path behavior clearer/and.as implicit prefixesv6.3.0: Fix backtracking in 6.xCompare Source
Fixed
f1253b4Configuration
📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.