@@ -8,9 +8,9 @@ def ensure_not_tainted(*args):
8
8
print ("ensure_not_tainted" )
9
9
for x in args : print (" " , x )
10
10
11
- # these contain `{}` so we can use .format
12
- TAINTED_STRING = '<"TAINTED_STRING" {}>'
13
- SAFE = "SAFE {}"
11
+ # these contain `{}` so we can use .format, and `%s` so we can use %-style formatting
12
+ TAINTED_STRING = '<"TAINTED_STRING" {} %s >'
13
+ SAFE = "SAFE {} %s "
14
14
15
15
def test ():
16
16
ts = TAINTED_STRING
@@ -36,9 +36,11 @@ def test():
36
36
m_unsafe + SAFE , # $ escapeInput=SAFE escapeKind=html escapeOutput=BinaryExpr MISSING: tainted
37
37
SAFE + m_unsafe , # $ escapeInput=SAFE escapeKind=html escapeOutput=BinaryExpr MISSING: tainted
38
38
m_unsafe .format (SAFE ), # $ escapeInput=SAFE escapeKind=html escapeOutput=m_unsafe.format(..) MISSING: tainted
39
+ m_unsafe % SAFE , # $ tainted MISSING: escapeInput=ts escapeKind=html escapeOutput=BinaryExpr
39
40
m_unsafe + ts , # $ escapeInput=ts escapeKind=html escapeOutput=BinaryExpr MISSING: tainted
40
41
41
42
m_safe .format (m_unsafe ), # $ tainted
43
+ m_safe % m_unsafe , # $ tainted
42
44
43
45
escape (ts ).unescape (), # $ escapeInput=ts escapeKind=html escapeOutput=escape(..) MISSING: tainted
44
46
escape_silent (ts ).unescape (), # $ escapeInput=ts escapeKind=html escapeOutput=escape_silent(..) MISSING: tainted
@@ -54,6 +56,7 @@ def test():
54
56
m_safe + ts , # $ escapeInput=ts escapeKind=html escapeOutput=BinaryExpr
55
57
ts + m_safe , # $ escapeInput=ts escapeKind=html escapeOutput=BinaryExpr
56
58
m_safe .format (ts ), # $ escapeInput=ts escapeKind=html escapeOutput=m_safe.format(..)
59
+ m_safe % ts , # $ SPURIOUS: tainted MISSING: escapeInput=ts escapeKind=html escapeOutput=BinaryExpr
57
60
58
61
escape (ts ) + ts , # $ escapeInput=ts escapeKind=html escapeOutput=BinaryExpr escapeOutput=escape(..)
59
62
escape_silent (ts ) + ts , # $ escapeInput=ts escapeKind=html escapeOutput=BinaryExpr escapeOutput=escape_silent(..)
0 commit comments