mirror of
https://github.com/github/codeql.git
synced 2026-05-04 13:15:21 +02:00
Python: Handle taint for % formatting
This commit is contained in:
@@ -43,3 +43,6 @@
|
||||
| test.py:89 | fail | str_methods | ts.join(..) |
|
||||
| test.py:99 | fail | non_syntactic | meth() |
|
||||
| test.py:100 | fail | non_syntactic | _str(..) |
|
||||
| test.py:109 | ok | percent_fmt | BinaryExpr |
|
||||
| test.py:110 | ok | percent_fmt | BinaryExpr |
|
||||
| test.py:111 | fail | percent_fmt | BinaryExpr |
|
||||
|
||||
@@ -100,8 +100,21 @@ def non_syntactic():
|
||||
_str(ts),
|
||||
)
|
||||
|
||||
|
||||
def percent_fmt():
|
||||
print("\n#percent_fmt")
|
||||
ts = TAINTED_STRING
|
||||
tainted_fmt = ts + " %s %s"
|
||||
ensure_tainted(
|
||||
tainted_fmt % (1, 2),
|
||||
"%s foo bar" % ts,
|
||||
"%s %s %s" % (1, 2, ts),
|
||||
)
|
||||
|
||||
|
||||
# Make tests runable
|
||||
|
||||
str_operations()
|
||||
str_methods()
|
||||
non_syntactic()
|
||||
percent_fmt()
|
||||
|
||||
Reference in New Issue
Block a user