Skip to content

fix(proxy): strip Set-Cookie from upstream responses#475

Merged
jxom merged 2 commits into
mainfrom
jxom/strip-upstream-set-cookie
May 23, 2026
Merged

fix(proxy): strip Set-Cookie from upstream responses#475
jxom merged 2 commits into
mainfrom
jxom/strip-upstream-set-cookie

Conversation

@jxom
Copy link
Copy Markdown
Member

@jxom jxom commented May 23, 2026

No description provided.

A paid API proxy must never let an upstream service set cookies in the
user's browser under the proxy's own origin. Otherwise a compromised,
misbehaving, or attacker-influenced upstream can return
`Set-Cookie: session=evil; Domain=.example.com; Secure` and the
browser will honor it for every sibling subdomain of the proxy —
turning any future path-confusion or open-redirect bug in the
surrounding deployment into a session-fixation primitive.

Proxied services authenticate via bearer tokens or signed payloads,
never cookies, so dropping `set-cookie` is purely defensive with no
behavioral cost.

Adds a regression test verifying both single- and multi-valued
`Set-Cookie` headers (including the `getSetCookie` accessor) are
removed while other headers pass through unchanged.

Amp-Thread-ID: https://ampcode.com/threads/T-019e525a-a5a8-75ca-98e4-8ce9433a3a52
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 23, 2026

Open in StackBlitz

npm i https://pkg.pr.new/mppx@475

commit: bed1021

GHSA-q8mj-m7cp-5q26 covers qs >=6.11.1 <=6.15.1 (DoS in
qs.stringify). The existing override pinned to 6.14.2, which now
falls inside the vulnerable range. Bumps the override range to
<=6.15.1 and pins to the patched 6.15.2.

Unblocks 'Checks' job (pnpm audit) on this branch and main.

Amp-Thread-ID: https://ampcode.com/threads/T-019e525a-a5a8-75ca-98e4-8ce9433a3a52
@jxom jxom merged commit b051e6c into main May 23, 2026
9 checks passed
@jxom jxom deleted the jxom/strip-upstream-set-cookie branch May 23, 2026 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant