Skip to content

Commit 02c017a

Browse files
authored
Merge pull request github#6058 from RasmusWL/more-aiohttp
Approved by yoff
2 parents e23b88b + 53f7633 commit 02c017a

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,18 @@ module AiohttpWebModel {
444444
AiohttpRequestMultiDictProxyInstances() {
445445
this.(DataFlow::AttrRead).getObject() = Request::instance() and
446446
this.(DataFlow::AttrRead).getAttributeName() in ["query", "headers"]
447+
or
448+
// Handle the common case of `x = await request.post()`
449+
// but don't try to handle anything else, since we don't have an easy way to do this yet.
450+
// TODO: more complete handling of `await request.post()`
451+
exists(Await await, DataFlow::CallCfgNode call, DataFlow::AttrRead read |
452+
this.asExpr() = await
453+
|
454+
read.(DataFlow::AttrRead).getObject() = Request::instance() and
455+
read.(DataFlow::AttrRead).getAttributeName() = "post" and
456+
call.getFunction() = read and
457+
await.getValue() = call.asExpr()
458+
)
447459
}
448460
}
449461

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ async def test_taint(request: web.Request): # $ requestHandler
104104

105105
# multidict.MultiDictProxy[str] (see `multidict` framework tests)
106106
await request.post(), # $ tainted
107-
(await request.post()).getone("key"), # $ MISSING: tainted
107+
(await request.post()).getone("key"), # $ tainted
108108
)
109109

110110
import yarl

0 commit comments

Comments
 (0)