prevent proxy cookie leakage - #146
Closed
MustafaMulla29 wants to merge 1 commit into
Closed
Conversation
MustafaMulla29
marked this pull request as ready for review
July 23, 2026 13:45
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
X-Sender-CookieRoot cause
The proxy initializes its outbound headers by copying the incoming browser
request. A request to the local
/proxyroute can therefore contain cookiesscoped to localhost. When
X-Sender-Cookieis empty, the copiedCookieheader was left untouched and forwarded to EasyEDA, whose CloudFront/WAF can
reject the unexpected cookie with
403 Forbidden.Fix
The proxy now removes the incoming
Cookieheader before constructing thetarget request. It then restores
Cookieonly when the caller explicitlyprovides a non-empty
X-Sender-Cookie.This keeps proxy-origin state isolated while preserving the existing contract
for target-specific authenticated requests.
Why file-server
Runframe supplies target headers through the
X-Sender-*contract, and the CLImounts file-server's proxy route. File-server is the component that converts
the browser request into the target request, so it is the shared boundary that
must distinguish proxy-origin cookies from target cookies.
Validation
bun test tests/routes/proxy.test.ts tests/routes/file-proxy03.test.ts— 9pass, 0 fail
bun test --max-concurrency=1— 31 pass, 0 failbun run format:check— passesbunx tsc --noEmit— passesbun run build— passesThe repository's default concurrent full-suite run also exposed an unrelated
pre-existing test-isolation flake in the events/file-proxy tests; the affected
tests pass when isolated and the proxy regression is consistently green.