Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java/C#: Move test utilities to the query pack. #17968

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
query: experimental/Security Features/CWE-759/HashWithoutSalt.ql
postprocess: TestUtilities/PrettyPrintModels.ql
postprocess: utils/test/PrettyPrintModels.ql
2 changes: 1 addition & 1 deletion csharp/ql/test/library-tests/dataflow/async/Async.ql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import csharp
import TestUtilities.ProvenancePathGraph::ShowProvenance<Taint::PathNode, Taint::PathGraph>
import utils.test.ProvenancePathGraph::ShowProvenance<Taint::PathNode, Taint::PathGraph>

class MySink extends DataFlow::ExprNode {
MySink() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class StringConstCompareBarrier extends DataFlow::Node {
}
}

import TestUtilities.InlineFlowTest
import utils.test.InlineFlowTest
import PathGraph

module FlowConfig implements DataFlow::ConfigSig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import csharp
import TestUtilities.ProvenancePathGraph::ShowProvenance<ArrayFlow::PathNode, ArrayFlow::PathGraph>
import utils.test.ProvenancePathGraph::ShowProvenance<ArrayFlow::PathNode, ArrayFlow::PathGraph>

module ArrayFlowConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node src) { src.asExpr() instanceof ObjectCreation }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import csharp
import TestUtilities.InlineFlowTest
import utils.test.InlineFlowTest
import ValueFlowTest<DefaultFlowConfig>
import PathGraph

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import csharp
import semmle.code.csharp.dataflow.internal.ExternalFlow
import TestUtilities.ProvenancePathGraph::ShowProvenance<Taint::PathNode, Taint::PathGraph>
import utils.test.ProvenancePathGraph::ShowProvenance<Taint::PathNode, Taint::PathGraph>
import ModelValidation

module TaintConfig implements DataFlow::ConfigSig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import csharp
import TestUtilities.InlineFlowTest
import utils.test.InlineFlowTest
import DefaultFlowTest
import PathGraph

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import csharp
import semmle.code.csharp.security.dataflow.flowsources.FlowSources
import TestUtilities.InlineFlowTest
import utils.test.InlineFlowTest
import TaintFlowTest<DatabaseConfig>

module DatabaseConfig implements DataFlow::ConfigSig {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import csharp
import semmle.code.csharp.security.dataflow.flowsources.FlowSources
import TestUtilities.InlineFlowTest
import utils.test.InlineFlowTest
import TaintFlowTest<FilesConfig>

module FilesConfig implements DataFlow::ConfigSig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import csharp
import Common
import TestUtilities.ProvenancePathGraph::ShowProvenance<Flow::PathNode, Flow::PathGraph>
import utils.test.ProvenancePathGraph::ShowProvenance<Flow::PathNode, Flow::PathGraph>

from Flow::PathNode source, Flow::PathNode sink, string s
where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import csharp
import Common
import TestUtilities.ProvenancePathGraph::ShowProvenance<Taint::PathNode, Taint::PathGraph>
import utils.test.ProvenancePathGraph::ShowProvenance<Taint::PathNode, Taint::PathGraph>

module Taint = TaintTracking::Global<FlowConfig>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import csharp
import TestUtilities.InlineFlowTest
import utils.test.InlineFlowTest
import DefaultFlowTest
import PathGraph

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import csharp
import TestUtilities.InlineFlowTest
import utils.test.InlineFlowTest
import DefaultFlowTest
import PathGraph

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import Test
import TestUtilities.ProvenancePathGraph::ShowProvenance<ThreatModel::PathNode, ThreatModel::PathGraph>
import utils.test.ProvenancePathGraph::ShowProvenance<ThreatModel::PathNode, ThreatModel::PathGraph>

from ThreatModel::PathNode source, ThreatModel::PathNode sink
where ThreatModel::flowPath(source, sink)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import Test
import TestUtilities.ProvenancePathGraph::ShowProvenance<ThreatModel::PathNode, ThreatModel::PathGraph>
import utils.test.ProvenancePathGraph::ShowProvenance<ThreatModel::PathNode, ThreatModel::PathGraph>

from ThreatModel::PathNode source, ThreatModel::PathNode sink
where ThreatModel::flowPath(source, sink)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import Test
import TestUtilities.ProvenancePathGraph::ShowProvenance<ThreatModel::PathNode, ThreatModel::PathGraph>
import utils.test.ProvenancePathGraph::ShowProvenance<ThreatModel::PathNode, ThreatModel::PathGraph>

from ThreatModel::PathNode source, ThreatModel::PathNode sink
where ThreatModel::flowPath(source, sink)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import Test
import TestUtilities.ProvenancePathGraph::ShowProvenance<ThreatModel::PathNode, ThreatModel::PathGraph>
import utils.test.ProvenancePathGraph::ShowProvenance<ThreatModel::PathNode, ThreatModel::PathGraph>

from ThreatModel::PathNode source, ThreatModel::PathNode sink
where ThreatModel::flowPath(source, sink)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import Test
import TestUtilities.ProvenancePathGraph::ShowProvenance<ThreatModel::PathNode, ThreatModel::PathGraph>
import utils.test.ProvenancePathGraph::ShowProvenance<ThreatModel::PathNode, ThreatModel::PathGraph>

from ThreatModel::PathNode source, ThreatModel::PathNode sink
where ThreatModel::flowPath(source, sink)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import Test
import TestUtilities.ProvenancePathGraph::ShowProvenance<ThreatModel::PathNode, ThreatModel::PathGraph>
import utils.test.ProvenancePathGraph::ShowProvenance<ThreatModel::PathNode, ThreatModel::PathGraph>

from ThreatModel::PathNode source, ThreatModel::PathNode sink
where ThreatModel::flowPath(source, sink)
Expand Down
2 changes: 1 addition & 1 deletion csharp/ql/test/library-tests/dataflow/tuples/Tuples.ql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import csharp
import TestUtilities.InlineFlowTest
import utils.test.InlineFlowTest
import DefaultFlowTest
import PathGraph

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import csharp
import TestUtilities.InlineFlowTest
import utils.test.InlineFlowTest
import DefaultFlowTest
import PathGraph

Expand Down
2 changes: 1 addition & 1 deletion csharp/ql/test/library-tests/dataflow/types/Types.ql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import csharp
import TestUtilities.InlineFlowTest
import utils.test.InlineFlowTest
import PathGraph

module TypesConfig implements DataFlow::ConfigSig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import csharp
import TestUtilities.ProvenancePathGraph::ShowProvenance<Taint::PathNode, Taint::PathGraph>
import utils.test.ProvenancePathGraph::ShowProvenance<Taint::PathNode, Taint::PathGraph>

module TaintConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node node) { node.asExpr().getValue() = "tainted" }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
query: Security Features/CWE-020/UntrustedDataToExternalAPI.ql
postprocess: TestUtilities/PrettyPrintModels.ql
postprocess: utils/test/PrettyPrintModels.ql
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
query: Security Features/CWE-022/TaintedPath.ql
postprocess: TestUtilities/PrettyPrintModels.ql
postprocess: utils/test/PrettyPrintModels.ql

Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
query: Security Features/CWE-022/ZipSlip.ql
postprocess: TestUtilities/PrettyPrintModels.ql
postprocess: utils/test/PrettyPrintModels.ql
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
query: Security Features/CWE-078/CommandInjection.ql
postprocess: TestUtilities/PrettyPrintModels.ql
postprocess: utils/test/PrettyPrintModels.ql
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
query: Security Features/CWE-079/XSS.ql
postprocess: TestUtilities/PrettyPrintModels.ql
postprocess: utils/test/PrettyPrintModels.ql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
query: Security Features/CWE-079/XSS.ql
postprocess:
- TestUtilities/PrettyPrintModels.ql
- TestUtilities/InlineExpectationsTestQuery.ql
- utils/test/PrettyPrintModels.ql
- utils/test/InlineExpectationsTestQuery.ql
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
query: Security Features/CWE-079/XSS.ql
postprocess: TestUtilities/PrettyPrintModels.ql
postprocess: utils/test/PrettyPrintModels.ql
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
query: Security Features/CWE-089/SqlInjection.ql
postprocess: TestUtilities/PrettyPrintModels.ql
postprocess: utils/test/PrettyPrintModels.ql
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
query: Security Features/CWE-090/LDAPInjection.ql
postprocess: TestUtilities/PrettyPrintModels.ql
postprocess: utils/test/PrettyPrintModels.ql
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
query: Security Features/CWE-091/XMLInjection.ql
postprocess: TestUtilities/PrettyPrintModels.ql
postprocess: utils/test/PrettyPrintModels.ql
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
query: Security Features/CWE-094/CodeInjection.ql
postprocess: TestUtilities/PrettyPrintModels.ql
postprocess: utils/test/PrettyPrintModels.ql
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
query: Security Features/CWE-099/ResourceInjection.ql
postprocess: TestUtilities/PrettyPrintModels.ql
postprocess: utils/test/PrettyPrintModels.ql
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
query: Security Features/CWE-112/MissingXMLValidation.ql
postprocess: TestUtilities/PrettyPrintModels.ql
postprocess: utils/test/PrettyPrintModels.ql
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
query: Security Features/CWE-114/AssemblyPathInjection.ql
postprocess: TestUtilities/PrettyPrintModels.ql
postprocess: utils/test/PrettyPrintModels.ql
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
query: Security Features/CWE-117/LogForging.ql
postprocess: TestUtilities/PrettyPrintModels.ql
postprocess: utils/test/PrettyPrintModels.ql
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
query: Security Features/CWE-134/UncontrolledFormatString.ql
postprocess: TestUtilities/PrettyPrintModels.ql
postprocess: utils/test/PrettyPrintModels.ql
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
query: Security Features/CWE-201/ExposureInTransmittedData.ql
postprocess: TestUtilities/PrettyPrintModels.ql
postprocess: utils/test/PrettyPrintModels.ql
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
query: Security Features/CWE-209/ExceptionInformationExposure.ql
postprocess: TestUtilities/PrettyPrintModels.ql
postprocess: utils/test/PrettyPrintModels.ql
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
query: Security Features/CWE-321/HardcodedEncryptionKey.ql
postprocess: TestUtilities/PrettyPrintModels.ql
postprocess: utils/test/PrettyPrintModels.ql
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
query: Security Features/InsecureRandomness.ql
postprocess: TestUtilities/PrettyPrintModels.ql
postprocess: utils/test/PrettyPrintModels.ql
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
query: Security Features/CWE-502/UnsafeDeserializationUntrustedInput.ql
postprocess: TestUtilities/PrettyPrintModels.ql
postprocess: utils/test/PrettyPrintModels.ql
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
query: Security Features/CWE-502/UnsafeDeserializationUntrustedInput.ql
postprocess: TestUtilities/PrettyPrintModels.ql
postprocess: utils/test/PrettyPrintModels.ql
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
query: Security Features/CWE-601/UrlRedirect.ql
postprocess: TestUtilities/PrettyPrintModels.ql
postprocess: utils/test/PrettyPrintModels.ql
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
query: Security Features/CWE-611/UntrustedDataInsecureXml.ql
postprocess: TestUtilities/PrettyPrintModels.ql
postprocess: utils/test/PrettyPrintModels.ql
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
query: Security Features/CWE-611/UseXmlSecureResolver.ql
postprocess: TestUtilities/PrettyPrintModels.ql
postprocess: utils/test/PrettyPrintModels.ql
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
query: Security Features/CWE-643/XPathInjection.ql
postprocess: TestUtilities/PrettyPrintModels.ql
postprocess: utils/test/PrettyPrintModels.ql
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
query: Security Features/CWE-730/ReDoS.ql
postprocess: TestUtilities/PrettyPrintModels.ql
postprocess: utils/test/PrettyPrintModels.ql
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
query: Security Features/CWE-730/ReDoS.ql
postprocess: TestUtilities/PrettyPrintModels.ql
postprocess: utils/test/PrettyPrintModels.ql
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
query: Security Features/CWE-730/RegexInjection.ql
postprocess: TestUtilities/PrettyPrintModels.ql
postprocess: utils/test/PrettyPrintModels.ql
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
query: Security Features/CWE-807/ConditionalBypass.ql
postprocess: TestUtilities/PrettyPrintModels.ql
postprocess: utils/test/PrettyPrintModels.ql
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
query: Security Features/CWE-838/InappropriateEncoding.ql
postprocess: TestUtilities/PrettyPrintModels.ql
postprocess: utils/test/PrettyPrintModels.ql
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
query: Useless code/UnusedLabel.ql
postprocess: TestUtilities/InlineExpectationsTestQuery.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql
2 changes: 2 additions & 0 deletions csharp/ql/test/utils/inline-tests/PathProblemQuery.qlref
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
query: utils/inline-tests/queries/PathProblemQuery.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql
2 changes: 2 additions & 0 deletions csharp/ql/test/utils/inline-tests/ProblemQuery.qlref
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
query: utils/inline-tests/queries/ProblemQuery.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import csharp
import utils.modelgenerator.internal.CaptureModels
import TestUtilities.InlineMadTest
import utils.test.InlineMadTest

module InlineMadTestConfig implements InlineMadTestConfigSig {
string getCapturedModel(Callable c) { result = ContentSensitive::captureFlow(c, _) }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import csharp
import utils.modelgenerator.internal.CaptureModels
import TestUtilities.InlineMadTest
import utils.test.InlineMadTest

module InlineMadTestConfig implements InlineMadTestConfigSig {
string getCapturedModel(Callable c) { result = captureNoFlow(c) }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import csharp
import utils.modelgenerator.internal.CaptureModels
import TestUtilities.InlineMadTest
import utils.test.InlineMadTest

module InlineMadTestConfig implements InlineMadTestConfigSig {
string getCapturedModel(Callable c) { result = captureSink(c) }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import csharp
import utils.modelgenerator.internal.CaptureModels
import TestUtilities.InlineMadTest
import utils.test.InlineMadTest

module InlineMadTestConfig implements InlineMadTestConfigSig {
string getCapturedModel(Callable c) { result = captureSource(c) }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import csharp
import utils.modelgenerator.internal.CaptureModels
import TestUtilities.InlineMadTest
import utils.test.InlineMadTest

module InlineMadTestConfig implements InlineMadTestConfigSig {
string getCapturedModel(Callable c) { result = captureFlow(c) }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import csharp
import TestUtilities.InlineMadTest
import utils.test.InlineMadTest
import utils.modelgenerator.internal.CaptureTypeBasedSummaryModels

module InlineMadTestConfig implements InlineMadTestConfigSig {
Expand Down
Loading
Loading