Fix CRLF injection in Net::HTTP CONNECT request line - #29
Merged
Conversation
Validate conn_address, @address, and @PORT for CR, LF, and NUL before interpolating them into the raw CONNECT request. Extra CONNECT headers and Connection.connect were already checked; the Net::HTTP patch was not. Lift validate_connect_target! onto RubyProxyHeaders so both paths share the same fail-fast check, and add specs that cover host/port injection and that no CONNECT bytes are written on a rejected target. Co-authored-by: ProxyMesh AI <proxymeshai@users.noreply.github.com>
proxymesh
marked this pull request as ready for review
September 1, 2026 17:16
proxymesh
approved these changes
Sep 1, 2026
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.
The Net::HTTP CONNECT patch interpolated
conn_address,@address, and@portinto the raw CONNECT request line without rejecting CR/LF/NUL. Extra CONNECT headers andConnection.connectalready used that check; this path did not.This lifts
validate_connect_target!ontoRubyProxyHeadersand runs it inconnect_with_proxy_tunnelbefore any socket I/O. Specs cover host/port injection and assert that a rejected target writes no CONNECT bytes to the proxy.bundle exec rspec— 29 examples, 0 failures (6 existing pending).