Repository navigation
Conversation
normalizePathEncoding kept every %2E percent-encoded to stop %2E%2E from decoding into .. and being collapsed by removeDotSegments. That suppressed %2E everywhere, so foo%2Ebar and %2Ehidden stayed encoded even though . is unreserved (RFC 3986 2.3) and should be decoded (6.2.2.2) — the query and fragment normalizers already do, and equal() reported RFC-equivalent URIs as unequal. Decide per segment: keep %2E encoded only when the segment is . or .., decode it otherwise, so the %2E%2E traversal stays encoded.
|
Good |
mcollina
left a comment
There was a problem hiding this comment.
I don't see a direct reintroduction of CVE-2026-6321: exact . and .. segments remain encoded, and the published traversal example still does not collapse or compare equal to /admin.
However, this weakens the fail-safe invariant introduced by that fix. normalizePathSegment() now turns encoded dots into raw traversal-like syntax whenever another character keeps the segment from being exactly . or ..:
/public/%2e%2e%2fadmin -> /public/..%2Fadmin
/public/%2e%2e%5cadmin -> /public/..%5Cadmin
/public/%2e%2e;/admin -> /public/..;/admin
These values do not traverse inside fast-uri, so this is not a demonstrated fast-uri-local vulnerability. They do, however, increase parser-differential risk when a downstream component later decodes %2F, interprets backslashes, or strips matrix parameters. equal() also starts treating the encoded and mixed forms as equivalent.
This additionally contradicts the current README guarantee that %2E path escapes are preserved during normalization and comparison.
Before merging, please add differential cases for %2E combined with %2F, %5C, raw dots, semicolons, and nested encoding, and either preserve the existing %2E invariant or explicitly document and justify the narrower security boundary.
Validation on the merge result:
npm test: 1,704 tests passednpm run lint: passednpm run test:typescript: 7 assertions passed- short-segment adversarial check: no idempotence failure or direct traversal collapse
The repository has no package lock, so npm ci was not applicable; dependencies were installed using the repository's lockfile-free workflow.
normalize()leaves%2Epercent-encoded everywhere in the path, sohttp://h/foo%2Ebarstaysfoo%2Ebarandequal('.../foo%2Ebar', '.../foo.bar')returns false. But.is unreserved (RFC 3986 §2.3) and should be decoded (§6.2.2.2) — the query and fragment normalizers already do, and every other unreserved byte (-_~) is decoded in the path.The blanket
decoded !== '.'guard exists to stop%2E%2Efrom decoding into..and being collapsed byremoveDotSegments(a traversal defense), but it is too broad. This decides per segment:%2Estays encoded only when the segment is exactly.or.., and decodes otherwise./public/%2E%2E/adminis unchanged and the security-normalization tests still pass.