-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed #35328 - Improved debug messaging behind proxies.
- Loading branch information
1 parent
b6e2b83
commit 95759af
Showing
10 changed files
with
362 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Django", | ||
"type": "debugpy", | ||
"request": "launch", | ||
"program": "${workspaceFolder}/../csrf/manage.py", | ||
"args": ["runserver"], | ||
"django": true, | ||
"justMyCode": false | ||
}, | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Before submitting | ||
================= | ||
|
||
* Backward compatibility concern for the message. | ||
But the constant, and therefore the ability to use it | ||
with a given number of arguments, is not documented, | ||
so is not under the backward compatibility policy. | ||
* Determine what tests need to be written for the CSRF template and view. | ||
* Determine what documentation needs to be written about this change. | ||
* doesn't need any feature documentation | ||
* could have documentation in release notes, but seems too small. Are tiny changes documented? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
====================================================================== | ||
ERROR: test_bad_origin_bad_domain (csrf_tests.tests.CsrfViewMiddlewareTests) | ||
A request with a bad origin is rejected. | ||
---------------------------------------------------------------------- | ||
Traceback (most recent call last): | ||
File "/usr/local/python/3.10.13/lib/python3.10/unittest/case.py", line 59, in testPartExecutor | ||
yield | ||
File "/usr/local/python/3.10.13/lib/python3.10/unittest/case.py", line 591, in run | ||
self._callTestMethod(testMethod) | ||
File "/usr/local/python/3.10.13/lib/python3.10/unittest/case.py", line 549, in _callTestMethod | ||
method() | ||
File "/workspaces/django/django/test/utils.py", line 446, in inner | ||
return func(*args, **kwargs) | ||
File "/workspaces/django/tests/csrf_tests/tests.py", line 910, in test_bad_origin_bad_domain | ||
msg = REASON_BAD_ORIGIN % req.META["HTTP_ORIGIN"] | ||
TypeError: not enough arguments for format string | ||
|
||
====================================================================== | ||
ERROR: test_bad_origin_bad_protocol (csrf_tests.tests.CsrfViewMiddlewareTests) | ||
A request with an origin with wrong protocol is rejected. | ||
---------------------------------------------------------------------- | ||
Traceback (most recent call last): | ||
File "/usr/local/python/3.10.13/lib/python3.10/unittest/case.py", line 59, in testPartExecutor | ||
yield | ||
File "/usr/local/python/3.10.13/lib/python3.10/unittest/case.py", line 591, in run | ||
self._callTestMethod(testMethod) | ||
File "/usr/local/python/3.10.13/lib/python3.10/unittest/case.py", line 549, in _callTestMethod | ||
method() | ||
File "/workspaces/django/django/test/utils.py", line 446, in inner | ||
return func(*args, **kwargs) | ||
File "/workspaces/django/tests/csrf_tests/tests.py", line 941, in test_bad_origin_bad_protocol | ||
msg = REASON_BAD_ORIGIN % req.META["HTTP_ORIGIN"] | ||
TypeError: not enough arguments for format string | ||
|
||
====================================================================== | ||
ERROR: test_bad_origin_cannot_be_parsed (csrf_tests.tests.CsrfViewMiddlewareTests) | ||
A POST request with an origin that can't be parsed by urlparse() is | ||
---------------------------------------------------------------------- | ||
Traceback (most recent call last): | ||
File "/usr/local/python/3.10.13/lib/python3.10/unittest/case.py", line 59, in testPartExecutor | ||
yield | ||
File "/usr/local/python/3.10.13/lib/python3.10/unittest/case.py", line 591, in run | ||
self._callTestMethod(testMethod) | ||
File "/usr/local/python/3.10.13/lib/python3.10/unittest/case.py", line 549, in _callTestMethod | ||
method() | ||
File "/workspaces/django/django/test/utils.py", line 446, in inner | ||
return func(*args, **kwargs) | ||
File "/workspaces/django/tests/csrf_tests/tests.py", line 994, in test_bad_origin_cannot_be_parsed | ||
msg = REASON_BAD_ORIGIN % req.META["HTTP_ORIGIN"] | ||
TypeError: not enough arguments for format string | ||
|
||
====================================================================== | ||
ERROR: test_bad_origin_csrf_trusted_origin_bad_protocol (csrf_tests.tests.CsrfViewMiddlewareTests) | ||
A request with an origin with the wrong protocol compared to | ||
---------------------------------------------------------------------- | ||
Traceback (most recent call last): | ||
File "/usr/local/python/3.10.13/lib/python3.10/unittest/case.py", line 59, in testPartExecutor | ||
yield | ||
File "/usr/local/python/3.10.13/lib/python3.10/unittest/case.py", line 591, in run | ||
self._callTestMethod(testMethod) | ||
File "/usr/local/python/3.10.13/lib/python3.10/unittest/case.py", line 549, in _callTestMethod | ||
method() | ||
File "/workspaces/django/django/test/utils.py", line 446, in inner | ||
return func(*args, **kwargs) | ||
File "/workspaces/django/tests/csrf_tests/tests.py", line 968, in test_bad_origin_csrf_trusted_origin_bad_protocol | ||
msg = REASON_BAD_ORIGIN % req.META["HTTP_ORIGIN"] | ||
TypeError: not enough arguments for format string | ||
|
||
====================================================================== | ||
ERROR: test_bad_origin_null_origin (csrf_tests.tests.CsrfViewMiddlewareTests) | ||
A request with a null origin is rejected. | ||
---------------------------------------------------------------------- | ||
Traceback (most recent call last): | ||
File "/usr/local/python/3.10.13/lib/python3.10/unittest/case.py", line 59, in testPartExecutor | ||
yield | ||
File "/usr/local/python/3.10.13/lib/python3.10/unittest/case.py", line 591, in run | ||
self._callTestMethod(testMethod) | ||
File "/usr/local/python/3.10.13/lib/python3.10/unittest/case.py", line 549, in _callTestMethod | ||
method() | ||
File "/workspaces/django/django/test/utils.py", line 446, in inner | ||
return func(*args, **kwargs) | ||
File "/workspaces/django/tests/csrf_tests/tests.py", line 925, in test_bad_origin_null_origin | ||
msg = REASON_BAD_ORIGIN % req.META["HTTP_ORIGIN"] | ||
TypeError: not enough arguments for format string | ||
|
||
====================================================================== | ||
ERROR: test_bad_origin_bad_domain (csrf_tests.tests.CsrfViewMiddlewareUseSessionsTests) | ||
A request with a bad origin is rejected. | ||
---------------------------------------------------------------------- | ||
Traceback (most recent call last): | ||
File "/usr/local/python/3.10.13/lib/python3.10/unittest/case.py", line 59, in testPartExecutor | ||
yield | ||
File "/usr/local/python/3.10.13/lib/python3.10/unittest/case.py", line 591, in run | ||
self._callTestMethod(testMethod) | ||
File "/usr/local/python/3.10.13/lib/python3.10/unittest/case.py", line 549, in _callTestMethod | ||
method() | ||
File "/workspaces/django/django/test/utils.py", line 446, in inner | ||
return func(*args, **kwargs) | ||
File "/workspaces/django/tests/csrf_tests/tests.py", line 910, in test_bad_origin_bad_domain | ||
msg = REASON_BAD_ORIGIN % req.META["HTTP_ORIGIN"] | ||
TypeError: not enough arguments for format string | ||
|
||
====================================================================== | ||
ERROR: test_bad_origin_bad_protocol (csrf_tests.tests.CsrfViewMiddlewareUseSessionsTests) | ||
A request with an origin with wrong protocol is rejected. | ||
---------------------------------------------------------------------- | ||
Traceback (most recent call last): | ||
File "/usr/local/python/3.10.13/lib/python3.10/unittest/case.py", line 59, in testPartExecutor | ||
yield | ||
File "/usr/local/python/3.10.13/lib/python3.10/unittest/case.py", line 591, in run | ||
self._callTestMethod(testMethod) | ||
File "/usr/local/python/3.10.13/lib/python3.10/unittest/case.py", line 549, in _callTestMethod | ||
method() | ||
File "/workspaces/django/django/test/utils.py", line 446, in inner | ||
return func(*args, **kwargs) | ||
File "/workspaces/django/tests/csrf_tests/tests.py", line 941, in test_bad_origin_bad_protocol | ||
msg = REASON_BAD_ORIGIN % req.META["HTTP_ORIGIN"] | ||
TypeError: not enough arguments for format string | ||
|
||
====================================================================== | ||
ERROR: test_bad_origin_cannot_be_parsed (csrf_tests.tests.CsrfViewMiddlewareUseSessionsTests) | ||
A POST request with an origin that can't be parsed by urlparse() is | ||
---------------------------------------------------------------------- | ||
Traceback (most recent call last): | ||
File "/usr/local/python/3.10.13/lib/python3.10/unittest/case.py", line 59, in testPartExecutor | ||
yield | ||
File "/usr/local/python/3.10.13/lib/python3.10/unittest/case.py", line 591, in run | ||
self._callTestMethod(testMethod) | ||
File "/usr/local/python/3.10.13/lib/python3.10/unittest/case.py", line 549, in _callTestMethod | ||
method() | ||
File "/workspaces/django/django/test/utils.py", line 446, in inner | ||
return func(*args, **kwargs) | ||
File "/workspaces/django/tests/csrf_tests/tests.py", line 994, in test_bad_origin_cannot_be_parsed | ||
msg = REASON_BAD_ORIGIN % req.META["HTTP_ORIGIN"] | ||
TypeError: not enough arguments for format string | ||
|
||
====================================================================== | ||
ERROR: test_bad_origin_csrf_trusted_origin_bad_protocol (csrf_tests.tests.CsrfViewMiddlewareUseSessionsTests) | ||
A request with an origin with the wrong protocol compared to | ||
---------------------------------------------------------------------- | ||
Traceback (most recent call last): | ||
File "/usr/local/python/3.10.13/lib/python3.10/unittest/case.py", line 59, in testPartExecutor | ||
yield | ||
File "/usr/local/python/3.10.13/lib/python3.10/unittest/case.py", line 591, in run | ||
self._callTestMethod(testMethod) | ||
File "/usr/local/python/3.10.13/lib/python3.10/unittest/case.py", line 549, in _callTestMethod | ||
method() | ||
File "/workspaces/django/django/test/utils.py", line 446, in inner | ||
return func(*args, **kwargs) | ||
File "/workspaces/django/tests/csrf_tests/tests.py", line 968, in test_bad_origin_csrf_trusted_origin_bad_protocol | ||
msg = REASON_BAD_ORIGIN % req.META["HTTP_ORIGIN"] | ||
TypeError: not enough arguments for format string | ||
|
||
====================================================================== | ||
ERROR: test_bad_origin_null_origin (csrf_tests.tests.CsrfViewMiddlewareUseSessionsTests) | ||
A request with a null origin is rejected. | ||
---------------------------------------------------------------------- | ||
Traceback (most recent call last): | ||
File "/usr/local/python/3.10.13/lib/python3.10/unittest/case.py", line 59, in testPartExecutor | ||
yield | ||
File "/usr/local/python/3.10.13/lib/python3.10/unittest/case.py", line 591, in run | ||
self._callTestMethod(testMethod) | ||
File "/usr/local/python/3.10.13/lib/python3.10/unittest/case.py", line 549, in _callTestMethod | ||
method() | ||
File "/workspaces/django/django/test/utils.py", line 446, in inner | ||
return func(*args, **kwargs) | ||
File "/workspaces/django/tests/csrf_tests/tests.py", line 925, in test_bad_origin_null_origin | ||
msg = REASON_BAD_ORIGIN % req.META["HTTP_ORIGIN"] | ||
TypeError: not enough arguments for format string | ||
|
||
====================================================================== | ||
ERROR: test_template_encoding (view_tests.tests.test_csrf.CsrfViewTests) | ||
The template is loaded directly, not via a template loader, and should | ||
---------------------------------------------------------------------- | ||
Traceback (most recent call last): | ||
File "/usr/local/python/3.10.13/lib/python3.10/unittest/case.py", line 59, in testPartExecutor | ||
yield | ||
File "/usr/local/python/3.10.13/lib/python3.10/unittest/case.py", line 591, in run | ||
self._callTestMethod(testMethod) | ||
File "/usr/local/python/3.10.13/lib/python3.10/unittest/case.py", line 549, in _callTestMethod | ||
method() | ||
File "/workspaces/django/tests/view_tests/tests/test_csrf.py", line 133, in test_template_encoding | ||
csrf_failure(mock.MagicMock(), mock.Mock()) | ||
File "/workspaces/django/django/views/csrf.py", line 68, in csrf_failure | ||
"bad_origin": reason.split(" - ")[0] == REASON_BAD_ORIGIN.split(" - ")[0], | ||
TypeError: 'Mock' object is not subscriptable |
Oops, something went wrong.