Skip to content

fix(simulation): match bodyFile URLs against allowed origins exactly (GHSA-p5c5-p2gx-h6q6) - #1254

Merged
tommysitu merged 1 commit into
masterfrom
fix/body-file-origin-check-ghsa-p5c5-p2gx-h6q6
Nov 1, 2026
Merged

tommysitu merged 1 commit into
masterfrom
fix/body-file-origin-check-ghsa-p5c5-p2gx-h6q6

Conversation

@tommysitu

Copy link
Copy Markdown
Member

Summary

  • The -response-body-files-allow-origin check was a string prefix match, so http://localhost@127.0.0.1:9002/secret passed an allowlist of http://localhost and fetched from 127.0.0.1:9002. Downloads also followed redirects to any host.
  • Allowed origins are now matched on scheme, host and port exactly. A path in the allowed origin acts as a path-segment prefix. URLs with user info are rejected.
  • Body files are fetched with a client that re-checks every redirect against the allowlist.

Note

An origin without a port now only covers the default port. http://localhost no longer allows http://localhost:8080.

Test plan

  • go test ./core/... -count=1
  • New TestIsURLAllowedByOrigins table test covering the user info, host suffix, port, scheme and path traversal cases
  • New user info and off-allowlist redirect regression tests fail without the fix and pass with it
  • go vet

🤖 Generated with Claude Code

…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>
Comment thread core/hoverfly_funcs.go Dismissed
@tommysitu
tommysitu merged commit 934472f into master Nov 1, 2026
6 checks passed
@tommysitu
tommysitu deleted the fix/body-file-origin-check-ghsa-p5c5-p2gx-h6q6 branch November 1, 2026 23:34
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