Repository navigation
fix: drop Proxy-Authorization header on cross-origin redirects (#1869) - #1871
Open
EnesKartal wants to merge 1 commit into
Open
EnesKartal wants to merge 1 commit into
EnesKartal wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Description
Fixes #1869.
When following cross-origin redirects,
superagentcleans sensitive authentication headers (Authorization,Cookie). However,Proxy-Authorizationwas not stripped, allowing proxy credentials configured on the request to leak to unintended third-party redirect origins.This PR ensures
Proxy-Authorizationis deleted whenchangesOriginis true:src/utils.js:cleanHeaderstripsheader['proxy-authorization']whenchangesOriginis true (covers 301, 302, 303).src/node/index.js:_redirectstripsheaders['proxy-authorization']whenchangesOriginis true (covers 307, 308).Credentials continue to be preserved on same-origin redirects.
Verification
test/node/redirects-other-host.jsensuring:Proxy-Authorizationis stripped on 302, 307, and 308 cross-origin redirects.Proxy-Authorizationis preserved on same-origin redirects.