Conversation
🦋 Changeset detectedLatest commit: 2abf408 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
eb4ed9a to
10a1684
Compare
62d9421 to
ab06947
Compare
5dbb267 to
7ded67e
Compare
18575df to
f19d1b1
Compare
8a2d1e8 to
cf5ff43
Compare
3084b5c to
048a63d
Compare
|
Size Change: -242 B (-0.3%) Total Size: 79.6 kB
ℹ️ View Unchanged
|
|
Size Change: -186 B (-0.23%) Total Size: 80.4 kB
ℹ️ View Unchanged
|
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. |
|
@cursor review |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3239 +/- ##
=======================================
Coverage 98.05% 98.05%
=======================================
Files 151 151
Lines 2821 2831 +10
Branches 553 554 +1
=======================================
+ Hits 2766 2776 +10
Misses 11 11
Partials 44 44 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Renovate Ignore NotificationBecause you closed this PR without merging, Renovate will ignore this update. You will not get PRs for any future If you accidentally closed this PR, or if you changed your mind: rename this PR to get a fresh replacement PR. |
This PR contains the following updates:
^6.3.0→^8.0.0Release Notes
pillarjs/path-to-regexp (path-to-regexp)
v8.3.0: 8.3.0Compare Source
Changed
2a7f2a4TokenData(#391)687a9bba4a8552a6bdf40Other
9df24484a91505d63f44b973d15cv8.2.0: 8.2.0Compare Source
Fixed
path-to-regexpto run on older browsers by targeting ES20155969033sflag from regexp51dbd45v8.1.0Compare Source
Added
pathToRegexpmethod back for generating a regexstringifymethod for convertingTokenDatainto a path stringv8.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.
Edit: The post is out - https://blakeembrey.com/posts/2024-09-web-redos/
Added
*namesyntax, aligns with:behavior but using an asterisk insteadChanged
?,+, and*- only optional exists moving forward (use wildcards for+,{*foo}for*)Added
:"foo-bar"string | TokenData | Array<string | TokenData>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 prefixesMotivation
path-to-regexp v6 is vulnerable to ReDoS when routes use two or more parameters between slashes. v8 removes regex features entirely to eliminate this class of vulnerability. Additionally, the v8 syntax is simpler and will be the finalized syntax used in Express.js v5 going forward.
Solution
Upgrade
path-to-regexpfrom v6 to v8 in@data-client/rest, updating both runtime code and TypeScript path-inference types.Runtime (
RestHelpers.ts):compile()andparse()calls for the new v8 APItokenMap()to handle v8's structured token tree (includinggrouptokens for{...}optional syntax)Types (
pathTypes.ts):PathKeys/PathSplits: Updated to handle*namewildcards alongside:nameparams, with v8-appropriate delimiter and escape setsCleanKeytype to strip quotes from quoted parameter names (:"with-dash"→with-dash)?suffix handling fromOnlyOptional/OnlyRequired; optionality is now detected via trailing}from{...}groupsTests:
pathTypes.test.tswith 50+ direct type-level assertions covering all v8 patterns (basic params, wildcards, optional groups, quoted names, escapes, combined patterns,ShortenPath,PathArgsAndSearch)types.test.tsto v8Docs & blog: