Skip to content

Commit 9866214

Browse files
authored
Update python/ql/test/query-tests/Security/CWE-918-ServerSideRequestForgery/full_partial_test.py
1 parent 83f1b2c commit 9866214

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

python/ql/test/query-tests/Security/CWE-918-ServerSideRequestForgery/full_partial_test.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,16 @@ def full_ssrf():
2222
url = "https://" + user_input + "/foo?key=" + query_val
2323
requests.get(url) # NOT OK -- user has full control
2424

25-
# currently it's not possible to sanitize a step, so due to use-use flow, if we sanitize
26-
# a value that is used later on, it will NOT be tainted later on... so we need to make
27-
# separate tests for each of the vairant cases, so show that we handle all of them.
25+
# taint-steps are added as `fromNode -> toNode`, but when adding a sanitizer it's
26+
# currently only possible to so on either `fromNode` or `toNode` (either all edges in
27+
# and out, or just the edges in or out). The sanitizers for full URL control is applied
28+
# on the `fromNode`, since for `"https://{}/{}".format(user_input1, user_input2)` there
29+
# is still a valid taint-step for `user_input1` -- if we made `toNode` a sanitizer that
30+
# would also remove this flow that we actually want. When coupled with use-use flow,
31+
# this means that later uses of a sanitized value will no longer be tainted, so
32+
# `requests.get(user_input2)` would no longer give an alert. To overcome this problem,
33+
# we split these tests into multiple functions, so we do not get this use-use flow, and
34+
# therefore know we are able to see where the sanitizers are applied.
2835

2936
def full_ssrf_format():
3037
user_input = request.args['untrusted_input']

0 commit comments

Comments
 (0)