fix(proxy): read chunked HTTP request bodies on L7 forward path - #1687
Open
Frankie-Xu wants to merge 3 commits into
Open
fix(proxy): read chunked HTTP request bodies on L7 forward path#1687Frankie-Xu wants to merge 3 commits into
Frankie-Xu wants to merge 3 commits into
Conversation
Contributor
Author
|
CI: please run / approve checks when available. |
Contributor
PR Review SummarySize
Affected crates
Blast radius — ContainedThis PR touches: source code Updated automatically on each push to this PR. |
Frankie-Xu
marked this pull request as draft
August 21, 2026 10:56
Contributor
Author
Frankie-Xu
force-pushed
the
fix/1635-chunked-request-body
branch
from
August 31, 2026 18:12
fddffa3 to
988dd22
Compare
Frankie-Xu
marked this pull request as ready for review
August 31, 2026 18:12
There was a problem hiding this comment.
nogent code review
1 minor suggestion regarding header stripping consistency.
Findings (not tied to a changed line):
- 🔒 [LOW · security]
crates/nono-proxy/src/tls_intercept/http1.rs:87— Infilter_websocket_request, the list of stripped headers matches oncontent-lengthbut does not includetransfer-encoding. For consistency and defense-in-depth against potential request manipulation on upgrade paths, addtransfer-encodingto thematches!macro infilter_websocket_request.
Automated code + security review. CI already covers clippy, rustfmt, tests, cargo-audit and commit-lint.
Decode Transfer-Encoding: chunked request bodies in read_request_body so the L7 plaintext forward path no longer hangs when clients send chunked bodies without Content-Length. Strip Transfer-Encoding from forwarded headers and re-frame with Content-Length upstream. Closes nolabs-ai#1635 Signed-off-by: Frankie-Xu Agent <agent@cursor.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Always re-add Content-Length after stripping CL/chunked framing, including empty bodies, and cap chunked request trailer lines to avoid DoS from unbounded trailer loops. Signed-off-by: Frankie-Xu <92643488+Frankie-Xu@users.noreply.github.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Frankie-Xu <92643488+Frankie-Xu@users.noreply.github.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Frankie-Xu
force-pushed
the
fix/1635-chunked-request-body
branch
from
September 1, 2026 16:50
988dd22 to
ea9798f
Compare
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
Transfer-Encoding: chunkedrequest bodies inread_request_bodyso L7 plaintext HTTP forward no longer hangs when clients omitContent-Length(e.g. Gonet/httpstreaming readers).Transfer-Encodingfrom forwarded headers and re-frame upstream requests with a computedContent-Length.Closes #1635
Approach
reverse.rs: When headers declare chunked encoding, read and decode the body from the client stream (bounded by existingMAX_REQUEST_BODY= 16 MiB), using the same line-bounded reading pattern astls_intercept/http1.rs::relay_chunkedon the response side.filter_headers/filter_headers_multi: StripTransfer-EncodingalongsideContent-Lengthso upstream never receivesTransfer-Encoding: chunkedwith zero chunks.server.rsforward path: Read body before building upstream headers; strip body-framing headers instrip_proxy_headers/strip_and_redeem_proxy_headers; appendContent-Lengthafter decode.CONNECT blind-tunnel path is unchanged.
Test plan
cargo test -p nono-proxy— 493 unit/integration tests passcargo clippy -p nono-proxy -- -D warnings -D clippy::unwrap_usedmake fmt-check0\r\n\r\n)has_chunked_transfer_encoding+ header strippingcurlchunked POST through proxy allow-list (issue repro steps)Conflict note (#1683)
PR #1683 (
fix(proxy): decode Basic auth for basic_auth phantom validation) also touchesreverse.rsbut is still open / not merged. This branch is based on currentorigin/main(post v0.74.0). Overlap is limited to unrelated areas ofreverse.rs; rebasing after #1683 merges may require a trivial conflict resolution.Agent Compliance Check
tls_intercept/http1.rs::relay_chunked)Contributor disclosure: This PR was prepared by an AI coding agent (Cursor).
Made with Cursor