Repository navigation
fix: reject dot-segment path parameters - #1441
Merged
Merged
Conversation
Path parameters that are exactly "." or ".." now throw ManagementError before any request is sent, matching the behaviour added in v7.6.0.
ankita10119
marked this pull request as draft
November 11, 2026 18:31
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v5 #1441 +/- ##
==========================================
+ Coverage 89.62% 89.64% +0.01%
==========================================
Files 428 428
Lines 19886 19891 +5
Branches 9400 9759 +359
==========================================
+ Hits 17823 17831 +8
+ Misses 2063 2060 -3
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
ankita10119
marked this pull request as ready for review
November 12, 2026 17:12
harshithRai
approved these changes
Nov 12, 2026
harshithRai
left a comment
Contributor
There was a problem hiding this comment.
LGTM! pending auth0-legacy bump post v4 patch. Approving
4.37.2 rejects dot-segment path parameters, so upgrading to this release also fixes the auth0/legacy entrypoint.
Contributor
|
Looks good! |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Path parameters are encoded with
encodePathParam, which usesencodeURIComponentand leaves.unchanged. When a path parameter is exactly.or.., URL resolution removes it as a dot segment, so the request (with the Management API token attached) is sent to a different path than the one the method targets. For example,users.roles.list('..')was sent asGET /api/v2/roles, andusers.delete('..')asDELETE /api/v2/.Fix (backport of v7.6.0):
src/management/core/url/encodePathParam.ts: rejects.and.., throwing the error class passed in (or a plainError). This file is identical to the one in v7.6.0.src/management/api/(101 files): everycore.url.encodePathParam(x)call now passeserrors.ManagementErroras the second argument, as in v7.6.0. This is the only change in these files, so callers get aManagementErrorlike any other SDK error.src/management/tests/unit/url/encodePathParam.test.ts: new unit tests, identical to v7.6.0.The check runs while the request path is being built, so a rejected call never sends the request. Values such as
...,a.b,auth0|a.band%2e%2eare unaffected (%2e%2eis encoded as%252e%252e).auth0/legacyfix:package.json/yarn.lock:auth0-legacybumped fromnpm:auth0@^4.37.1tonpm:auth0@^4.37.2. 4.37.2 contains the same fix for the v4 client, so upgrading to this release also fixes theauth0/legacyentrypoint, even for users with an existing lockfile. The lockfile also gains ajose@^4.13.2entry, whichauth0@4.37.xdepends on and which was previously missing.Release workflow (so a 5.x release doesn't become the default install):
.github/actions/npm-publish/action.yml: the npm dist-tag for stable versions changed fromlatesttolegacy-v5, so publishing 5.x no longer replaces 7.x asnpm install auth0..github/actions/release-create/action.yml:make_latest: false, so the 5.x GitHub release isn't marked as the repo's Latest releasesoftprops/action-gh-releasefromde2c0eb(Nov 2022, nomake_latestinput, Node 16) to5be0e66(v2.4.2), the same pin used onv4. The older version would silently ignoremake_latest.No endpoints were added, removed or deprecated. The only SDK behaviour change: a call whose path parameter is exactly
.or..now throwsManagementErrorinstead of being sent to a different endpoint.Alternatives considered:
.as%2E. That doesn't work, because WHATWG URL parsing also treats%2e%2e,.%2eand%2e.as.., so these values are rejected instead.encodePathParam.ts(a 1-file diff). That would throw a plainErrorinstead ofManagementError. The call-site change keeps the error type consistent with v7.6.0 and with existinginstanceof ManagementErrorhandling.References
Testing
New unit tests in
src/management/tests/unit/url/encodePathParam.test.ts(18 tests):.and..are rejected, and the provided error class is thrownusr_123,a/b,...,a..b,%2E%2E,"", numbers, booleans,null,undefined)With only the dot-segment check disabled, the 3 rejection tests fail.
Verified locally:
yarn install --frozen-lockfilepasses with the updated lockfile, andauth0-legacyresolves to 4.37.2. Itsyarn.lockhashes match the 4.37.2 publish log.yarn lint(no new warnings),yarn build(CJS and ESM) andyarn lint:packagepassyarn test: 205/205 suites, 4494 passed. The 1 skipped test is a pre-existingit.skipintests/management/token-provider.test.ts. The wire tests exercise the changed client methods with normal IDs.fetch(Node 18.20.8 and 24.0.1):users.roles.list('..')is sent toGET /api/v2/rolesandusers.delete('..')toDELETE /api/v2/, with the token..and.onusers.roles.list,users.get,users.deleteandroles.getthrowManagementErrorand nothing is sent; normal IDs such asauth0|a.bare unchangedauth0/legacy:users.getRoles({ id: '..' })andusers.delete({ id: '..' })throwInvalidPathParameterErrorand nothing is sent; normal IDs are unchangedChecklist