Skip to content

Conversation

@ok2c
Copy link
Member

@ok2c ok2c commented Mar 16, 2025

@arturobernalg Please review and double-check.

@ok2c ok2c requested a review from arturobernalg March 16, 2025 14:02
Copy link
Member

@arturobernalg arturobernalg left a comment

Choose a reason for hiding this comment

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

@ok2c LGTM

@ok2c ok2c merged commit 10f7b78 into master Mar 17, 2025
17 checks passed
@ok2c ok2c deleted the disallow_auto_redirect_with_sensitive_headers branch March 19, 2025 21:35
@dani0600
Copy link

dani0600 commented Jul 15, 2025

Thanks for your work on the latest changes, @ok2c & @arturobernalg ! I've noticed you've implemented a new check to prevent redirects when requests contain sensitive headers, and also introduced a new LaxRedirectStrategy to allow more permissive redirects, this in v5.4.

I have a question regarding this code fragment: since LaxRedirectStrategy extends DefaultRedirectStrategy, and doesn't override the method isRedirectAllowed() containing the sensitive header check, wouldn't this mean that using LaxRedirectStrategy in a client would still fall back to the DefaultRedirectStrategy implementation of that method in the RedirectExec.handleResponse() call?

In that case, the check would still apply, and redirects would be blocked—even when using the lax strategy. Is this the intended behavior, or could this be an oversight?

Thanks in advance for clarifying!

PS: Unless I'm missing some configuration, this is happening in some of my tests, I could help you investigate. (Using CloseableHttpClient setting LaxRedirectStrategy into my client)

@ok2c
Copy link
Member Author

ok2c commented Jul 15, 2025

could this be an oversight?

@dani0600 Truth to be told that was an oversight on my part. However, it may not be a bad thing that one must explicitly enable redirects with sensitive headers even when LaxRedirectStrategy is being used.

@dani0600
Copy link

I understand @ok2c, thanks for your clarifications :)

I've opened a Jira issue here: https://issues.apache.org/jira/browse/HTTPCLIENT-2383.

As I outlined in the ticket, I believe this behavior might lead to some unexpected outcomes and adds a bit of complexity when using HttpClient. I will prepare a PR to show a possible fix — feel free to take a look when you have a moment. I'd really appreciate your feedback on it.

Thanks again !

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.

3 participants