Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fe9c9d4

Browse files
committed
Python taint-tracking. Fix bug in legacy API.
1 parent 7c4a18e commit fe9c9d4

5 files changed

Lines changed: 59 additions & 177 deletions

File tree

python/ql/src/semmle/python/security/TaintTracking.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ class DictKind extends CollectionKind {
318318
Implementation::copyCall(fromnode, tonode) and this = fromkind
319319
or
320320
tonode.(CallNode).getFunction().pointsTo(ObjectInternal::builtin("dict")) and
321-
tonode.(CallNode).getArg(0) = fromnode
321+
tonode.(CallNode).getArg(0) = fromnode and this = fromkind
322322
or
323323
dict_construct(fromnode, tonode) and this.getValue() = fromkind
324324
}
@@ -430,11 +430,13 @@ abstract class TaintSource extends @py_flow_node {
430430
final predicate flowsToSink(TaintKind srckind, TaintSink sink) {
431431
exists(TaintedNode src, TaintedNode tsink |
432432
src = this.getATaintNode() and
433+
src.getTaintKind() = srckind and
433434
src.getASuccessor*() = tsink and
434435
this.isSourceOf(srckind, _) and
435436
sink = tsink.getCfgNode() and
436437
sink.sinks(tsink.getTaintKind()) and
437-
tsink.getPath().noAttribute()
438+
tsink.getPath().noAttribute() and
439+
tsink.isSink()
438440
)
439441
}
440442

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
| Module deep | x | Taint simple.test | | deep.py:20 |
22
| Module module | dangerous | Taint simple.test | | module.py:3 |
3-
| Module test | module | Attribute 'dangerous' taint simple.test | | test.py:85 |
4-
| Module test | unsafe | Taint simple.test | | test.py:155 |
3+
| Module test | unsafe | Taint simple.test | | test.py:156 |

0 commit comments

Comments
 (0)