Skip to content

Commit 63c7fa0

Browse files
committed
Python: aiohttp match_info should be tainted
Whoops
1 parent 597a9df commit 63c7fa0

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

python/ql/src/semmle/python/frameworks/Aiohttp.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ module AiohttpWebModel {
225225
nodeTo.(DataFlow::AttrRead).getAttributeName() in [
226226
"url", "rel_url", "forwarded", "host", "remote", "path", "path_qs", "raw_path", "query",
227227
"headers", "transport", "cookies", "content", "_payload", "content_type", "charset",
228-
"http_range", "if_modified_since", "if_unmodified_since", "if_range"
228+
"http_range", "if_modified_since", "if_unmodified_since", "if_range", "match_info"
229229
]
230230
}
231231
}

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ async def test_taint(request: web.Request): # $ requestHandler
1919
request.path_qs, # $ tainted
2020
request.raw_path, # $ tainted
2121

22+
# dict-like for captured parts of the URL
23+
request.match_info, # $ tainted
24+
request.match_info["key"], # $ tainted
25+
request.match_info.get("key"), # $ tainted
26+
2227
# multidict.MultiDictProxy[str]
2328
# see https://multidict.readthedocs.io/en/stable/multidict.html#multidict.MultiDictProxy
2429
# TODO: Should have a better way to capture that we in fact _do_ model this as a
@@ -121,7 +126,6 @@ async def test_taint(request: web.Request): # $ requestHandler
121126
ensure_not_tainted(
122127
request.loop,
123128

124-
request.match_info,
125129
request.app,
126130
request.config_dict,
127131
)

0 commit comments

Comments
 (0)