Uh oh!
There was an error while loading. Please reload this page.
fix: prevent Host header bypass vulnerability - #58
Conversation
This commit fixes a security vulnerability where an attacker could bypass proxy restrictions by sending requests with mismatched Host headers. The vulnerability allowed sending a request to one domain (e.g., api.anthropic.com) while setting the Host header to another domain (e.g., evil.com), which could cause CDNs like CloudFlare to route the request to the attacker's server. Changes: - Modified prepare_upstream_request() to ensure Host header always matches URI authority - Added comprehensive test coverage in weak_integration.rs - Validates both HTTP and HTTPS requests This prevents data exfiltration and unauthorized access to protected domains. Fixes#57 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Simplified the test to clearly demonstrate the vulnerability and fix by: - Running the same curl command directly (shows evil.com passes through) - Running it through httpjail (shows it's corrected to httpbin.org) This makes it clearer that httpjail prevents the Host header bypass attack that would otherwise be possible. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Added a TODO note documenting future improvement to use the type system to ensure all request information passed to upstream has been validated by the RuleEngine. This would provide compile-time guarantees that security checks cannot be bypassed. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Codex Review: Here are some suggestions.
Reply with @codex fix comments to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
Uh oh!
There was an error while loading. Please reload this page.
ammario
commented
Sep 21, 2025
Created issue #59 to track the TODO for using the type system to prevent request validation bypasses. This would make security vulnerabilities like the Host header bypass impossible at compile time. |
Summary
This PR fixes a security vulnerability where an attacker could bypass proxy restrictions by sending requests with mismatched Host headers, as described in #57.
The Vulnerability
The issue allowed sending a request to one domain (e.g.,
api.anthropic.com) while setting the Host header to another domain (e.g.,evil.com). This could cause CDNs like CloudFlare to route the request to the attacker's server instead of the intended destination, potentially enabling:The Fix
Modified
prepare_upstream_request()insrc/proxy.rsto ensure the Host header always matches the URI authority. The fix:Testing
Added comprehensive test coverage in
tests/weak_integration.rs:Verification
All tests pass and the code meets quality standards (clippy, formatting).
Fixes#57
🤖 Generated with Claude Code