mirror of
https://github.com/django/django.git
synced 2025-11-24 21:00:12 +00:00
Fixed #32800 -- Changed CsrfViewMiddleware not to mask the CSRF secret.
This also adds CSRF_COOKIE_MASKED transitional setting helpful in migrating multiple instance of the same project to Django 4.1+. Thanks Florian Apolloner and Shai Berger for reviews. Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
This commit is contained in:
parent
05e29da421
commit
5d80843ebc
10 changed files with 284 additions and 143 deletions
|
|
@ -9,7 +9,7 @@ class TestContextProcessor(CsrfFunctionTestMixin, SimpleTestCase):
|
|||
|
||||
def test_force_token_to_string(self):
|
||||
request = HttpRequest()
|
||||
test_token = '1bcdefghij2bcdefghij3bcdefghij4bcdefghij5bcdefghij6bcdefghijABCD'
|
||||
request.META['CSRF_COOKIE'] = test_token
|
||||
test_secret = 32 * 'a'
|
||||
request.META['CSRF_COOKIE'] = test_secret
|
||||
token = csrf(request).get('csrf_token')
|
||||
self.assertMaskedSecretCorrect(token, 'lcccccccX2kcccccccY2jcccccccssIC')
|
||||
self.assertMaskedSecretCorrect(token, test_secret)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue