Skip to content

fix: strip proxy-authorization header on cross-host redirect - #196

Open
mahirhir wants to merge 1 commit into
npm:mainfrom
mahirhir:fix-strip-proxy-authorization-on-cross-host-redirect
Open

fix: strip proxy-authorization header on cross-host redirect#196
mahirhir wants to merge 1 commit into
npm:mainfrom
mahirhir:fix-strip-proxy-authorization-on-cross-host-redirect

Conversation

@mahirhir

Copy link
Copy Markdown

When a request is redirected to a different hostname, minipass-fetch already drops the authorization and cookie headers so credentials are not forwarded to the new host (added in #45). The proxy-authorization header is a credential header in the same class, but it is not dropped, so it stays on the redirected request and reaches the new host.

This adds proxy-authorization to that same strip, right next to authorization and cookie. The redirect condition and everything else are unchanged.

The other redirect-following clients already treat proxy-authorization as part of this boundary:

  • undici removes authorization, cookie, and proxy-authorization on a cross-origin redirect.
  • follow-redirects drops Authorization, Proxy-Authorization, and Cookie across host/scheme changes (it added Proxy-Authorization for CVE-2024-28849).
  • @microsoft/kiota-http-fetchlibrary added Proxy-Authorization to its cross-origin scrub recently (CVE-2026-49336).

Scope: this is the same threat model as the existing authorization/cookie strip, that is, a caller that sets a Proxy-Authorization header and then follows a redirect to a different host. It is defence in depth for parity with the clients above, not a new class of exploit.

The existing "redirect to different host strips headers" test now also sends a proxy-authorization header and asserts it is absent on the redirected request. Without the change the test fails, because the header reaches the new host.

When a request redirects to a different hostname, minipass-fetch already
drops the authorization and cookie headers (npm#45) so credentials are not
forwarded to the new host. The proxy-authorization header is in the same
class but was left in place, so it survives onto the redirected request.

Drop it alongside authorization and cookie, matching undici, follow-redirects
(CVE-2024-28849), and @microsoft/kiota-http-fetchlibrary (CVE-2026-49336).
@mahirhir
mahirhir requested a review from a team as a code owner June 29, 2026 17:35
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