-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
It's unfortunate that people don't understand when talk about security in Gunicorn. When Gunicorn is used as a WSGI server it shoudl comply as much as possible with the specification. (Even it's slightly relaxed for streaming content as of today). For example some environ variables are required: https://peps.python.org/pep-3333/#environ-variables and for Error handling in general the applications should trap their own internal error : https://peps.python.org/pep-3333/#error-handling
As for gunicorn I think that we should provide 2 modes:
- is running behind a proxy/HTTP server . In this case some secuirtiy could be relaxed and CGI variables, probably Forwatd shuoudl be passed and secured from this server . This is the advised way until now.
- gunicorn acting itself as main server. In such case we should ensure only Gunicorn and system env can set this variables .
A simple --profile setting 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 profile. 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 beeing handled by the server on top.