Skip to content

Commit cc311ac

Browse files
committed
Python: Re-introduce syntactic handling of str/bytes/unicode (again)
This reverts commit 870389a.
1 parent 870389a commit cc311ac

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

python/ql/src/semmle/python/dataflow/new/internal/TaintTrackingPrivate.qll

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ predicate subscriptStep(DataFlow::CfgNode nodeFrom, DataFlow::CfgNode nodeTo) {
7777
predicate stringManipulation(DataFlow::CfgNode nodeFrom, DataFlow::CfgNode nodeTo) {
7878
// transforming something tainted into a string will make the string tainted
7979
exists(DataFlow::CallCfgNode call | call = nodeTo |
80-
call = API::builtin(["str", "bytes", "unicode"]).getACall() and
80+
(
81+
call = API::builtin(["str", "bytes", "unicode"]).getACall()
82+
or
83+
call.getFunction().asCfgNode().(NameNode).getId() in ["str", "bytes", "unicode"]
84+
) and
8185
nodeFrom in [call.getArg(0), call.getArgByName("object")]
8286
)
8387
or
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
argumentToEnsureNotTaintedNotMarkedAsSpurious
22
untaintedArgumentToEnsureTaintedNotMarkedAsMissing
3-
| test_string.py:35:9:35:19 | test_string.py:35 | ERROR, you should add `# $ MISSING: tainted` annotation | unicode(..) |
43
failures
5-
| test_string.py:35:22:35:32 | Comment # $ tainted | Missing result:tainted= |

0 commit comments

Comments
 (0)