Repository navigation
fix(simulation): match bodyFile URLs against allowed origins exactly (GHSA-p5c5-p2gx-h6q6) - #1254
Merged
Conversation
…HSA-p5c5-p2gx-h6q6) The -response-body-files-allow-origin check was a plain string prefix match, so a URL such as http://localhost@127.0.0.1:9002/secret passed an allowlist of http://localhost while the request actually went to 127.0.0.1:9002. The download also used http.DefaultClient, which follows redirects to any host. Parse both URLs and require scheme, host and port to match exactly, with an allowed path acting as a path-segment prefix. URLs with user info are rejected. Body files are now fetched with a client that re-checks every redirect against the allowlist. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
-response-body-files-allow-origincheck was a string prefix match, sohttp://localhost@127.0.0.1:9002/secretpassed an allowlist ofhttp://localhostand fetched from127.0.0.1:9002. Downloads also followed redirects to any host.Note
An origin without a port now only covers the default port.
http://localhostno longer allowshttp://localhost:8080.Test plan
go test ./core/... -count=1TestIsURLAllowedByOriginstable test covering the user info, host suffix, port, scheme and path traversal casesgo vet🤖 Generated with Claude Code