Python: support user defined taint source

This commit is contained in:
Rasmus Lerchedahl Petersen
2021-11-02 14:59:27 +01:00
parent 5d7b09ac67
commit 07d5086b07
2 changed files with 7 additions and 1 deletions

View File

@@ -45,7 +45,7 @@ async def test_async_for():
iter = AsyncIter()
taint(iter)
async for tainted in iter:
ensure_tainted(tainted) # $ MISSING: tainted
ensure_tainted(tainted) # $ tainted

View File

@@ -38,6 +38,12 @@ class TestTaintTrackingConfiguration extends TaintTracking::Configuration {
"TAINTED_STRING", "TAINTED_BYTES", "TAINTED_LIST", "TAINTED_DICT"
]
or
// User defined sources
exists(CallNode call |
call.getFunction().(NameNode).getId() = "taint" and
source.(DataFlow::CfgNode).getNode() = call.getAnArg()
)
or
source instanceof RemoteFlowSource
}