Skip to content

Commit d23d138

Browse files
authored
Merge pull request #16923 from RasmusWL/impossible-isinstance
Python: Add test for impossible isinstance flow
2 parents e1329df + 173cd13 commit d23d138

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
argumentToEnsureNotTaintedNotMarkedAsSpurious
2+
untaintedArgumentToEnsureTaintedNotMarkedAsMissing
3+
testFailures
4+
failures
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import experimental.meta.InlineTaintTest
2+
import MakeInlineTaintTest<TestTaintTrackingConfig>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
def impossible_flow(cond: bool):
2+
TAINTED_STRING = "ts"
3+
x = (TAINTED_STRING, 42) if cond else "SAFE"
4+
5+
if isinstance(x, str):
6+
# tainted-flow to here is impossible, replicated from path-flow seen in a real
7+
# repo.
8+
ensure_not_tainted(x) # $ SPURIOUS: tainted
9+
else:
10+
ensure_tainted(x) # $ tainted
11+
ensure_tainted(x[0]) # $ tainted

0 commit comments

Comments
 (0)