Skip to content

Commit 74345b1

Browse files
committed
Python: Make library-tests/taint/strings tests more transparent
Following the setup I invented for library-tests/taint/unpacking. TestStep is still a bit annoying, since the output is not easy to eyeball; but for now I guess we can live with it :) I honestly didn't get the point of DistinctStringKinds.ql, other than showing we can handle multiple taint kinds
1 parent e4b8385 commit 74345b1

File tree

9 files changed

+129
-142
lines changed

9 files changed

+129
-142
lines changed

python/ql/test/library-tests/taint/strings/DistinctStringKinds.expected

Lines changed: 0 additions & 16 deletions
This file was deleted.

python/ql/test/library-tests/taint/strings/DistinctStringKinds.ql

Lines changed: 0 additions & 37 deletions
This file was deleted.

python/ql/test/library-tests/taint/strings/Taint.qll

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import python
22
import semmle.python.security.TaintTracking
33
import semmle.python.security.strings.Untrusted
4+
import semmle.python.security.Exceptions
45

56

67
class SimpleSource extends TaintSource {
78

8-
SimpleSource() { this.(NameNode).getId() = "TAINTED" }
9+
SimpleSource() { this.(NameNode).getId() = "TAINTED_STRING" }
910

1011
override predicate isSourceOf(TaintKind kind) {
1112
kind instanceof ExternalStringKind
@@ -46,3 +47,16 @@ class DictSource extends TaintSource {
4647
}
4748

4849

50+
class ExceptionInfoSource extends TaintSource {
51+
52+
ExceptionInfoSource() { this.(NameNode).getId() = "TAINTED_EXCEPTION_INFO" }
53+
54+
override predicate isSourceOf(TaintKind kind) {
55+
kind instanceof ExceptionInfo
56+
}
57+
58+
override string toString() {
59+
result = "Exception info source"
60+
}
61+
62+
}

python/ql/test/library-tests/taint/strings/TestNode.expected

Lines changed: 0 additions & 43 deletions
This file was deleted.

python/ql/test/library-tests/taint/strings/TestNode.ql

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)