Skip to content

Commit a64e939

Browse files
committed
Python: Add note about .method
1 parent 75e2555 commit a64e939

File tree

1 file changed

+9
-0
lines changed
  • python/ql/test/library-tests/frameworks/rest_framework

1 file changed

+9
-0
lines changed

python/ql/test/library-tests/frameworks/rest_framework/taint_test.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ def test_taint(request: Request, routed_param): # $ requestHandler routedParamet
5353
ensure_not_tainted(
5454
# although these could technically be user-controlled, it seems more likely to lead to FPs than interesting results.
5555
request.accepted_media_type,
56+
57+
# In normal Django, if you disable CSRF middleware, you're allowed to use custom
58+
# HTTP methods, like `curl -X FOO <url>`.
59+
# However, with Django REST framework, doing that will yield:
60+
# `{"detail":"Method \"FOO\" not allowed."}`
61+
#
62+
# In the end, since we model a Django REST framework request entirely as a
63+
# extension of a Django request, we're not easily able to remove the taint from
64+
# `.method`.
5665
request.method, # $ SPURIOUS: tainted
5766
)
5867

0 commit comments

Comments
 (0)