Skip to content

Security: Potential SSRF via URL input in Request.download()#1790

Open
tomaioo wants to merge 1 commit into
acacode:mainfrom
tomaioo:fix/security/potential-ssrf-via-url-input-in-request-
Open

Security: Potential SSRF via URL input in Request.download()#1790
tomaioo wants to merge 1 commit into
acacode:mainfrom
tomaioo:fix/security/potential-ssrf-via-url-input-in-request-

Conversation

@tomaioo

@tomaioo tomaioo commented Jun 19, 2026

Copy link
Copy Markdown

Summary

Security: Potential SSRF via URL input in Request.download()

Problem

Severity: High | File: src/util/request.ts:L12

The Request.download() method in src/util/request.ts accepts a url parameter and passes it directly to fetch() without validation. While there is some IP filtering in remote-schema-fetch.ts, the Request.download() method itself does not perform any validation. If called directly with user-controlled input, this could lead to Server-Side Request Forgery (SSRF), allowing attackers to make requests to internal services or cloud metadata endpoints.

Solution

Add URL validation in Request.download() to block private IP ranges, localhost, and metadata endpoints before making the fetch request. Reuse or integrate with the existing isRemoteSchemaFetchAllowed() logic from remote-schema-fetch.ts.

Changes

  • src/util/request.ts (modified)

Summary by cubic

Adds URL validation to Request.download() to prevent SSRF by blocking private, localhost, and metadata endpoints before any fetch. Reuses isRemoteSchemaFetchAllowed() so both code paths follow the same network rules.

  • Bug Fixes
    • Use isRemoteSchemaFetchAllowed() in src/util/request.ts.
    • On disallowed URLs, log via consola and return an error string without calling fetch.

Written for commit d10751a. Summary will update on new commits.

Review in cubic

The `Request.download()` method in `src/util/request.ts` accepts a `url` parameter and passes it directly to `fetch()` without validation. While there is some IP filtering in `remote-schema-fetch.ts`, the `Request.download()` method itself does not perform any validation. If called directly with user-controlled input, this could lead to Server-Side Request Forgery (SSRF), allowing attackers to make requests to internal services or cloud metadata endpoints.

Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
@changeset-bot

changeset-bot Bot commented Jun 19, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: d10751a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 1 file

Re-trigger cubic

@js2me

js2me commented Jun 19, 2026

Copy link
Copy Markdown
Member

Hello @tomaioo !
Thank you for your pull request, please add changeset

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