diff options
| author | Carl Meyer <carl@oddbird.net> | 2014-09-10 11:06:19 -0600 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-01-13 13:03:05 -0500 |
| commit | 316b8d49746933d1845d600314b002d9b64d3e3d (patch) | |
| tree | d272f2d0a1a0c70c4d1cb5a9fd525629357061dd /docs/howto/auth-remote-user.txt | |
| parent | 958aeda4b5efcde30438979d93fc585a2f12ce02 (diff) | |
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/auth-remote-user.txt')
| -rw-r--r-- | docs/howto/auth-remote-user.txt | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/docs/howto/auth-remote-user.txt b/docs/howto/auth-remote-user.txt index 30aad24293..07389c1fac 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. |
