Security: Potential SSRF via URL input in Request.download()#1790
Open
tomaioo wants to merge 1 commit into
Open
Security: Potential SSRF via URL input in Request.download()#1790tomaioo wants to merge 1 commit into
tomaioo wants to merge 1 commit into
Conversation
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>
|
Member
|
Hello @tomaioo ! |
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.
Summary
Security: Potential SSRF via URL input in Request.download()
Problem
Severity:
High| File:src/util/request.ts:L12The
Request.download()method insrc/util/request.tsaccepts aurlparameter and passes it directly tofetch()without validation. While there is some IP filtering inremote-schema-fetch.ts, theRequest.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 existingisRemoteSchemaFetchAllowed()logic fromremote-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. ReusesisRemoteSchemaFetchAllowed()so both code paths follow the same network rules.isRemoteSchemaFetchAllowed()insrc/util/request.ts.consolaand return an error string without callingfetch.Written for commit d10751a. Summary will update on new commits.