From ed69d78a9b7bdfebdd93737af8cc159d70cb6fee Mon Sep 17 00:00:00 2001 From: Roberto De Ioris Date: Wed, 2 Jan 2013 17:38:03 +0100 Subject: [PATCH] export HTTP_AUTHORIZARION in mod_proxy_uwsgi --- apache2/mod_proxy_uwsgi.c | 8 ++++++++ plugins/router_basicauth/router_basicauth.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/apache2/mod_proxy_uwsgi.c b/apache2/mod_proxy_uwsgi.c index b60349e4..7fa9f6db 100644 --- a/apache2/mod_proxy_uwsgi.c +++ b/apache2/mod_proxy_uwsgi.c @@ -101,6 +101,14 @@ static int uwsgi_send_headers(request_rec *r, proxy_conn_rec *conn) ap_add_common_vars(r); ap_add_cgi_vars(r); + // this is not a security problem (in Linux) as uWSGI destroy the env memory area readable in /proc + // and generally if you host untrusted apps in your server and allows them to read others uid /proc/ + // files you have higher problems... + const char *auth = apr_table_get(r->headers_in, "Authorization"); + if (auth) { + apr_table_setn(r->subprocess_env, "HTTP_AUTHORIZATION", auth); + } + const char *script_name = apr_table_get(r->subprocess_env, "SCRIPT_NAME"); const char *path_info = apr_table_get(r->subprocess_env, "PATH_INFO"); diff --git a/plugins/router_basicauth/router_basicauth.c b/plugins/router_basicauth/router_basicauth.c index d696b9e9..655c5f3e 100644 --- a/plugins/router_basicauth/router_basicauth.c +++ b/plugins/router_basicauth/router_basicauth.c @@ -138,7 +138,7 @@ int uwsgi_routing_func_basicauth(struct wsgi_request *wsgi_req, struct uwsgi_rou iov[0].iov_len = 8; } - // chec for "Basic =" string at least + // check for "Basic =" string at least if (wsgi_req->authorization_len > 7 && ur->data2_len > 0) { if (strncmp(wsgi_req->authorization, "Basic ", 6)) goto forbidden;