-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
22.0.0 regression: We need a better default treatment of SCRIPT_NAME #3192
Conversation
How will |
Same as for the secure scheme headers - all connections that are not tuple (ip, port) are trusted unconditionally. (Yes, that far from obvious line should be flipped from |
59d4abd
to
6ec8e42
Compare
6ec8e42
to
3c7bb99
Compare
3c7bb99
to
5bbf373
Compare
Rebased version contains a doc syntax fix missed in #3217 (rst lists use Question to reviewers: What about |
@pajod it should be made available by default yes. |
* PATH_NAME is used like SCRIPT_NAME: include both * replicate changed forwarded-allow-ips default to proxy_allow_ips
sounds good for me. Do you plane any other changes? |
In this PR? No. Before any release is tagged that includes this change? Very likely. -- |
Thanks for your answer :) We will launch a 23.1 asap this month with more feature. Let's focus on making a release bringing gunicorn on a par with latest HTTP 1.1 updates for 3.0 PATH_INFO and SCRIPT_NAME are required the wsgi spec : https://peps.python.org/pep-3333/#environ-variables . I think it's unfortunate that people don't understand this pooint when they talk about security. As for gunicorn I think that we should provide 2 modes:
This let me think that a simple "--mode" variable set as "server" or "gateway" could enforce some rules and options. Ie no CGI-VARIABLES should be accepted when it's come from HTTP in server mode. These variables can only be set using OS env or configuration in such case. In gateway mode we should probably accept them transparently and let the security benig handled by the server on top. I will merge this change fr now but let's revisit this asap following the definition above in a searate ticket. |
merged the patch. Thanks :) Discussion can continue there #3262 |
As pointed out in #2650, I have introduced a regression in the now released 22.0 version. What commonly worked in the default installation without additional configuration broke: Passing dynamic path information from a front-end when the application lives in a subfolder.
SCRIPT_NAME
(underscore, not dash) header to transmit the path where the application lives are broken after updating to gunicorn 22.0Affected Nginx config might look like this:
This is not necessarily unsafe. When leaving the defaults of
underscores_in_headers off; ignore_invalid_headers on;
untouched, this header name would not be automatically forwarded, so it has come from Nginx.Caution
SCRIPT_NAME
is not the only header that can lead to dangerous results when an application gets confused about which headers were inserted by an authorized proxy. But is the only one gunicorn absolutely must take care of, being the one gunicorn picks up from headers and places into environ.I propose we do:
map{}-ed
data to the application.Related issues