Visitar URL original
Adds `shouldStripHeaderOnRedirectIfOnDifferentHostOnly` option on `Request` by meghfossa · Pull Request #520 · snoyberg/http-client · GitHub
Skip to content

Adds shouldStripHeaderOnRedirectIfOnDifferentHostOnly option on Request - #520

Merged
snoyberg merged 4 commits into
snoyberg:masterfrom
meghfossa:feat/strip-headers-only-when-host-changes
Oct 30, 2023
Merged

snoyberg merged 4 commits into
snoyberg:masterfrom
meghfossa:feat/strip-headers-only-when-host-changes

Conversation

@meghfossa

@meghfossa meghfossa commented Oct 19, 2023 •

Copy link
Copy Markdown
Contributor

Overview

This PR,

  • adds shouldStripHeaderOnRedirectIfOnDifferentHostOnly option to Request
  • modifies getRedirectedRequest signature to include original Request

Why?

Many stdlib in other language and ecosystem offer this functionality by default - refer to golang and python-requests for example. Potentially leaking headers to different host can lead to security incident. Refer to Python's CVE re this: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-20060

Ideally, shouldStripHeaderOnRedirect should have only stripped headers if the host differed, so without breaking change, this seems to be second best option.

Previous discussion on this topic: #300

Testing

  • I added few automated tests.

Remaining

  • Anything else is needed for contribution or release?

@meghfossa

Copy link
Copy Markdown
Contributor Author

Hi @snoyberg, let me know what I can do to get this to finish line!

@meghfossa meghfossa mentioned this pull request Oct 20, 2023

@snoyberg snoyberg left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable. Can you add a minor version bump and changelog entry? Also, please bump the @since comment to match the new version.

@meghfossa
meghfossa requested a review from snoyberg October 28, 2023 22:43
@snoyberg
snoyberg merged commit be63cb8 into snoyberg:master Oct 30, 2023
@snoyberg

Copy link
Copy Markdown
Owner

Thanks! Released to Hackage.

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.

2 participants