#28488: Django 1.11 to 1.11.4 raises CSRF verification failed if settings.DEBUG
is
False
-------------------------------------+-------------------------------------
Reporter: Ruben Alves | Owner: nobody
Type: Bug | Status: new
Component: CSRF | Version: 1.11
Severity: Release blocker | Resolution:
Keywords: csrf failed | Triage Stage:
settings debug false production | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Ruben Alves):
I've created a template tag named `uncypher` that calls
`_unsalt_cipher_token` as you can see below:
{{{
from django.middleware.csrf import _unsalt_cipher_token
from django.template import Library
register = Library()
@register.simple_tag
def uncypher(token):
"""
Testing the CSRF problem
"""
return _unsalt_cipher_token(token)
}}}
Then, on a html template I've added
{{{
var parser = new DOMParser();
var csrf = parser.parseFromString("{% csrf_token %}",
"text/xml").firstChild;
console.error('token: {% uncypher csrf_token %}');
}}}
After set `settings.DEBUG=True` and reload the page 3 times, on the
`JavaScript Console` was printed the same value
`lKnMEqisHw8mxMIXZgZTKt9cirypfv1f` on the 3 times that I've reloaded the
page.
Then I've set `settings.DEBUG=False` and reloaded the page 4 times again.
On the first time it printed the same value
`lKnMEqisHw8mxMIXZgZTKt9cirypfv1f`. On the second
`YgnNvwBJJwAID17nl7FLhtA3rObtvGLX`, third time printed
`hB1plGV688FpDPNu9waO1H959c04YLPM` and fourth time printed
`C2sJ9e7coe74juO6HxAY4RIppBY4yi1Y`.
--
Ticket URL: <https://code.djangoproject.com/ticket/28488#comment:10>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/068.c4e37b77995d1ae940c1903a810dbfbc%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.