Skip to content

fix: backport GHSA-q3j6-qgpj-74h6 and GHSA-v39h-62p7-jpjc to v2.x - #187

Merged
mcollina merged 1 commit into
v2.xfrom
backport/v2.x-security-ghsas
Jul 17, 2026
Merged

fix: backport GHSA-q3j6-qgpj-74h6 and GHSA-v39h-62p7-jpjc to v2.x#187
mcollina merged 1 commit into
v2.xfrom
backport/v2.x-security-ghsas

Conversation

@mcollina

Copy link
Copy Markdown
Member

Summary

Backports the security fixes for:

These were originally fixed in v3.1.1 and v3.1.2. The v2.x line (<= 2.4.0) is still vulnerable.

Changes

  • Preserve reserved path escapes during parse / normalize / equal / serialize so encoded separators and dot segments stay data, not live path syntax
  • Re-escape RFC 3986 gen-delims in the host after unescape() so authority structure cannot be rewritten
  • Report malformed authority/port via error; leave such string inputs unchanged in normalize(); return false from equal() when either side is malformed
  • Add regression tests covering both advisories

Follow-up

After merge, publish a 2.4.1 (or next patch) and update both GHSAs to list the new 2.x patched version alongside 3.1.1 / 3.1.2.

Test plan

  • npm run test:unit (includes new security regression tests)
  • npm run test:lint
  • Manual checks:
    • normalize('http://example.com/public/%2e%2e/admin') → keeps %2E%2E
    • equal(...%2e%2e/admin, .../admin)false
    • normalize('http://trusted.com%40evil.com/') → preserves %40
    • parse('http://trusted.com%40evil.com/').hosttrusted.com%40evil.com

…p7-jpjc

Preserve reserved path escapes (%2F, %2E) during normalize/equal so
percent-encoded dot segments cannot bypass path-based policy checks
(GHSA-q3j6-qgpj-74h6 / CVE-2026-6321).

Re-escape authority gen-delims in host after decode, and leave
malformed authority/port inputs unchanged under normalize/equal so
encoded delimiters cannot rewrite authority
(GHSA-v39h-62p7-jpjc / CVE-2026-6322).

Backported from v3.1.1 and v3.1.2.
@mcollina

Copy link
Copy Markdown
Member Author

@UlisesGascon would you take care of updating the OpenJS records once this lands?

@mcollina

Copy link
Copy Markdown
Member Author

Unfortunately, I have v2 of fast-uri in the dependency tree :(. Sigh.

@ivan-tymoshenko ivan-tymoshenko left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants