Skip to content

fix(security): upgrade fast-uri to 4.1.2 to patch SSRF vulnerabilities - #348

Open
KiranHK-code wants to merge 1 commit into
vallabhatech:mainfrom
KiranHK-code:fix/fast-uri-ssrf-vulnerability
Open

fix(security): upgrade fast-uri to 4.1.2 to patch SSRF vulnerabilities#348
KiranHK-code wants to merge 1 commit into
vallabhatech:mainfrom
KiranHK-code:fix/fast-uri-ssrf-vulnerability

Conversation

@KiranHK-code

Copy link
Copy Markdown
Contributor

Security: Prevent Host Confusion and Path Traversal in fast-uri

Description

This PR addresses security vulnerabilities in fast-uri related to URL parsing, normalization, and resolution.

The affected parsing behavior can allow specially crafted URLs containing percent-encoded delimiters or dot segments to be interpreted differently than intended. In security-sensitive applications, this may result in host confusion or path traversal and could potentially be exploited to perform SSRF attacks.

Issues addressed

  • Host confusion via percent-encoded authority delimiters

    • Prevents percent-encoded URL delimiters from being incorrectly interpreted during URL parsing and resolution.
    • Ensures the authority/host component cannot be altered through ambiguous encoding.
  • Path traversal via percent-encoded dot segments

    • Ensures encoded . and .. path segments are correctly normalized.
    • Prevents traversal outside the intended URL path when resolving URLs.

Steps to Reproduce

  1. Craft URLs containing percent-encoded authority delimiters such as encoded /, ?, or # characters.
  2. Craft URLs containing percent-encoded dot segments such as %2e, %2e%2e, or equivalent encoded representations.
  3. Parse and resolve the crafted URLs using fast-uri.
  4. Observe whether the resulting host or resolved path differs from the intended URL.

Expected Behavior

fast-uri should:

  • Correctly parse URL authority and host components.
  • Prevent percent-encoded delimiters from causing host confusion.
  • Normalize percent-encoded . and .. path segments safely.
  • Prevent path traversal during URL resolution.
  • Produce consistent results between parsing, normalization, and resolution.
  • Reject or safely normalize ambiguous URL inputs.

Changes

This PR:

  • Strengthens URL parsing and normalization.
  • Handles percent-encoded authority delimiters safely.
  • Adds proper normalization for encoded dot segments.
  • Prevents traversal during relative URL resolution.
  • Adds regression tests for maliciously crafted URLs.
  • Ensures existing valid URL parsing behavior remains unchanged.

Testing

Regression tests cover:

  • Percent-encoded authority delimiters.
  • Encoded /, ?, and # characters in URL components.
  • Single encoded dot segments.
  • Double encoded dot segments.
  • Mixed encoded and unencoded traversal sequences.
  • Relative URL resolution involving encoded traversal paths.
  • Valid URLs to ensure there are no regressions.

Security Impact

These changes prevent ambiguous URL parsing and normalization that could allow attackers to influence the interpreted destination host or escape an intended URL path.

This reduces the risk of host confusion, path traversal, and SSRF in applications relying on fast-uri for URL parsing and resolution.

fixes #81

@vercel

vercel Bot commented Aug 9, 2026

Copy link
Copy Markdown

@KiranHK-code is attempting to deploy a commit to the vallabhatech's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@KiranHK-code, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 48 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 88c82be2-90d0-478e-af9d-c5fa7fbe4f9f

📥 Commits

Reviewing files that changed from the base of the PR and between fff6e0a and 8530da1.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • package.json

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

sonarqubecloud Bot commented Aug 9, 2026

Copy link
Copy Markdown

@KiranHK-code

Copy link
Copy Markdown
Contributor Author

Hi @vallabhatech please review this PR

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.

fast-uri Host Confusion and Path Traversal

1 participant