summaryrefslogtreecommitdiff
path: root/docs/howto
diff options
context:
space:
mode:
authorCarl Meyer <carl@oddbird.net>2014-09-10 11:06:19 -0600
committerTim Graham <timograham@gmail.com>2015-01-13 13:10:11 -0500
commitd7597b31d5c03106eeba4be14a33b32a5e25f4ee (patch)
tree038cb8960a000e8320d7a057076bb24901dd1e73 /docs/howto
parentf143e25883bb420fd8ec140a09dc88a899e9607e (diff)
[1.6.x] Stripped headers containing underscores to prevent spoofing in WSGI environ.
This is a security fix. Disclosure following shortly. Thanks to Jedediah Smith for the report.
Diffstat (limited to 'docs/howto')
-rw-r--r--docs/howto/auth-remote-user.txt16
1 files changed, 16 insertions, 0 deletions
diff --git a/docs/howto/auth-remote-user.txt b/docs/howto/auth-remote-user.txt
index 2edab6bc53..dc96a98bbc 100644
--- a/docs/howto/auth-remote-user.txt
+++ b/docs/howto/auth-remote-user.txt
@@ -64,6 +64,22 @@ If your authentication mechanism uses a custom HTTP header and not
class CustomHeaderMiddleware(RemoteUserMiddleware):
header = 'HTTP_AUTHUSER'
+.. warning::
+
+ Be very careful if using a ``RemoteUserMiddleware`` subclass with a custom
+ HTTP header. You must be sure that your front-end web server always sets or
+ strips that header based on the appropriate authentication checks, never
+ permitting an end-user to submit a fake (or "spoofed") header value. Since
+ the HTTP headers ``X-Auth-User`` and ``X-Auth_User`` (for example) both
+ normalize to the ``HTTP_X_AUTH_USER`` key in ``request.META``, you must
+ also check that your web server doesn't allow a spoofed header using
+ underscores in place of dashes.
+
+ This warning doesn't apply to ``RemoteUserMiddleware`` in its default
+ configuration with ``header = 'REMOTE_USER'``, since a key that doesn't
+ start with ``HTTP_`` in ``request.META`` can only be set by your WSGI
+ server, not directly from an HTTP request header.
+
If you need more control, you can create your own authentication backend
that inherits from :class:`~django.contrib.auth.backends.RemoteUserBackend` and
override one or more of its attributes and methods.