mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Merge pull request #16923 from RasmusWL/impossible-isinstance
Python: Add test for impossible isinstance flow
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
argumentToEnsureNotTaintedNotMarkedAsSpurious
|
||||
untaintedArgumentToEnsureTaintedNotMarkedAsMissing
|
||||
testFailures
|
||||
failures
|
||||
@@ -0,0 +1,2 @@
|
||||
import experimental.meta.InlineTaintTest
|
||||
import MakeInlineTaintTest<TestTaintTrackingConfig>
|
||||
@@ -0,0 +1,11 @@
|
||||
def impossible_flow(cond: bool):
|
||||
TAINTED_STRING = "ts"
|
||||
x = (TAINTED_STRING, 42) if cond else "SAFE"
|
||||
|
||||
if isinstance(x, str):
|
||||
# tainted-flow to here is impossible, replicated from path-flow seen in a real
|
||||
# repo.
|
||||
ensure_not_tainted(x) # $ SPURIOUS: tainted
|
||||
else:
|
||||
ensure_tainted(x) # $ tainted
|
||||
ensure_tainted(x[0]) # $ tainted
|
||||
Reference in New Issue
Block a user