summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHasan Ramezani <hasan.r67@gmail.com>2021-01-12 11:22:13 +0100
committerGitHub <noreply@github.com>2021-01-12 11:22:13 +0100
commitba3fb2e4d0aca26f6ea37d7e31488ad09043f89d (patch)
tree2f73a1e3c208759b0235237a6ee29e59b34247e4
parentfdc3d9dcaf87fb0a1350154561053faa331c3b69 (diff)
Refs #32311 -- Fixed CSRF_FAILURE_VIEW system check errors code.
-rw-r--r--django/core/checks/security/csrf.py4
-rw-r--r--docs/ref/checks.txt8
-rw-r--r--tests/check_framework/test_security.py6
3 files changed, 9 insertions, 9 deletions
diff --git a/django/core/checks/security/csrf.py b/django/core/checks/security/csrf.py
index 758ff299e4..2b70d363e2 100644
--- a/django/core/checks/security/csrf.py
+++ b/django/core/checks/security/csrf.py
@@ -54,7 +54,7 @@ def check_csrf_failure_view(app_configs, **kwargs):
"The CSRF failure view '%s' could not be imported." %
settings.CSRF_FAILURE_VIEW
)
- errors.append(Error(msg, id='security.E025'))
+ errors.append(Error(msg, id='security.E102'))
else:
try:
inspect.signature(view).bind(None, reason=None)
@@ -63,5 +63,5 @@ def check_csrf_failure_view(app_configs, **kwargs):
"The CSRF failure view '%s' does not take the correct number of arguments." %
settings.CSRF_FAILURE_VIEW
)
- errors.append(Error(msg, id='security.E024'))
+ errors.append(Error(msg, id='security.E101'))
return errors
diff --git a/docs/ref/checks.txt b/docs/ref/checks.txt
index a31bea19ba..a3d1b0664d 100644
--- a/docs/ref/checks.txt
+++ b/docs/ref/checks.txt
@@ -495,16 +495,16 @@ The following checks are run if you use the :option:`check --deploy` option:
should consider enabling this header to protect user privacy.
* **security.E023**: You have set the :setting:`SECURE_REFERRER_POLICY` setting
to an invalid value.
-* **security.E024**: The CSRF failure view ``'path.to.view'`` does not take the
- correct number of arguments.
-* **security.E025**: The CSRF failure view ``'path.to.view'`` could not be
- imported.
The following checks verify that your security-related settings are correctly
configured:
* **security.E100**: :setting:`DEFAULT_HASHING_ALGORITHM` must be ``'sha1'`` or
``'sha256'``.
+* **security.E101**: The CSRF failure view ``'path.to.view'`` does not take the
+ correct number of arguments.
+* **security.E102**: The CSRF failure view ``'path.to.view'`` could not be
+ imported.
Signals
-------
diff --git a/tests/check_framework/test_security.py b/tests/check_framework/test_security.py
index 9bf9bb2a0a..3a3b9cf774 100644
--- a/tests/check_framework/test_security.py
+++ b/tests/check_framework/test_security.py
@@ -486,13 +486,13 @@ class CSRFFailureViewTest(SimpleTestCase):
[
Error(
"The CSRF failure view '' could not be imported.",
- id='security.E025',
+ id='security.E102',
)
],
)
@override_settings(
- CSRF_FAILURE_VIEW=f'{__name__}.failure_view_with_invalid_signature',
+ CSRF_FAILURE_VIEW='check_framework.test_security.failure_view_with_invalid_signature',
)
def test_failure_view_invalid_signature(self):
msg = (
@@ -502,5 +502,5 @@ class CSRFFailureViewTest(SimpleTestCase):
)
self.assertEqual(
csrf.check_csrf_failure_view(None),
- [Error(msg, id='security.E024')],
+ [Error(msg, id='security.E101')],
)