Repository navigation
fix(proxy): strip client IP headers (mppx#1369) - #760
Conversation
👁️ Cyclops Security Review✅ Reviewed a2fd015 (latest) · Coverage: partial · no open findings · report |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
✅ Changelog found on PR. |
There was a problem hiding this comment.
I reviewed this PR and found no bugs. The repo-wide CODEOWNERS entry covers these files and the change hardens the proxy's request-header scrubbing, so a human look is still worthwhile.
What was reviewed:
FORWARDING_HEADERSinis_request_header_stripped: it uses the same exact-length, case-insensitiveeq_ascii_lowermatch as the other stripped headers, soViaductand similar names pass through.- Response scrubbing is unchanged, and the new tests check that only
x-publicsurvives through the existingnameshelper. The changelog fragment matches the AGENTS.md format and includes the "as mppx does" note. - Not done: no build, clippy, fmt or feature-matrix run. The change was checked only by reading it.
Extended reasoning...
The change touches src/proxy/headers.rs, adding a five-entry FORWARDING_HEADERS list that is checked in is_request_header_stripped, plus two unit tests and a patch changelog fragment. It is security-relevant: it stops clients from spoofing their IP or forwarding path to the upstream through proxied requests. The logic is small and follows the existing pattern exactly. I deferred instead of approving because .github/CODEOWNERS assigns every path (*) to named owners.
Motivation
mppx's proxy now strips client-supplied forwarding headers (
Forwarded,X-Real-IP,True-Client-IP,CF-Connecting-IPandVia) from proxied requests, as it already stripsX-Forwarded-*. A client could otherwise claim any address or path to the upstream through them. The Rust proxy should behave the same way.Summary
FORWARDING_HEADERStosrc/proxy/headers.rsand stripped them inis_request_header_stripped, compared case-insensitively like the other stripped headers.scrub_request_headerswhile other headers stay, and each is stripped regardless of case.Key design considerations
Headers.scrub.forwardhelper andrewrite/sendsplit inProxy.ts) was not ported: it restructures TypeScript code and changes no behavior that this crate's proxy needs to mirror.Propagated from wevm/mppx#1369 (e3a3dad4c983b3abbbca0cea1997c6c0ba2709fd) by Agricola.