Skip to content

Commit 6539df6

Browse files
committed
Python: Add ConceptsTest for MarkupSafe
1 parent 14de3bf commit 6539df6

File tree

3 files changed

+21
-19
lines changed

3 files changed

+21
-19
lines changed

python/ql/test/library-tests/frameworks/markupsafe/ConceptsTest.expected

Whitespace-only changes.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import python
2+
import experimental.meta.ConceptsTest

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

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,37 +27,37 @@ def test():
2727
# as tainted even after it has been escaped in some place. This _might_ not be the
2828
# case since data-flow library has taint-steps from adjacent uses...
2929
ensure_tainted(ts) # $ tainted
30-
ensure_not_tainted(escape(ts))
30+
ensure_not_tainted(escape(ts)) # $ escapeInput=ts escapeKind=html escapeOutput=escape(..)
3131
ensure_tainted(ts) # $ tainted
3232

3333
ensure_tainted(
3434
ts, # $ tainted
3535
m_unsafe, # $ tainted
36-
m_unsafe + SAFE, # $ MISSING: tainted
37-
SAFE + m_unsafe, # $ MISSING: tainted
38-
m_unsafe.format(SAFE), # $ MISSING: tainted
39-
m_unsafe + ts, # $ MISSING: tainted
36+
m_unsafe + SAFE, # $ escapeInput=SAFE escapeKind=html escapeOutput=BinaryExpr MISSING: tainted
37+
SAFE + m_unsafe, # $ escapeInput=SAFE escapeKind=html escapeOutput=BinaryExpr MISSING: tainted
38+
m_unsafe.format(SAFE), # $ escapeInput=SAFE escapeKind=html escapeOutput=m_unsafe.format(..) MISSING: tainted
39+
m_unsafe + ts, # $ escapeInput=ts escapeKind=html escapeOutput=BinaryExpr MISSING: tainted
4040

41-
m_safe.format(m_unsafe), # $ MISSING: tainted
41+
m_safe.format(m_unsafe), # $ escapeKind=html escapeOutput=m_safe.format(..) MISSING: tainted
4242

43-
escape(ts).unescape(), # $ MISSING: tainted
44-
escape_silent(ts).unescape(), # $ MISSING: tainted
43+
escape(ts).unescape(), # $ escapeInput=ts escapeKind=html escapeOutput=escape(..) MISSING: tainted
44+
escape_silent(ts).unescape(), # $ escapeInput=ts escapeKind=html escapeOutput=escape_silent(..) MISSING: tainted
4545
)
4646

4747
ensure_not_tainted(
48-
escape(ts),
49-
escape_silent(ts),
48+
escape(ts), # $ escapeInput=ts escapeKind=html escapeOutput=escape(..)
49+
escape_silent(ts), # $ escapeInput=ts escapeKind=html escapeOutput=escape_silent(..)
5050

51-
Markup.escape(ts),
51+
Markup.escape(ts), # $ escapeInput=ts escapeKind=html escapeOutput=Markup.escape(..)
5252

5353
m_safe,
54-
m_safe + ts,
55-
ts + m_safe,
56-
m_safe.format(ts),
54+
m_safe + ts, # $ escapeInput=ts escapeKind=html escapeOutput=BinaryExpr
55+
ts + m_safe, # $ escapeInput=ts escapeKind=html escapeOutput=BinaryExpr
56+
m_safe.format(ts), # $ escapeInput=ts escapeKind=html escapeOutput=m_safe.format(..)
5757

58-
escape(ts) + ts,
59-
escape_silent(ts) + ts,
60-
Markup.escape(ts) + ts,
58+
escape(ts) + ts, # $ escapeInput=ts escapeKind=html escapeOutput=BinaryExpr escapeOutput=escape(..)
59+
escape_silent(ts) + ts, # $ escapeInput=ts escapeKind=html escapeOutput=BinaryExpr escapeOutput=escape_silent(..)
60+
Markup.escape(ts) + ts, # $ escapeInput=ts escapeKind=html escapeOutput=BinaryExpr escapeOutput=Markup.escape(..)
6161
)
6262

6363
# flask re-exports these, as:
@@ -70,8 +70,8 @@ def test():
7070
)
7171

7272
ensure_not_tainted(
73-
flask.escape(ts),
74-
flask.Markup.escape(ts),
73+
flask.escape(ts), # $ escapeInput=ts escapeKind=html escapeOutput=flask.escape(..)
74+
flask.Markup.escape(ts), # $ escapeInput=ts escapeKind=html escapeOutput=flask.Markup.escape(..)
7575
)
7676

7777

0 commit comments

Comments
 (0)