Skip to content

HttpClient should drop authorization headers when following redirects to different hosts by default #47246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Hixie opened this issue Sep 19, 2021 · 4 comments
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-io

Comments

@Hixie
Copy link
Contributor

Hixie commented Sep 19, 2021

I can't find evidence in the standards to support this, but it seems to be standard practice to drop Authorization headers when handling a cross-origin redirect, to avoid leaking credentials when the host has been tricked into sending redirects somehow.

See e.g.
https://stackoverflow.com/questions/17092259/should-authorization-be-kept-when-redirection-is-handled

@bleroux
Copy link

bleroux commented Sep 19, 2021

For reference, how curl deals with this :
https://curl.se/docs/CVE-2018-1000007.html

  • drops authorization headers when handling a redirect to another host (doesn't drop if same host and different port).
  • doesn't drop if --location-trusted option is used

@lrhn lrhn added area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-io labels Sep 21, 2021
@satamas
Copy link

satamas commented Jan 20, 2022

That's not only a security issue but a usability issue also. For example, if have a server with an authorization that redirects to S3 it leads to an error because S3 tries to use provided authorization header. We have faced it implementing dart packages repositories support in our tool and we weren't the first one https://stackoverflow.com/questions/63694476/how-to-remove-authorization-header-on-redirect-on-any-flutter-dart-http-client

@dtretyakov
Copy link

How the same security issue was addressed in Ktor HttpClient: ktorio/ktor@0c10815

@brianquinlan
Copy link
Contributor

Duplicate of #45410

@brianquinlan brianquinlan marked this as a duplicate of #45410 Jan 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-io
Projects
None yet
Development

No branches or pull requests

6 participants