Skip to content

Commit 5ba8e10

Browse files
committed
Python: Adopt tests to new DataflowQueryTest
Since we want to know the _sinks_ and not just the flow, we need to expose the config as well :|
1 parent 6961ca5 commit 5ba8e10

File tree

9 files changed

+8
-21
lines changed

9 files changed

+8
-21
lines changed

python/ql/lib/semmle/python/security/dataflow/CommandInjectionQuery.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ deprecated class Configuration extends TaintTracking::Configuration {
3030
}
3131
}
3232

33-
private module CommandInjectionConfig implements DataFlow::ConfigSig {
33+
module CommandInjectionConfig implements DataFlow::ConfigSig {
3434
predicate isSource(DataFlow::Node source) { source instanceof Source }
3535

3636
predicate isSink(DataFlow::Node sink) { sink instanceof Sink }

python/ql/lib/semmle/python/security/dataflow/PathInjectionQuery.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class NormalizedUnchecked extends DataFlow::FlowState {
8888
*
8989
* Such checks are ineffective in the `NotNormalized` state.
9090
*/
91-
private module PathInjectionConfig implements DataFlow::StateConfigSig {
91+
module PathInjectionConfig implements DataFlow::StateConfigSig {
9292
class FlowState = DataFlow::FlowState;
9393

9494
predicate isSource(DataFlow::Node source, FlowState state) {

python/ql/lib/semmle/python/security/dataflow/UnsafeShellCommandConstructionQuery.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ deprecated class Configuration extends TaintTracking::Configuration {
3535
}
3636
}
3737

38-
private module UnsafeShellCommandConstructionConfig implements DataFlow::ConfigSig {
38+
module UnsafeShellCommandConstructionConfig implements DataFlow::ConfigSig {
3939
predicate isSource(DataFlow::Node source) { source instanceof Source }
4040

4141
predicate isSink(DataFlow::Node sink) { sink instanceof Sink }

python/ql/src/experimental/Security/UnsafeUnpackQuery.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class AllTarfileOpens extends API::CallNode {
3939
}
4040
}
4141

42-
private module UnsafeUnpackConfig implements DataFlow::ConfigSig {
42+
module UnsafeUnpackConfig implements DataFlow::ConfigSig {
4343
predicate isSource(DataFlow::Node source) {
4444
// A source coming from a remote location
4545
source instanceof RemoteFlowSource
Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
11
missingAnnotationOnSink
22
testFailures
3-
| UnsafeUnpack.py:19:59:19:71 | Comment # $result=BAD | Missing result:result=BAD |
4-
| UnsafeUnpack.py:34:52:34:64 | Comment # $result=BAD | Missing result:result=BAD |
5-
| UnsafeUnpack.py:48:50:48:62 | Comment # $result=BAD | Missing result:result=BAD |
6-
| UnsafeUnpack.py:52:50:52:62 | Comment # $result=BAD | Missing result:result=BAD |
7-
| UnsafeUnpack.py:66:50:66:62 | Comment # $result=BAD | Missing result:result=BAD |
8-
| UnsafeUnpack.py:87:42:87:54 | Comment # $result=BAD | Missing result:result=BAD |
9-
| UnsafeUnpack.py:105:55:105:67 | Comment # $result=BAD | Missing result:result=BAD |
10-
| UnsafeUnpack.py:112:56:112:68 | Comment # $result=BAD | Missing result:result=BAD |
11-
| UnsafeUnpack.py:120:71:120:83 | Comment # $result=BAD | Missing result:result=BAD |
12-
| UnsafeUnpack.py:142:54:142:66 | Comment # $result=BAD | Missing result:result=BAD |
13-
| UnsafeUnpack.py:167:75:167:90 | Comment # $result=BAD | Missing result:result=BAD |
14-
| UnsafeUnpack.py:176:64:176:76 | Comment # $result=BAD | Missing result:result=BAD |
15-
| UnsafeUnpack.py:201:47:201:59 | Comment # $result=BAD | Missing result:result=BAD |
163
failures
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import python
22
import experimental.dataflow.TestUtil.DataflowQueryTest
33
import experimental.Security.UnsafeUnpackQuery
4-
import FromLegacyConfiguration<UnsafeUnpackingConfig>
4+
import FromTaintTrackingConfig<UnsafeUnpackConfig>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import python
22
import experimental.dataflow.TestUtil.DataflowQueryTest
33
import semmle.python.security.dataflow.PathInjectionQuery
4-
import FromLegacyConfiguration<Configuration>
4+
import FromTaintTrackingStateConfig<PathInjectionConfig>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import python
22
import experimental.dataflow.TestUtil.DataflowQueryTest
33
import semmle.python.security.dataflow.CommandInjectionQuery
4-
import FromLegacyConfiguration<Configuration>
4+
import FromTaintTrackingConfig<CommandInjectionConfig>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import python
22
import experimental.dataflow.TestUtil.DataflowQueryTest
33
import semmle.python.security.dataflow.UnsafeShellCommandConstructionQuery
4-
import FromLegacyConfiguration<Configuration>
4+
import FromTaintTrackingConfig<UnsafeShellCommandConstructionConfig>

0 commit comments

Comments
 (0)