File tree Expand file tree Collapse file tree 3 files changed +11
-10
lines changed
test/query-tests/Security/CWE-022 Expand file tree Collapse file tree 3 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -124,8 +124,16 @@ class TarFileInfoSanitizer extends Sanitizer {
124
124
/** The test `if <path_sanitizing_test>:` clears taint on its `false` edge. */
125
125
override predicate sanitizingEdge ( TaintKind taint , PyEdgeRefinement test ) {
126
126
taint instanceof TarFileInfo and
127
- path_sanitizing_test ( test .getTest ( ) ) and
128
- test .getSense ( ) = false
127
+ clears_taint_on_false_edge ( test .getTest ( ) , test .getSense ( ) )
128
+ }
129
+
130
+ private predicate clears_taint_on_false_edge ( ControlFlowNode test , boolean sense ) {
131
+ path_sanitizing_test ( test ) and
132
+ sense = false
133
+ or
134
+ // handle `not` (also nested)
135
+ test .( UnaryExprNode ) .getNode ( ) .getOp ( ) instanceof Not and
136
+ clears_taint_on_false_edge ( test .( UnaryExprNode ) .getOperand ( ) , sense .booleanNot ( ) )
129
137
}
130
138
}
131
139
Original file line number Diff line number Diff line change 21
21
| tarslip.py:57:1:57:17 | tarfile.entry | tarslip.py:59:21:59:25 | tarfile.entry |
22
22
| tarslip.py:57:14:57:16 | tarfile.open | tarslip.py:57:1:57:17 | tarfile.entry |
23
23
| tarslip.py:57:14:57:16 | tarfile.open | tarslip.py:57:1:57:17 | tarfile.entry |
24
- | tarslip.py:63:7:63:39 | tarfile.open | tarslip.py:64:14:64:16 | tarfile.open |
25
- | tarslip.py:63:7:63:39 | tarfile.open | tarslip.py:64:14:64:16 | tarfile.open |
26
- | tarslip.py:64:1:64:17 | tarfile.entry | tarslip.py:68:21:68:25 | tarfile.entry |
27
- | tarslip.py:64:1:64:17 | tarfile.entry | tarslip.py:68:21:68:25 | tarfile.entry |
28
- | tarslip.py:64:14:64:16 | tarfile.open | tarslip.py:64:1:64:17 | tarfile.entry |
29
- | tarslip.py:64:14:64:16 | tarfile.open | tarslip.py:64:1:64:17 | tarfile.entry |
30
24
#select
31
25
| tarslip.py:13:1:13:3 | tar | tarslip.py:12:7:12:39 | tarfile.open | tarslip.py:13:1:13:3 | tarfile.open | Extraction of tarfile from $@ | tarslip.py:12:7:12:39 | Attribute() | a potentially untrusted source |
32
26
| tarslip.py:18:17:18:21 | entry | tarslip.py:16:7:16:39 | tarfile.open | tarslip.py:18:17:18:21 | tarfile.entry | Extraction of tarfile from $@ | tarslip.py:16:7:16:39 | Attribute() | a potentially untrusted source |
33
27
| tarslip.py:37:17:37:21 | entry | tarslip.py:33:7:33:39 | tarfile.open | tarslip.py:37:17:37:21 | tarfile.entry | Extraction of tarfile from $@ | tarslip.py:33:7:33:39 | Attribute() | a potentially untrusted source |
34
28
| tarslip.py:41:24:41:26 | tar | tarslip.py:40:7:40:39 | tarfile.open | tarslip.py:41:24:41:26 | tarfile.open | Extraction of tarfile from $@ | tarslip.py:40:7:40:39 | Attribute() | a potentially untrusted source |
35
29
| tarslip.py:59:21:59:25 | entry | tarslip.py:56:7:56:39 | tarfile.open | tarslip.py:59:21:59:25 | tarfile.entry | Extraction of tarfile from $@ | tarslip.py:56:7:56:39 | Attribute() | a potentially untrusted source |
36
- | tarslip.py:68:21:68:25 | entry | tarslip.py:63:7:63:39 | tarfile.open | tarslip.py:68:21:68:25 | tarfile.entry | Extraction of tarfile from $@ | tarslip.py:63:7:63:39 | Attribute() | a potentially untrusted source |
Original file line number Diff line number Diff line change @@ -65,4 +65,4 @@ def safemembers(members):
65
65
# using `if not (os.path.isabs(entry.name) or ".." in entry.name):`
66
66
# would make the sanitizer work, but for the wrong reasons since out library is a bit broken.
67
67
if not os .path .isabs (entry .name ):
68
- tar .extract (entry , "/tmp/unpack/" ) # TODO: FP
68
+ tar .extract (entry , "/tmp/unpack/" )
You can’t perform that action at this time.
0 commit comments