-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Reconsider the precedence of Forwarded vs X-Forwarded-For #35751
Comments
@tsaarni Hi,
Why then enable both if it is a concern in such cases ? |
I have an example use case, where the end-user of a Quarkus-based application started to see the application suddenly act on |
While So, I think the current behavior of Quarkus is correct. We prefer a standardized mechanism. We could imagine an option to switch back the precedence, but it would need to be explicitly set. |
I don't think an option to switch precedence would really help here. The problem is that people who don't know/don't care about these headers suddenly have an open attack surface if an attacker sends the headers with higher precedence. I am wondering if it would be better to to just not process requests if both headers are present and the values are not consistent... |
Oh, that's right! That would be clever solution to the problem. |
I totally agree with @sschu idea. |
Description
Previously change #25117 introduced the option to set both
quarkus.http.proxy.allow-forwarded
andquarkus.http.proxy.allow-x-forwarded
at the same time. It is rightly highlighted in the docs that this combination is not recommended and there can be security implications if used (doc link).When both are enabled, Quarkus currently uses
Forwarded
overX-Forwarded-*
if both headers are present. However many popular proxies like NGINX and Envoy do not seem to supportForwarded
- they do supportX-Forwarded-*
. As a result, application that enabled both will be subject to header forging (untrusted client settingForwarded
), unless user of the application realizes this and explicitly re-configures the proxy to overwriteForwarded
. If the order Quarkus parses the headers would be the other way around (X-Forwarded-*
overForwarded
) this would not be the case. Even if user missed reconfiguring the proxy and uses the defaults, they would be safe(r).Another reasoning for the idea: often the backwards compatibility design principles say that old functionality should take precedence over new functionality.
If you consider this idea of swapping the priority something you'd take into Quarkus, I can contribute it.
Implementation ideas
No response
The text was updated successfully, but these errors were encountered: