Skip to content

Commit 13ff941

Browse files
authored
Merge pull request #16252 from RasmusWL/move-dataflow-tests
Python: Move dataflow tests out of experimental
2 parents 9d24b5a + 1bc085c commit 13ff941

File tree

284 files changed

+50
-50
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

284 files changed

+50
-50
lines changed

config/identical-files.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@
362362
"java/ql/lib/semmle/code/java/security/internal/EncryptionKeySizes.qll"
363363
],
364364
"Python model summaries test extension": [
365-
"python/ql/test/experimental/dataflow/model-summaries/InlineTaintTest.ext.yml",
366-
"python/ql/test/experimental/dataflow/model-summaries/NormalDataflowTest.ext.yml"
365+
"python/ql/test/library-tests/dataflow/model-summaries/InlineTaintTest.ext.yml",
366+
"python/ql/test/library-tests/dataflow/model-summaries/NormalDataflowTest.ext.yml"
367367
]
368-
}
368+
}

python/ql/lib/semmle/python/dataflow/new/SensitiveDataSources.qll

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ private module SensitiveDataModeling {
8989
*/
9090
DataFlow::Node sensitiveLookupStringConst(SensitiveDataClassification classification) {
9191
// Note: If this is implemented with type-tracking, we will get cross-talk as
92-
// illustrated in python/ql/test/experimental/dataflow/sensitive-data/test.py
92+
// illustrated in python/ql/test/library-tests/dataflow/sensitive-data/test.py
9393
exists(DataFlow::LocalSourceNode source |
9494
source.asExpr().(StringLiteral).getText() = sensitiveString(classification) and
9595
source.flowsTo(result)

python/ql/lib/semmle/python/dataflow/new/internal/DataFlowPublic.qll

+1-1
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ newtype TContent =
638638
// name = any(AccessPathToken a).getAnArgument("Attribute")
639639
// instead we use a qltest to alert if we write a new summary in QL that uses an
640640
// attribute -- see
641-
// python/ql/test/experimental/dataflow/summaries-checks/missing-attribute-content.ql
641+
// python/ql/test/library-tests/dataflow/summaries-checks/missing-attribute-content.ql
642642
attr in ["re", "string", "pattern"]
643643
or
644644
//

python/ql/test/experimental/dataflow/TestUtil/NormalDataflowTest.qll renamed to python/ql/test/TestUtilities/dataflow/NormalDataflowTest.qll

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import python
2-
import experimental.dataflow.TestUtil.FlowTest
3-
import experimental.dataflow.testConfig
2+
import TestUtilities.dataflow.FlowTest
3+
import TestUtilities.dataflow.testConfig
44
private import semmle.python.dataflow.new.internal.PrintNode
55

66
module DataFlowTest implements FlowTestSig {

python/ql/test/experimental/dataflow/TestUtil/NormalTaintTrackingTest.qll renamed to python/ql/test/TestUtilities/dataflow/NormalTaintTrackingTest.qll

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import python
2-
import experimental.dataflow.TestUtil.FlowTest
3-
import experimental.dataflow.testTaintConfig
2+
import TestUtilities.dataflow.FlowTest
3+
import TestUtilities.dataflow.testTaintConfig
44
private import semmle.python.dataflow.new.internal.PrintNode
55

66
module DataFlowTest implements FlowTestSig {

python/ql/test/experimental/dataflow/basic/localFlowStepTest.ql

-1
This file was deleted.

python/ql/test/experimental/dataflow/basic/maximalFlowTest.ql

-1
This file was deleted.

python/ql/test/experimental/dataflow/coverage/NormalDataflowTest.ql

-2
This file was deleted.

python/ql/test/experimental/dataflow/exceptions/NormalDataflowTest.ql

-2
This file was deleted.

python/ql/test/experimental/dataflow/fieldflow/NormalDataflowTest.ql

-2
This file was deleted.

python/ql/test/experimental/dataflow/match/NormalDataflowTest.ql

-2
This file was deleted.

python/ql/test/experimental/dataflow/model-summaries/NormalDataflowTest.ql

-2
This file was deleted.

python/ql/test/experimental/dataflow/summaries/NormalTaintTrackingTest.ql

-3
This file was deleted.

python/ql/test/experimental/dataflow/tainttracking/generator-flow/NormalDataflowTest.ql

-2
This file was deleted.

python/ql/test/experimental/meta/debug/dataflowTestPaths.ql

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// 3. if necessary, look at partial paths by (un)commenting appropriate lines
1010
import python
1111
import semmle.python.dataflow.new.DataFlow
12-
import experimental.dataflow.testConfig
12+
import TestUtilities.dataflow.testConfig
1313

1414
module Config implements DataFlow::ConfigSig {
1515
predicate isSource(DataFlow::Node source) { TestConfig::isSource(source) }
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import python
2-
import experimental.dataflow.TestUtil.DataflowQueryTest
2+
import TestUtilities.dataflow.DataflowQueryTest
33
import experimental.Security.UnsafeUnpackQuery
44
import FromTaintTrackingConfig<UnsafeUnpackConfig>
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import python
2-
import experimental.dataflow.TestUtil.DataflowQueryTest
2+
import TestUtilities.dataflow.DataflowQueryTest
33
import experimental.semmle.python.security.DecompressionBomb
44
import FromTaintTrackingConfig<BombsConfig>

python/ql/test/experimental/dataflow/basic/callGraph.ql renamed to python/ql/test/library-tests/dataflow/basic/callGraph.ql

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import experimental.dataflow.callGraphConfig
1+
import TestUtilities.dataflow.callGraphConfig
22

33
from DataFlow::Node source, DataFlow::Node sink
44
where

python/ql/test/experimental/dataflow/basic/callGraphSinks.ql renamed to python/ql/test/library-tests/dataflow/basic/callGraphSinks.ql

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import experimental.dataflow.callGraphConfig
1+
import TestUtilities.dataflow.callGraphConfig
22

33
from DataFlow::Node sink
44
where

python/ql/test/experimental/dataflow/basic/callGraphSources.ql renamed to python/ql/test/library-tests/dataflow/basic/callGraphSources.ql

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import experimental.dataflow.callGraphConfig
1+
import TestUtilities.dataflow.callGraphConfig
22

33
from DataFlow::Node source
44
where
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import TestUtilities.dataflow.LocalFlowStepTest
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import TestUtilities.dataflow.MaximalFlowTest
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import python
2+
import TestUtilities.dataflow.NormalDataflowTest

python/ql/test/experimental/dataflow/coverage/argumentRoutingTest.ql renamed to python/ql/test/library-tests/dataflow/coverage/argumentRoutingTest.ql

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import python
22
import semmle.python.dataflow.new.DataFlow
33
private import semmle.python.dataflow.new.internal.DataFlowPrivate as DataFlowPrivate
4-
import experimental.dataflow.TestUtil.RoutingTest
4+
import TestUtilities.dataflow.RoutingTest
55

66
module Argument1RoutingTest implements RoutingTestSig {
77
class Argument = Unit;

python/ql/test/experimental/dataflow/coverage/datamodel.py renamed to python/ql/test/library-tests/dataflow/coverage/datamodel.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# A thorough covering of methods in that document is found in classes.py.
77
#
88
# Intended sources should be the variable `SOURCE` and intended sinks should be
9-
# arguments to the function `SINK` (see python/ql/test/experimental/dataflow/testConfig.qll).
9+
# arguments to the function `SINK` (see python/ql/test/library-tests/dataflow/testConfig.qll).
1010

1111
import sys
1212
import os

python/ql/test/experimental/dataflow/coverage/test.py renamed to python/ql/test/library-tests/dataflow/coverage/test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Headings refer to https://docs.python.org/3/reference/expressions.html,
33
# and are selected whenever they incur dataflow.
44
# Intended sources should be the variable `SOURCE` and intended sinks should be
5-
# arguments to the function `SINK` (see python/ql/test/experimental/dataflow/testConfig.qll).
5+
# arguments to the function `SINK` (see python/ql/test/library-tests/dataflow/testConfig.qll).
66
#
77
# Functions whose name ends with "_with_local_flow" will also be tested for local flow.
88
#
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import python
2+
import TestUtilities.dataflow.NormalDataflowTest
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import python
2+
import TestUtilities.dataflow.NormalDataflowTest

python/ql/test/experimental/dataflow/fieldflow/UnresolvedCalls.ql renamed to python/ql/test/library-tests/dataflow/fieldflow/UnresolvedCalls.ql

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import python
2-
import experimental.dataflow.TestUtil.UnresolvedCalls
2+
import TestUtilities.dataflow.UnresolvedCalls
33
private import semmle.python.dataflow.new.DataFlow
44

55
module IgnoreDictMethod implements UnresolvedCallExpectationsSig {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import python
2+
import TestUtilities.dataflow.NormalDataflowTest
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import python
2+
import TestUtilities.dataflow.NormalDataflowTest

python/ql/test/experimental/dataflow/module-initialization/localFlow.ql renamed to python/ql/test/library-tests/dataflow/module-initialization/localFlow.ql

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// This query should be more focused yet.
22
import python
3-
import experimental.dataflow.TestUtil.FlowTest
3+
import TestUtilities.dataflow.FlowTest
44
private import semmle.python.dataflow.new.internal.PrintNode
55
private import semmle.python.dataflow.new.internal.DataFlowPrivate as DP
66

python/ql/test/experimental/dataflow/path-graph/PathNodes.ql renamed to python/ql/test/library-tests/dataflow/path-graph/PathNodes.ql

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import python
66
import semmle.python.dataflow.new.DataFlow
77
import semmle.python.dataflow.new.TaintTracking
8-
import experimental.dataflow.testConfig
8+
import TestUtilities.dataflow.testConfig
99
import TestUtilities.InlineExpectationsTest
1010

1111
module TestTaintFlow = TaintTracking::Global<TestConfig>;

python/ql/test/experimental/dataflow/regression/dataflow.ql renamed to python/ql/test/library-tests/dataflow/regression/dataflow.ql

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
import python
9-
import experimental.dataflow.testConfig
9+
import TestUtilities.dataflow.testConfig
1010

1111
from DataFlow::Node source, DataFlow::Node sink
1212
where TestFlow::flow(source, sink)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import python
2+
private import TestSummaries
3+
import TestUtilities.dataflow.NormalTaintTrackingTest

python/ql/test/experimental/dataflow/summaries/summaries.ql renamed to python/ql/test/library-tests/dataflow/summaries/summaries.ql

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import TestFlow::PathGraph
88
import semmle.python.dataflow.new.TaintTracking
99
import semmle.python.dataflow.new.internal.FlowSummaryImpl
1010
import semmle.python.ApiGraphs
11-
import experimental.dataflow.testTaintConfig
11+
import TestUtilities.dataflow.testTaintConfig
1212
private import TestSummaries
1313

1414
query predicate invalidSpecComponent(SummarizedCallable sc, string s, string c) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import python
2+
import TestUtilities.dataflow.NormalDataflowTest

python/ql/test/experimental/dataflow/variable-capture/CaptureTest.ql renamed to python/ql/test/library-tests/dataflow/variable-capture/CaptureTest.ql

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import python
22
import semmle.python.dataflow.new.DataFlow
33
import TestUtilities.InlineExpectationsTest
4-
import experimental.dataflow.testConfig
4+
import TestUtilities.dataflow.testConfig
55

66
module CaptureTest implements TestSig {
77
string getARelevantTag() { result = "captured" }
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
import python
2-
import experimental.dataflow.TestUtil.NormalDataflowTest
2+
import TestUtilities.dataflow.NormalDataflowTest
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import base64
22

3-
# TODO: These tests should be merged with python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep-py3/test_string.py
3+
# TODO: These tests should be merged with python/ql/test/library-tests/dataflow/tainttracking/defaultAdditionalTaintStep-py3/test_string.py
44
base64.a85decode(payload) # $ decodeInput=payload decodeOutput=base64.a85decode(..) decodeFormat=Ascii85
55
base64.b85decode(payload) # $ decodeInput=payload decodeOutput=base64.b85decode(..) decodeFormat=Base85
66
base64.decodebytes(payload) # $ decodeInput=payload decodeOutput=base64.decodebytes(..) decodeFormat=Base64
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import base64
22

3-
# TODO: These tests should be merged with python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep-py3/test_string.py
3+
# TODO: These tests should be merged with python/ql/test/library-tests/dataflow/tainttracking/defaultAdditionalTaintStep-py3/test_string.py
44
base64.a85encode(bs) # $ encodeInput=bs encodeOutput=base64.a85encode(..) encodeFormat=Ascii85
55
base64.b85encode(bs)# $ encodeInput=bs encodeOutput=base64.b85encode(..) encodeFormat=Base85
66
base64.encodebytes(bs)# $ encodeInput=bs encodeOutput=base64.encodebytes(..) encodeFormat=Base64

python/ql/test/library-tests/frameworks/stdlib/Decoding.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
shelve.open(filepath) # $ decodeInput=filepath decodeOutput=shelve.open(..) decodeFormat=pickle decodeMayExecuteInput getAPathArgument=filepath
2727
shelve.open(filename=filepath) # $ decodeInput=filepath decodeOutput=shelve.open(..) decodeFormat=pickle decodeMayExecuteInput getAPathArgument=filepath
2828

29-
# TODO: These tests should be merged with python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep/test_string.py
29+
# TODO: These tests should be merged with python/ql/test/library-tests/dataflow/tainttracking/defaultAdditionalTaintStep/test_string.py
3030
base64.b64decode(payload) # $ decodeInput=payload decodeOutput=base64.b64decode(..) decodeFormat=Base64
3131
base64.standard_b64decode(payload) # $ decodeInput=payload decodeOutput=base64.standard_b64decode(..) decodeFormat=Base64
3232
base64.urlsafe_b64decode(payload) # $ decodeInput=payload decodeOutput=base64.urlsafe_b64decode(..) decodeFormat=Base64

python/ql/test/library-tests/frameworks/stdlib/Encoding.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
pickle.dumps(obj) # $ MISSING: encodeInput=obj encodeOutput=pickle.dumps(..) encodeFormat=pickle encodeMayExecuteInput
66
marshal.dumps(obj) # $ MISSING: encodeInput=obj encodeOutput=marshal.dumps(..) encodeFormat=marshal encodeMayExecuteInput
77

8-
# TODO: These tests should be merged with python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep/test_string.py
8+
# TODO: These tests should be merged with python/ql/test/library-tests/dataflow/tainttracking/defaultAdditionalTaintStep/test_string.py
99
base64.b64encode(bs) # $ encodeInput=bs encodeOutput=base64.b64encode(..) encodeFormat=Base64
1010
base64.standard_b64encode(bs) # $ encodeInput=bs encodeOutput=base64.standard_b64encode(..) encodeFormat=Base64
1111
base64.urlsafe_b64encode(bs) # $ encodeInput=bs encodeOutput=base64.urlsafe_b64encode(..) encodeFormat=Base64
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import python
2-
import experimental.dataflow.TestUtil.DataflowQueryTest
2+
import TestUtilities.dataflow.DataflowQueryTest
33
import semmle.python.security.dataflow.PathInjectionQuery
44
import FromTaintTrackingStateConfig<PathInjectionConfig>
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import python
2-
import experimental.dataflow.TestUtil.DataflowQueryTest
2+
import TestUtilities.dataflow.DataflowQueryTest
33
import semmle.python.security.dataflow.CommandInjectionQuery
44
import FromTaintTrackingConfig<CommandInjectionConfig>
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import python
2-
import experimental.dataflow.TestUtil.DataflowQueryTest
2+
import TestUtilities.dataflow.DataflowQueryTest
33
import semmle.python.security.dataflow.UnsafeShellCommandConstructionQuery
44
import FromTaintTrackingConfig<UnsafeShellCommandConstructionConfig>
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import python
2-
import experimental.dataflow.TestUtil.DataflowQueryTest
2+
import TestUtilities.dataflow.DataflowQueryTest
33
import semmle.python.security.dataflow.NoSqlInjectionQuery
44
import FromTaintTrackingStateConfig<NoSqlInjectionConfig>

0 commit comments

Comments
 (0)