comparison development.ini @ 8887:070b8c39736f

auth: only use X- headers instead of wsgi.url_scheme if explicitly told so in url_scheme_header - drop https_fixup setting Before, several X- headers would be trusted to overrule the actual connection protocol (http or https) seen by the Kallithea WSGI server. That was mainly when https_fixup were set, but it incorrectly also kicked in if https_fixup or use_htsts were configured. The ambiguity of which headers were used also made it less reliable. The proxy server not only had to be configured to set one of the headers correctly, it also had to make sure other headers were not passed on from the client. It would thus in some cases be possible for clients to fake the connection scheme, and thus potentially be possible to bypass restrictions configured in Kallithea. Fixed by making it configurable which WSGI environment variable to use for the protocol. Users can configure url_scheme_header to for example HTTP_X_FORWARDED_PROTO instead of using the default wsgi.url_scheme . This change is a bit similar to what is going on in the https_fixup middleware, but is doing a bit more of what for example is happening in similar code in werkzeug/middleware/proxy_fix.py . The semantics of the old https_fixup were unsafe, so it has been dropped. Admins that are upgrading must change their configuration to use the new url_scheme_header option.
author Mads Kiilerich <mads@kiilerich.com>
date Sun, 09 May 2021 22:40:56 +0200
parents 3d7ba590f6f5
children d483e2df546f
comparison
equal deleted inserted replaced
8886:3d7ba590f6f5 8887:070b8c39736f
112 cut_off_limit = 256000 112 cut_off_limit = 256000
113 113
114 ## WSGI environment variable to get the IP address of the client (default REMOTE_ADDR) 114 ## WSGI environment variable to get the IP address of the client (default REMOTE_ADDR)
115 #remote_addr_variable = HTTP_X_FORWARDED_FOR 115 #remote_addr_variable = HTTP_X_FORWARDED_FOR
116 116
117 ## WSGI environment variable to get the protocol (http or https) of the client connection (default wsgi.url_scheme)
118 #url_scheme_variable = HTTP_X_FORWARDED_PROTO
119
117 ## always pretend the client connected using HTTPS (default false) 120 ## always pretend the client connected using HTTPS (default false)
118 #force_https = true 121 #force_https = true
119 122
120 ## use Strict-Transport-Security headers (default false) 123 ## use Strict-Transport-Security headers (default false)
121 #use_htsts = true 124 #use_htsts = true