From 771e47048815f010aa8c180b077d5e8bad91e0ce Mon Sep 17 00:00:00 2001 From: Michael Pollmeier Date: Wed, 24 May 2023 08:55:55 +0200 Subject: [PATCH 1/2] cleanup/simplify dependency tree * console shouldn't depend on macros * Query shouldn't live in `macros`, as it's namespace already suggested --- console/build.sbt | 1 - .../src/main/scala/io/joern/console/Query.scala | 0 joern-cli/build.sbt | 5 +++-- macros/build.sbt | 5 ++++- 4 files changed, 7 insertions(+), 4 deletions(-) rename {macros => console}/src/main/scala/io/joern/console/Query.scala (100%) diff --git a/console/build.sbt b/console/build.sbt index fa3031601451..a3a0d94c9244 100644 --- a/console/build.sbt +++ b/console/build.sbt @@ -10,7 +10,6 @@ val ZeroturnaroundVersion = "1.15" dependsOn( Projects.semanticcpg, - Projects.macros, Projects.javasrc2cpg, Projects.jssrc2cpg, Projects.pysrc2cpg, diff --git a/macros/src/main/scala/io/joern/console/Query.scala b/console/src/main/scala/io/joern/console/Query.scala similarity index 100% rename from macros/src/main/scala/io/joern/console/Query.scala rename to console/src/main/scala/io/joern/console/Query.scala diff --git a/joern-cli/build.sbt b/joern-cli/build.sbt index f245e6fa7649..aba4039b1cf8 100644 --- a/joern-cli/build.sbt +++ b/joern-cli/build.sbt @@ -2,9 +2,10 @@ name := "joern-cli" dependsOn( Projects.console, - Projects.console % "test->test", + Projects.macros, Projects.dataflowengineoss, - Projects.x2cpg + Projects.x2cpg, + Projects.console % "test->test" ) libraryDependencies ++= Seq( diff --git a/macros/build.sbt b/macros/build.sbt index a3d5e103c44c..29ca195daf0e 100644 --- a/macros/build.sbt +++ b/macros/build.sbt @@ -3,7 +3,10 @@ name := "macros" scalaVersion := "2.13.8" crossScalaVersions := Seq("2.13.8", "3.2.2") -dependsOn(Projects.semanticcpg % Test) +dependsOn( + Projects.console, + Projects.semanticcpg % Test +) libraryDependencies ++= Seq( "io.shiftleft" %% "codepropertygraph" % Versions.cpg, From b2cfc67a21c182f7eed7335d8d6d9963b84c5cdb Mon Sep 17 00:00:00 2001 From: Michael Pollmeier Date: Wed, 24 May 2023 09:18:10 +0200 Subject: [PATCH 2/2] move querydb classes into querydb namespace: q, Query, QueryDatabase --- .../src/main/scala/io/joern/console/scan/ScanPass.scala | 2 +- .../src/main/scala/io/joern/console/scan/package.scala | 2 +- .../main/scala/io/joern/{console => querydb}/Query.scala | 2 +- .../src/main/scala/io/joern/joerncli/JoernScan.scala | 3 ++- macros/src/main/java/io/joern/{console => querydb}/q.java | 2 +- macros/src/main/scala-2/io/joern/macros/QueryMacros.scala | 2 +- macros/src/main/scala-3/io/joern/macros/QueryMacros.scala | 2 +- .../io/joern/{console => querydb}/QueryDatabase.scala | 2 +- .../src/test/scala/io/joern/macros/QueryMacroTests.scala | 1 + .../joern/{console => querydb}/QueryDatabaseTests.scala | 8 ++++---- querydb/src/main/scala/io/joern/dumpq/Main.scala | 2 +- .../io/joern/scanners/android/ArbitraryFileWrites.scala | 1 + .../scala/io/joern/scanners/android/ExternalStorage.scala | 1 + .../main/scala/io/joern/scanners/android/Intents.scala | 1 + .../io/joern/scanners/android/JavaScriptInterface.scala | 1 + .../io/joern/scanners/android/Misconfigurations.scala | 1 + .../scala/io/joern/scanners/android/RootDetection.scala | 1 + .../io/joern/scanners/android/UnprotectedAppParts.scala | 1 + .../io/joern/scanners/android/UnsafeReflection.scala | 1 + .../src/main/scala/io/joern/scanners/c/CopyLoops.scala | 1 + .../main/scala/io/joern/scanners/c/CredentialDrop.scala | 1 + .../scala/io/joern/scanners/c/DangerousFunctions.scala | 1 + .../src/main/scala/io/joern/scanners/c/FileOpRace.scala | 1 + .../scala/io/joern/scanners/c/HeapBasedOverflow.scala | 1 + .../scala/io/joern/scanners/c/IntegerTruncations.scala | 1 + querydb/src/main/scala/io/joern/scanners/c/Metrics.scala | 1 + .../scala/io/joern/scanners/c/MissingLengthCheck.scala | 1 + .../main/scala/io/joern/scanners/c/NullTermination.scala | 1 + .../scala/io/joern/scanners/c/QueryLangExtensions.scala | 1 + .../src/main/scala/io/joern/scanners/c/RetvalChecks.scala | 1 + .../main/scala/io/joern/scanners/c/SignedLeftShift.scala | 1 + .../src/main/scala/io/joern/scanners/c/SocketApi.scala | 1 + .../src/main/scala/io/joern/scanners/c/UseAfterFree.scala | 1 + .../io/joern/scanners/ghidra/DangerousFunctions.scala | 1 + .../scanners/ghidra/UserInputIntoDangerousFunctions.scala | 1 + .../scala/io/joern/scanners/java/CertificateChecks.scala | 1 + .../scala/io/joern/scanners/java/CrossSiteScripting.scala | 1 + .../scala/io/joern/scanners/java/CryptographyMisuse.scala | 1 + .../scala/io/joern/scanners/java/DangerousFunctions.scala | 1 + .../main/scala/io/joern/scanners/java/SQLInjection.scala | 1 + .../io/joern/scanners/kotlin/NetworkCommunication.scala | 1 + .../scala/io/joern/scanners/kotlin/NetworkProtocols.scala | 1 + .../scala/io/joern/scanners/kotlin/PathTraversals.scala | 1 + .../main/scala/io/joern/scanners/php/SQLInjection.scala | 1 + .../src/main/scala/io/joern/scanners/php/ShellExec.scala | 1 + .../scala/io/joern/scanners/c/QueryWithReachableBy.scala | 2 +- .../test/scala/io/joern/suites/AllBundlesTestSuite.scala | 2 +- .../scala/io/joern/suites/AndroidQueryTestSuite.scala | 2 +- .../src/test/scala/io/joern/suites/CQueryTestSuite.scala | 4 ++-- .../test/scala/io/joern/suites/GhidraQueryTestSuite.scala | 4 ++-- .../test/scala/io/joern/suites/JavaQueryTestSuite.scala | 2 +- .../test/scala/io/joern/suites/KotlinQueryTestSuite.scala | 2 +- .../test/scala/io/joern/suites/QDBArgumentProvider.scala | 2 +- querydb/src/test/scala/io/joern/util/QueryUtil.scala | 4 ++-- 54 files changed, 61 insertions(+), 25 deletions(-) rename console/src/main/scala/io/joern/{console => querydb}/Query.scala (98%) rename macros/src/main/java/io/joern/{console => querydb}/q.java (84%) rename macros/src/main/scala/io/joern/{console => querydb}/QueryDatabase.scala (99%) rename macros/src/test/scala/io/joern/{console => querydb}/QueryDatabaseTests.scala (90%) diff --git a/console/src/main/scala/io/joern/console/scan/ScanPass.scala b/console/src/main/scala/io/joern/console/scan/ScanPass.scala index 352b5f0a2a2b..618797216a15 100644 --- a/console/src/main/scala/io/joern/console/scan/ScanPass.scala +++ b/console/src/main/scala/io/joern/console/scan/ScanPass.scala @@ -1,6 +1,6 @@ package io.joern.console.scan -import io.joern.console.Query +import io.joern.querydb.Query import io.shiftleft.codepropertygraph.Cpg import io.shiftleft.passes.ConcurrentWriterCpgPass diff --git a/console/src/main/scala/io/joern/console/scan/package.scala b/console/src/main/scala/io/joern/console/scan/package.scala index 3ce430094816..1812684244af 100644 --- a/console/src/main/scala/io/joern/console/scan/package.scala +++ b/console/src/main/scala/io/joern/console/scan/package.scala @@ -1,6 +1,6 @@ package io.joern.console -import io.joern.console.Query +import io.joern.querydb.Query import io.shiftleft.codepropertygraph.Cpg import io.shiftleft.codepropertygraph.generated.NodeTypes import io.shiftleft.codepropertygraph.generated.nodes._ diff --git a/console/src/main/scala/io/joern/console/Query.scala b/console/src/main/scala/io/joern/querydb/Query.scala similarity index 98% rename from console/src/main/scala/io/joern/console/Query.scala rename to console/src/main/scala/io/joern/querydb/Query.scala index b8b6897c9ee9..c00b50fa8a73 100644 --- a/console/src/main/scala/io/joern/console/Query.scala +++ b/console/src/main/scala/io/joern/querydb/Query.scala @@ -1,4 +1,4 @@ -package io.joern.console +package io.joern.querydb import io.shiftleft.codepropertygraph.Cpg import io.shiftleft.codepropertygraph.generated.nodes.StoredNode diff --git a/joern-cli/src/main/scala/io/joern/joerncli/JoernScan.scala b/joern-cli/src/main/scala/io/joern/joerncli/JoernScan.scala index 6a8be0199323..66600ca462bc 100644 --- a/joern-cli/src/main/scala/io/joern/joerncli/JoernScan.scala +++ b/joern-cli/src/main/scala/io/joern/joerncli/JoernScan.scala @@ -2,7 +2,8 @@ package io.joern.joerncli import better.files._ import io.joern.console.scan.{ScanPass, outputFindings} -import io.joern.console.{BridgeBase, DefaultArgumentProvider, JoernProduct, Query, QueryDatabase} +import io.joern.console.{BridgeBase, JoernProduct} +import io.joern.querydb.{DefaultArgumentProvider, Query, QueryDatabase} import io.joern.dataflowengineoss.queryengine.{EngineConfig, EngineContext} import io.joern.dataflowengineoss.semanticsloader.Semantics import io.joern.joerncli.JoernScan.getQueriesFromQueryDb diff --git a/macros/src/main/java/io/joern/console/q.java b/macros/src/main/java/io/joern/querydb/q.java similarity index 84% rename from macros/src/main/java/io/joern/console/q.java rename to macros/src/main/java/io/joern/querydb/q.java index 19f559f152d5..80d82a9e2681 100644 --- a/macros/src/main/java/io/joern/console/q.java +++ b/macros/src/main/java/io/joern/querydb/q.java @@ -1,4 +1,4 @@ -package io.joern.console; +package io.joern.querydb; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/macros/src/main/scala-2/io/joern/macros/QueryMacros.scala b/macros/src/main/scala-2/io/joern/macros/QueryMacros.scala index 74302a629f0d..1600ef797c24 100644 --- a/macros/src/main/scala-2/io/joern/macros/QueryMacros.scala +++ b/macros/src/main/scala-2/io/joern/macros/QueryMacros.scala @@ -2,7 +2,7 @@ package io.joern.macros import io.shiftleft.codepropertygraph.Cpg import io.shiftleft.codepropertygraph.generated.nodes.StoredNode -import io.joern.console.TraversalWithStrRep +import io.joern.querydb.TraversalWithStrRep import overflowdb.traversal.Traversal import scala.language.experimental.macros diff --git a/macros/src/main/scala-3/io/joern/macros/QueryMacros.scala b/macros/src/main/scala-3/io/joern/macros/QueryMacros.scala index 7dacfc05d9b0..1c0b53c48195 100644 --- a/macros/src/main/scala-3/io/joern/macros/QueryMacros.scala +++ b/macros/src/main/scala-3/io/joern/macros/QueryMacros.scala @@ -1,6 +1,6 @@ package io.joern.macros -import io.joern.console.TraversalWithStrRep +import io.joern.querydb.TraversalWithStrRep import io.shiftleft.codepropertygraph.Cpg import io.shiftleft.codepropertygraph.generated.nodes.StoredNode import overflowdb.traversal.Traversal diff --git a/macros/src/main/scala/io/joern/console/QueryDatabase.scala b/macros/src/main/scala/io/joern/querydb/QueryDatabase.scala similarity index 99% rename from macros/src/main/scala/io/joern/console/QueryDatabase.scala rename to macros/src/main/scala/io/joern/querydb/QueryDatabase.scala index 31169952b783..5fd0add4ccb0 100644 --- a/macros/src/main/scala/io/joern/console/QueryDatabase.scala +++ b/macros/src/main/scala/io/joern/querydb/QueryDatabase.scala @@ -1,4 +1,4 @@ -package io.joern.console +package io.joern.querydb import org.reflections8.Reflections import org.reflections8.util.{ClasspathHelper, ConfigurationBuilder} diff --git a/macros/src/test/scala/io/joern/macros/QueryMacroTests.scala b/macros/src/test/scala/io/joern/macros/QueryMacroTests.scala index 5476f9eaa48b..ff4b4b8085ab 100644 --- a/macros/src/test/scala/io/joern/macros/QueryMacroTests.scala +++ b/macros/src/test/scala/io/joern/macros/QueryMacroTests.scala @@ -5,6 +5,7 @@ import org.scalatest.wordspec.AnyWordSpec import io.joern.macros.QueryMacros.withStrRep import io.joern.console._ +import io.joern.querydb._ import io.shiftleft.semanticcpg.language._ class QueryMacroTests extends AnyWordSpec with Matchers { diff --git a/macros/src/test/scala/io/joern/console/QueryDatabaseTests.scala b/macros/src/test/scala/io/joern/querydb/QueryDatabaseTests.scala similarity index 90% rename from macros/src/test/scala/io/joern/console/QueryDatabaseTests.scala rename to macros/src/test/scala/io/joern/querydb/QueryDatabaseTests.scala index 6b7e8ebc6295..4b543f567e81 100644 --- a/macros/src/test/scala/io/joern/console/QueryDatabaseTests.scala +++ b/macros/src/test/scala/io/joern/querydb/QueryDatabaseTests.scala @@ -1,4 +1,4 @@ -package io.joern.console +package io.joern.querydb import io.shiftleft.codepropertygraph.Cpg import io.shiftleft.semanticcpg.language._ @@ -36,13 +36,13 @@ object InvalidBundle extends QueryBundle { class QueryDatabaseTests extends AnyWordSpec with should.Matchers { "QueryDatabase" should { "contain Metrics bundle" in { - new QueryDatabase(namespace = "io.joern.console").allBundles.count { bundle => + new QueryDatabase(namespace = "io.joern.querydb").allBundles.count { bundle => bundle.getName.endsWith("TestBundle$") } shouldBe 1 } "contain `foo` query" in { - val qdb = new QueryDatabase(namespace = "io.joern.console") + val qdb = new QueryDatabase(namespace = "io.joern.querydb") val testBundles = qdb.allBundles.filter { bundle => bundle.getName.endsWith("TestBundle$") } @@ -67,7 +67,7 @@ class QueryDatabaseTests extends AnyWordSpec with should.Matchers { } "throw exception when trying to fetch queries from invalid bundle" in { - val qdb = new QueryDatabase(namespace = "io.joern.console") + val qdb = new QueryDatabase(namespace = "io.joern.querydb") val testBundles = qdb.allBundles.filter { bundle => bundle.getName.endsWith("InvalidBundle$") } diff --git a/querydb/src/main/scala/io/joern/dumpq/Main.scala b/querydb/src/main/scala/io/joern/dumpq/Main.scala index 15f3d24d391a..9c7857d9a84b 100644 --- a/querydb/src/main/scala/io/joern/dumpq/Main.scala +++ b/querydb/src/main/scala/io/joern/dumpq/Main.scala @@ -1,6 +1,6 @@ package io.joern.dumpq -import io.joern.console.{DefaultArgumentProvider, QueryDatabase} +import io.joern.querydb.{DefaultArgumentProvider, QueryDatabase} import io.joern.dataflowengineoss.queryengine.{EngineConfig, EngineContext} import io.joern.dataflowengineoss.semanticsloader.Semantics import org.json4s.{Formats, NoTypeHints} diff --git a/querydb/src/main/scala/io/joern/scanners/android/ArbitraryFileWrites.scala b/querydb/src/main/scala/io/joern/scanners/android/ArbitraryFileWrites.scala index 97e78f177457..6f6b0aab25ce 100644 --- a/querydb/src/main/scala/io/joern/scanners/android/ArbitraryFileWrites.scala +++ b/querydb/src/main/scala/io/joern/scanners/android/ArbitraryFileWrites.scala @@ -2,6 +2,7 @@ package io.joern.scanners.android import io.joern.scanners._ import io.joern.console._ +import io.joern.querydb._ import io.joern.dataflowengineoss.queryengine.EngineContext import io.joern.dataflowengineoss.semanticsloader.Semantics import io.joern.macros.QueryMacros._ diff --git a/querydb/src/main/scala/io/joern/scanners/android/ExternalStorage.scala b/querydb/src/main/scala/io/joern/scanners/android/ExternalStorage.scala index c89e77487f84..5f0109cd58bf 100644 --- a/querydb/src/main/scala/io/joern/scanners/android/ExternalStorage.scala +++ b/querydb/src/main/scala/io/joern/scanners/android/ExternalStorage.scala @@ -2,6 +2,7 @@ package io.joern.scanners.android import io.joern.scanners._ import io.joern.console._ +import io.joern.querydb._ import io.joern.dataflowengineoss.queryengine.EngineContext import io.joern.dataflowengineoss.semanticsloader.Semantics import io.joern.macros.QueryMacros._ diff --git a/querydb/src/main/scala/io/joern/scanners/android/Intents.scala b/querydb/src/main/scala/io/joern/scanners/android/Intents.scala index 0b1877fde52d..a4d812efa721 100644 --- a/querydb/src/main/scala/io/joern/scanners/android/Intents.scala +++ b/querydb/src/main/scala/io/joern/scanners/android/Intents.scala @@ -2,6 +2,7 @@ package io.joern.scanners.android import io.joern.scanners._ import io.joern.console._ +import io.joern.querydb._ import io.joern.dataflowengineoss.queryengine.EngineContext import io.joern.dataflowengineoss.semanticsloader.Semantics import io.joern.macros.QueryMacros._ diff --git a/querydb/src/main/scala/io/joern/scanners/android/JavaScriptInterface.scala b/querydb/src/main/scala/io/joern/scanners/android/JavaScriptInterface.scala index 98decc443815..9acfe2a5f568 100644 --- a/querydb/src/main/scala/io/joern/scanners/android/JavaScriptInterface.scala +++ b/querydb/src/main/scala/io/joern/scanners/android/JavaScriptInterface.scala @@ -2,6 +2,7 @@ package io.joern.scanners.android import io.joern.scanners._ import io.joern.console._ +import io.joern.querydb._ import io.joern.dataflowengineoss.queryengine.EngineContext import io.joern.dataflowengineoss.semanticsloader.Semantics import io.joern.macros.QueryMacros._ diff --git a/querydb/src/main/scala/io/joern/scanners/android/Misconfigurations.scala b/querydb/src/main/scala/io/joern/scanners/android/Misconfigurations.scala index e24e21e1771d..2988cc484619 100644 --- a/querydb/src/main/scala/io/joern/scanners/android/Misconfigurations.scala +++ b/querydb/src/main/scala/io/joern/scanners/android/Misconfigurations.scala @@ -2,6 +2,7 @@ package io.joern.scanners.android import io.joern.scanners._ import io.joern.console._ +import io.joern.querydb._ import io.joern.dataflowengineoss.queryengine.EngineContext import io.joern.macros.QueryMacros._ import io.shiftleft.semanticcpg.language._ diff --git a/querydb/src/main/scala/io/joern/scanners/android/RootDetection.scala b/querydb/src/main/scala/io/joern/scanners/android/RootDetection.scala index 4586fcccb094..89fa51e83607 100644 --- a/querydb/src/main/scala/io/joern/scanners/android/RootDetection.scala +++ b/querydb/src/main/scala/io/joern/scanners/android/RootDetection.scala @@ -2,6 +2,7 @@ package io.joern.scanners.android import io.joern.scanners._ import io.joern.console._ +import io.joern.querydb._ import io.joern.dataflowengineoss.queryengine.EngineContext import io.joern.dataflowengineoss.semanticsloader.Semantics import io.joern.macros.QueryMacros._ diff --git a/querydb/src/main/scala/io/joern/scanners/android/UnprotectedAppParts.scala b/querydb/src/main/scala/io/joern/scanners/android/UnprotectedAppParts.scala index 999026e723a3..0f161b88fe8b 100644 --- a/querydb/src/main/scala/io/joern/scanners/android/UnprotectedAppParts.scala +++ b/querydb/src/main/scala/io/joern/scanners/android/UnprotectedAppParts.scala @@ -2,6 +2,7 @@ package io.joern.scanners.android import io.joern.scanners._ import io.joern.console._ +import io.joern.querydb._ import io.joern.dataflowengineoss.language.toExtendedCfgNode import io.joern.dataflowengineoss.queryengine.EngineContext import io.joern.dataflowengineoss.semanticsloader.Semantics diff --git a/querydb/src/main/scala/io/joern/scanners/android/UnsafeReflection.scala b/querydb/src/main/scala/io/joern/scanners/android/UnsafeReflection.scala index a9c3ec5c3d5b..db3a1a8e5076 100644 --- a/querydb/src/main/scala/io/joern/scanners/android/UnsafeReflection.scala +++ b/querydb/src/main/scala/io/joern/scanners/android/UnsafeReflection.scala @@ -2,6 +2,7 @@ package io.joern.scanners.android import io.joern.scanners._ import io.joern.console._ +import io.joern.querydb._ import io.joern.dataflowengineoss.queryengine.EngineContext import io.joern.dataflowengineoss.semanticsloader.Semantics import io.joern.macros.QueryMacros._ diff --git a/querydb/src/main/scala/io/joern/scanners/c/CopyLoops.scala b/querydb/src/main/scala/io/joern/scanners/c/CopyLoops.scala index 7b00fb2a9c5a..48d6f5cf8907 100644 --- a/querydb/src/main/scala/io/joern/scanners/c/CopyLoops.scala +++ b/querydb/src/main/scala/io/joern/scanners/c/CopyLoops.scala @@ -2,6 +2,7 @@ package io.joern.scanners.c import io.joern.scanners._ import io.joern.console._ +import io.joern.querydb._ import io.joern.macros.QueryMacros._ import io.shiftleft.semanticcpg.language._ diff --git a/querydb/src/main/scala/io/joern/scanners/c/CredentialDrop.scala b/querydb/src/main/scala/io/joern/scanners/c/CredentialDrop.scala index 966cc3d79022..80333c1b1aec 100644 --- a/querydb/src/main/scala/io/joern/scanners/c/CredentialDrop.scala +++ b/querydb/src/main/scala/io/joern/scanners/c/CredentialDrop.scala @@ -2,6 +2,7 @@ package io.joern.scanners.c import io.joern.scanners._ import io.joern.console._ +import io.joern.querydb._ import io.shiftleft.semanticcpg.language._ import io.joern.macros.QueryMacros._ diff --git a/querydb/src/main/scala/io/joern/scanners/c/DangerousFunctions.scala b/querydb/src/main/scala/io/joern/scanners/c/DangerousFunctions.scala index 9ef4d463a9ee..9d699fb9a089 100644 --- a/querydb/src/main/scala/io/joern/scanners/c/DangerousFunctions.scala +++ b/querydb/src/main/scala/io/joern/scanners/c/DangerousFunctions.scala @@ -2,6 +2,7 @@ package io.joern.scanners.c import io.joern.scanners._ import io.joern.console._ +import io.joern.querydb._ import io.shiftleft.semanticcpg.language._ import io.joern.macros.QueryMacros._ diff --git a/querydb/src/main/scala/io/joern/scanners/c/FileOpRace.scala b/querydb/src/main/scala/io/joern/scanners/c/FileOpRace.scala index 2a13edc9dd86..81d852ec35b2 100644 --- a/querydb/src/main/scala/io/joern/scanners/c/FileOpRace.scala +++ b/querydb/src/main/scala/io/joern/scanners/c/FileOpRace.scala @@ -3,6 +3,7 @@ package io.joern.scanners.c import io.joern.scanners.{Crew, QueryTags} import io.shiftleft.codepropertygraph.generated.nodes._ import io.joern.console._ +import io.joern.querydb._ import io.joern.dataflowengineoss.queryengine.EngineContext import io.shiftleft.semanticcpg.language._ import io.joern.macros.QueryMacros._ diff --git a/querydb/src/main/scala/io/joern/scanners/c/HeapBasedOverflow.scala b/querydb/src/main/scala/io/joern/scanners/c/HeapBasedOverflow.scala index ea57b54641aa..3b805aa89560 100644 --- a/querydb/src/main/scala/io/joern/scanners/c/HeapBasedOverflow.scala +++ b/querydb/src/main/scala/io/joern/scanners/c/HeapBasedOverflow.scala @@ -5,6 +5,7 @@ import io.joern.dataflowengineoss.queryengine.EngineContext import io.shiftleft.semanticcpg.language._ import io.joern.dataflowengineoss.language._ import io.joern.console._ +import io.joern.querydb._ import io.joern.dataflowengineoss.semanticsloader.Semantics import io.joern.macros.QueryMacros._ diff --git a/querydb/src/main/scala/io/joern/scanners/c/IntegerTruncations.scala b/querydb/src/main/scala/io/joern/scanners/c/IntegerTruncations.scala index 3f5bfe035b2b..ad745652258b 100644 --- a/querydb/src/main/scala/io/joern/scanners/c/IntegerTruncations.scala +++ b/querydb/src/main/scala/io/joern/scanners/c/IntegerTruncations.scala @@ -3,6 +3,7 @@ package io.joern.scanners.c import io.joern.scanners._ import io.shiftleft.semanticcpg.language._ import io.joern.console._ +import io.joern.querydb._ import io.joern.macros.QueryMacros._ object IntegerTruncations extends QueryBundle { diff --git a/querydb/src/main/scala/io/joern/scanners/c/Metrics.scala b/querydb/src/main/scala/io/joern/scanners/c/Metrics.scala index 7cc521612c18..cf439b545090 100644 --- a/querydb/src/main/scala/io/joern/scanners/c/Metrics.scala +++ b/querydb/src/main/scala/io/joern/scanners/c/Metrics.scala @@ -2,6 +2,7 @@ package io.joern.scanners.c import io.joern.scanners._ import io.joern.console._ +import io.joern.querydb._ import io.shiftleft.semanticcpg.language._ import io.joern.macros.QueryMacros._ diff --git a/querydb/src/main/scala/io/joern/scanners/c/MissingLengthCheck.scala b/querydb/src/main/scala/io/joern/scanners/c/MissingLengthCheck.scala index 0082a949b273..691550d1bbad 100644 --- a/querydb/src/main/scala/io/joern/scanners/c/MissingLengthCheck.scala +++ b/querydb/src/main/scala/io/joern/scanners/c/MissingLengthCheck.scala @@ -3,6 +3,7 @@ package io.joern.scanners.c import io.shiftleft.semanticcpg.language.{ICallResolver, NoResolve} import io.joern.scanners._ import io.joern.console._ +import io.joern.querydb._ import io.shiftleft.codepropertygraph.generated.nodes import io.joern.dataflowengineoss.queryengine.EngineContext import io.shiftleft.semanticcpg.language._ diff --git a/querydb/src/main/scala/io/joern/scanners/c/NullTermination.scala b/querydb/src/main/scala/io/joern/scanners/c/NullTermination.scala index b74242ae9121..a31552490e04 100644 --- a/querydb/src/main/scala/io/joern/scanners/c/NullTermination.scala +++ b/querydb/src/main/scala/io/joern/scanners/c/NullTermination.scala @@ -4,6 +4,7 @@ import io.joern.scanners.{Crew, QueryTags} import io.shiftleft.semanticcpg.language._ import io.joern.dataflowengineoss.language._ import io.joern.console._ +import io.joern.querydb._ import io.joern.dataflowengineoss.queryengine.EngineContext import io.joern.dataflowengineoss.semanticsloader.Semantics import io.joern.macros.QueryMacros._ diff --git a/querydb/src/main/scala/io/joern/scanners/c/QueryLangExtensions.scala b/querydb/src/main/scala/io/joern/scanners/c/QueryLangExtensions.scala index ad15159a6d08..a07f04593b0a 100644 --- a/querydb/src/main/scala/io/joern/scanners/c/QueryLangExtensions.scala +++ b/querydb/src/main/scala/io/joern/scanners/c/QueryLangExtensions.scala @@ -1,5 +1,6 @@ package io.joern.scanners.c +import io.joern.querydb._ import io.shiftleft.codepropertygraph.generated.nodes import io.shiftleft.semanticcpg.language._ import overflowdb.traversal.Traversal diff --git a/querydb/src/main/scala/io/joern/scanners/c/RetvalChecks.scala b/querydb/src/main/scala/io/joern/scanners/c/RetvalChecks.scala index ca0c9e3eaf7d..f1b7ceb2039c 100644 --- a/querydb/src/main/scala/io/joern/scanners/c/RetvalChecks.scala +++ b/querydb/src/main/scala/io/joern/scanners/c/RetvalChecks.scala @@ -2,6 +2,7 @@ package io.joern.scanners.c import io.joern.scanners.{Crew, QueryTags} import io.joern.console._ +import io.joern.querydb._ import io.joern.macros.QueryMacros._ import io.shiftleft.semanticcpg.language._ import QueryLangExtensions._ diff --git a/querydb/src/main/scala/io/joern/scanners/c/SignedLeftShift.scala b/querydb/src/main/scala/io/joern/scanners/c/SignedLeftShift.scala index 232da036f815..85ad9398ec02 100644 --- a/querydb/src/main/scala/io/joern/scanners/c/SignedLeftShift.scala +++ b/querydb/src/main/scala/io/joern/scanners/c/SignedLeftShift.scala @@ -3,6 +3,7 @@ package io.joern.scanners.c import io.joern.scanners._ import io.shiftleft.codepropertygraph.generated.Operators import io.joern.console._ +import io.joern.querydb._ import io.joern.macros.QueryMacros._ import io.shiftleft.semanticcpg.language._ diff --git a/querydb/src/main/scala/io/joern/scanners/c/SocketApi.scala b/querydb/src/main/scala/io/joern/scanners/c/SocketApi.scala index 9fe1d3901450..f1533a8244f3 100644 --- a/querydb/src/main/scala/io/joern/scanners/c/SocketApi.scala +++ b/querydb/src/main/scala/io/joern/scanners/c/SocketApi.scala @@ -2,6 +2,7 @@ package io.joern.scanners.c import io.joern.scanners.{Crew, QueryTags} import io.joern.console._ +import io.joern.querydb._ import io.joern.dataflowengineoss.queryengine.EngineContext import io.joern.macros.QueryMacros._ import io.shiftleft.semanticcpg.language._ diff --git a/querydb/src/main/scala/io/joern/scanners/c/UseAfterFree.scala b/querydb/src/main/scala/io/joern/scanners/c/UseAfterFree.scala index 47181611b0d9..2ae36b5e55ea 100644 --- a/querydb/src/main/scala/io/joern/scanners/c/UseAfterFree.scala +++ b/querydb/src/main/scala/io/joern/scanners/c/UseAfterFree.scala @@ -4,6 +4,7 @@ import io.joern.scanners.{Crew, QueryTags} import io.shiftleft.codepropertygraph.generated.Operators import io.shiftleft.codepropertygraph.generated.nodes._ import io.joern.console._ +import io.joern.querydb._ import io.shiftleft.semanticcpg.language._ import io.joern.dataflowengineoss.language._ import io.joern.dataflowengineoss.queryengine.EngineContext diff --git a/querydb/src/main/scala/io/joern/scanners/ghidra/DangerousFunctions.scala b/querydb/src/main/scala/io/joern/scanners/ghidra/DangerousFunctions.scala index 16216093a627..31622dbb7658 100644 --- a/querydb/src/main/scala/io/joern/scanners/ghidra/DangerousFunctions.scala +++ b/querydb/src/main/scala/io/joern/scanners/ghidra/DangerousFunctions.scala @@ -2,6 +2,7 @@ package io.joern.scanners.ghidra import io.joern.scanners._ import io.joern.console._ +import io.joern.querydb._ import io.joern.macros.QueryMacros._ import io.shiftleft.semanticcpg.language._ diff --git a/querydb/src/main/scala/io/joern/scanners/ghidra/UserInputIntoDangerousFunctions.scala b/querydb/src/main/scala/io/joern/scanners/ghidra/UserInputIntoDangerousFunctions.scala index f6dfb76bc256..dbfed7a945bb 100644 --- a/querydb/src/main/scala/io/joern/scanners/ghidra/UserInputIntoDangerousFunctions.scala +++ b/querydb/src/main/scala/io/joern/scanners/ghidra/UserInputIntoDangerousFunctions.scala @@ -2,6 +2,7 @@ package io.joern.scanners.ghidra import io.joern.scanners._ import io.joern.console._ +import io.joern.querydb._ import io.joern.macros.QueryMacros._ import io.shiftleft.semanticcpg.language._ import io.joern.dataflowengineoss.language._ diff --git a/querydb/src/main/scala/io/joern/scanners/java/CertificateChecks.scala b/querydb/src/main/scala/io/joern/scanners/java/CertificateChecks.scala index fc6960bc4878..cf431dfc09b6 100644 --- a/querydb/src/main/scala/io/joern/scanners/java/CertificateChecks.scala +++ b/querydb/src/main/scala/io/joern/scanners/java/CertificateChecks.scala @@ -3,6 +3,7 @@ package io.joern.scanners.java import io.joern.scanners.{Crew, QueryTags} import io.shiftleft.codepropertygraph.generated._ import io.joern.console._ +import io.joern.querydb._ import io.joern.macros.QueryMacros._ import io.shiftleft.semanticcpg.language._ import overflowdb.traversal.Traversal diff --git a/querydb/src/main/scala/io/joern/scanners/java/CrossSiteScripting.scala b/querydb/src/main/scala/io/joern/scanners/java/CrossSiteScripting.scala index e7265c367e12..59da61cf09e7 100644 --- a/querydb/src/main/scala/io/joern/scanners/java/CrossSiteScripting.scala +++ b/querydb/src/main/scala/io/joern/scanners/java/CrossSiteScripting.scala @@ -3,6 +3,7 @@ package io.joern.scanners.java import io.joern.scanners._ import io.shiftleft.semanticcpg.language._ import io.joern.console._ +import io.joern.querydb._ import io.joern.macros.QueryMacros._ import io.joern.dataflowengineoss.language._ import io.joern.dataflowengineoss.queryengine.EngineContext diff --git a/querydb/src/main/scala/io/joern/scanners/java/CryptographyMisuse.scala b/querydb/src/main/scala/io/joern/scanners/java/CryptographyMisuse.scala index fb04bf7f2ab1..4e53ffcb2ca5 100644 --- a/querydb/src/main/scala/io/joern/scanners/java/CryptographyMisuse.scala +++ b/querydb/src/main/scala/io/joern/scanners/java/CryptographyMisuse.scala @@ -3,6 +3,7 @@ package io.joern.scanners.java import io.joern.scanners._ import io.shiftleft.semanticcpg.language._ import io.joern.console._ +import io.joern.querydb._ import io.joern.macros.QueryMacros._ import io.joern.dataflowengineoss.language._ import io.joern.dataflowengineoss.queryengine.EngineContext diff --git a/querydb/src/main/scala/io/joern/scanners/java/DangerousFunctions.scala b/querydb/src/main/scala/io/joern/scanners/java/DangerousFunctions.scala index cdfabc11b03f..7a2803da0cd7 100644 --- a/querydb/src/main/scala/io/joern/scanners/java/DangerousFunctions.scala +++ b/querydb/src/main/scala/io/joern/scanners/java/DangerousFunctions.scala @@ -3,6 +3,7 @@ package io.joern.scanners.java import io.joern.scanners._ import io.shiftleft.semanticcpg.language._ import io.joern.console._ +import io.joern.querydb._ import io.joern.macros.QueryMacros._ object DangerousFunctions extends QueryBundle { diff --git a/querydb/src/main/scala/io/joern/scanners/java/SQLInjection.scala b/querydb/src/main/scala/io/joern/scanners/java/SQLInjection.scala index a65cf3bc2ce5..74773e86b517 100644 --- a/querydb/src/main/scala/io/joern/scanners/java/SQLInjection.scala +++ b/querydb/src/main/scala/io/joern/scanners/java/SQLInjection.scala @@ -3,6 +3,7 @@ package io.joern.scanners.java import io.joern.scanners._ import io.shiftleft.semanticcpg.language._ import io.joern.console._ +import io.joern.querydb._ import io.joern.macros.QueryMacros._ import io.joern.dataflowengineoss.language._ import io.joern.dataflowengineoss.queryengine.EngineContext diff --git a/querydb/src/main/scala/io/joern/scanners/kotlin/NetworkCommunication.scala b/querydb/src/main/scala/io/joern/scanners/kotlin/NetworkCommunication.scala index 33328bee97e9..e53aa09e8f23 100644 --- a/querydb/src/main/scala/io/joern/scanners/kotlin/NetworkCommunication.scala +++ b/querydb/src/main/scala/io/joern/scanners/kotlin/NetworkCommunication.scala @@ -2,6 +2,7 @@ package io.joern.scanners.kotlin import io.joern.scanners._ import io.joern.console._ +import io.joern.querydb._ import io.joern.dataflowengineoss.queryengine.EngineContext import io.joern.dataflowengineoss.semanticsloader.Semantics import io.joern.dataflowengineoss.language._ diff --git a/querydb/src/main/scala/io/joern/scanners/kotlin/NetworkProtocols.scala b/querydb/src/main/scala/io/joern/scanners/kotlin/NetworkProtocols.scala index da7b1c6a3daf..2cdd9707f0ef 100644 --- a/querydb/src/main/scala/io/joern/scanners/kotlin/NetworkProtocols.scala +++ b/querydb/src/main/scala/io/joern/scanners/kotlin/NetworkProtocols.scala @@ -3,6 +3,7 @@ package io.joern.scanners.kotlin import io.joern.scanners.{Crew, QueryTags} import io.shiftleft.codepropertygraph.generated._ import io.joern.console._ +import io.joern.querydb._ import io.joern.macros.QueryMacros._ import io.shiftleft.semanticcpg.language._ import overflowdb.traversal.Traversal diff --git a/querydb/src/main/scala/io/joern/scanners/kotlin/PathTraversals.scala b/querydb/src/main/scala/io/joern/scanners/kotlin/PathTraversals.scala index 58968bb1344a..dd64b05ac94f 100644 --- a/querydb/src/main/scala/io/joern/scanners/kotlin/PathTraversals.scala +++ b/querydb/src/main/scala/io/joern/scanners/kotlin/PathTraversals.scala @@ -2,6 +2,7 @@ package io.joern.scanners.kotlin import io.joern.scanners._ import io.joern.console._ +import io.joern.querydb._ import io.joern.dataflowengineoss.queryengine.EngineContext import io.joern.dataflowengineoss.semanticsloader.Semantics import io.joern.dataflowengineoss.language._ diff --git a/querydb/src/main/scala/io/joern/scanners/php/SQLInjection.scala b/querydb/src/main/scala/io/joern/scanners/php/SQLInjection.scala index 7d64db2d4be4..bad33dbc3c3a 100644 --- a/querydb/src/main/scala/io/joern/scanners/php/SQLInjection.scala +++ b/querydb/src/main/scala/io/joern/scanners/php/SQLInjection.scala @@ -1,6 +1,7 @@ package io.joern.scanners.php import io.joern.console._ +import io.joern.querydb._ import io.joern.dataflowengineoss.language._ import io.joern.dataflowengineoss.queryengine.EngineContext import io.joern.macros.QueryMacros._ diff --git a/querydb/src/main/scala/io/joern/scanners/php/ShellExec.scala b/querydb/src/main/scala/io/joern/scanners/php/ShellExec.scala index f73a6d11f947..7be4a26655b4 100644 --- a/querydb/src/main/scala/io/joern/scanners/php/ShellExec.scala +++ b/querydb/src/main/scala/io/joern/scanners/php/ShellExec.scala @@ -1,6 +1,7 @@ package io.joern.scanners.php import io.joern.console._ +import io.joern.querydb._ import io.joern.dataflowengineoss.language._ import io.joern.dataflowengineoss.queryengine.EngineContext import io.joern.macros.QueryMacros._ diff --git a/querydb/src/test/scala/io/joern/scanners/c/QueryWithReachableBy.scala b/querydb/src/test/scala/io/joern/scanners/c/QueryWithReachableBy.scala index 6a6d21b311df..088fd76a6eba 100644 --- a/querydb/src/test/scala/io/joern/scanners/c/QueryWithReachableBy.scala +++ b/querydb/src/test/scala/io/joern/scanners/c/QueryWithReachableBy.scala @@ -1,7 +1,7 @@ package io.joern.scanners.c import io.joern.scanners._ -import io.joern.console._ +import io.joern.querydb._ import io.joern.dataflowengineoss.language._ import io.shiftleft.semanticcpg.language._ import io.joern.macros.QueryMacros._ diff --git a/querydb/src/test/scala/io/joern/suites/AllBundlesTestSuite.scala b/querydb/src/test/scala/io/joern/suites/AllBundlesTestSuite.scala index f20c2909a22f..a589c955dd5f 100644 --- a/querydb/src/test/scala/io/joern/suites/AllBundlesTestSuite.scala +++ b/querydb/src/test/scala/io/joern/suites/AllBundlesTestSuite.scala @@ -1,6 +1,6 @@ package io.joern.suites -import io.joern.console.QueryDatabase +import io.joern.querydb.QueryDatabase import org.scalatest.wordspec.AnyWordSpec import org.scalatest.matchers.should.Matchers.convertToAnyShouldWrapper diff --git a/querydb/src/test/scala/io/joern/suites/AndroidQueryTestSuite.scala b/querydb/src/test/scala/io/joern/suites/AndroidQueryTestSuite.scala index b45488e38874..099b3dbb51b4 100644 --- a/querydb/src/test/scala/io/joern/suites/AndroidQueryTestSuite.scala +++ b/querydb/src/test/scala/io/joern/suites/AndroidQueryTestSuite.scala @@ -1,7 +1,7 @@ package io.joern.suites import io.joern.console.scan._ -import io.joern.console.{CodeSnippet, Query, QueryBundle} +import io.joern.querydb.{CodeSnippet, Query, QueryBundle} import io.joern.kotlin2cpg.testfixtures.KotlinCode2CpgFixture import io.joern.util.QueryUtil import io.shiftleft.codepropertygraph.Cpg diff --git a/querydb/src/test/scala/io/joern/suites/CQueryTestSuite.scala b/querydb/src/test/scala/io/joern/suites/CQueryTestSuite.scala index 93e5d618c08c..2273c7057117 100644 --- a/querydb/src/test/scala/io/joern/suites/CQueryTestSuite.scala +++ b/querydb/src/test/scala/io/joern/suites/CQueryTestSuite.scala @@ -3,8 +3,8 @@ package io.joern.suites import io.joern.util.QueryUtil import io.shiftleft.codepropertygraph.generated.nodes import io.joern.console.scan._ -import io.joern.console.QueryBundle -import io.joern.console.Query +import io.joern.querydb.QueryBundle +import io.joern.querydb.Query import io.joern.c2cpg.testfixtures.DataFlowCodeToCpgSuite import io.joern.x2cpg.testfixtures.TestCpg import io.shiftleft.semanticcpg.language._ diff --git a/querydb/src/test/scala/io/joern/suites/GhidraQueryTestSuite.scala b/querydb/src/test/scala/io/joern/suites/GhidraQueryTestSuite.scala index 9cbd18c6f2db..8dfe906e471f 100644 --- a/querydb/src/test/scala/io/joern/suites/GhidraQueryTestSuite.scala +++ b/querydb/src/test/scala/io/joern/suites/GhidraQueryTestSuite.scala @@ -1,11 +1,11 @@ package io.joern.suites -import io.joern.console.QueryBundle +import io.joern.querydb.QueryBundle import io.joern.console.scan._ import io.joern.ghidra2cpg.fixtures.DataFlowBinToCpgSuite import io.joern.util.QueryUtil import io.shiftleft.codepropertygraph.generated.nodes -import io.joern.console.Query +import io.joern.querydb.Query import io.shiftleft.semanticcpg.language._ import io.shiftleft.utils.ProjectRoot import overflowdb.traversal.iterableToTraversal diff --git a/querydb/src/test/scala/io/joern/suites/JavaQueryTestSuite.scala b/querydb/src/test/scala/io/joern/suites/JavaQueryTestSuite.scala index 1f8135c68ce4..1b31dbe5bd3c 100644 --- a/querydb/src/test/scala/io/joern/suites/JavaQueryTestSuite.scala +++ b/querydb/src/test/scala/io/joern/suites/JavaQueryTestSuite.scala @@ -1,7 +1,7 @@ package io.joern.suites import io.joern.console.scan._ -import io.joern.console.{CodeSnippet, Query, QueryBundle} +import io.joern.querydb.{CodeSnippet, Query, QueryBundle} import io.joern.javasrc2cpg.testfixtures.JavaSrcCode2CpgFixture import io.joern.util.QueryUtil import io.joern.x2cpg.testfixtures.TestCpg diff --git a/querydb/src/test/scala/io/joern/suites/KotlinQueryTestSuite.scala b/querydb/src/test/scala/io/joern/suites/KotlinQueryTestSuite.scala index 49b5a37a3575..d03bd1d03a3e 100644 --- a/querydb/src/test/scala/io/joern/suites/KotlinQueryTestSuite.scala +++ b/querydb/src/test/scala/io/joern/suites/KotlinQueryTestSuite.scala @@ -1,7 +1,7 @@ package io.joern.suites import io.joern.util.QueryUtil -import io.joern.console.{CodeSnippet, Query, QueryBundle} +import io.joern.querydb.{CodeSnippet, Query, QueryBundle} import io.joern.kotlin2cpg.testfixtures.KotlinCode2CpgFixture import io.joern.x2cpg.testfixtures.TestCpg import io.shiftleft.codepropertygraph.Cpg diff --git a/querydb/src/test/scala/io/joern/suites/QDBArgumentProvider.scala b/querydb/src/test/scala/io/joern/suites/QDBArgumentProvider.scala index 0f8946a59d9e..8db3967c425b 100644 --- a/querydb/src/test/scala/io/joern/suites/QDBArgumentProvider.scala +++ b/querydb/src/test/scala/io/joern/suites/QDBArgumentProvider.scala @@ -1,6 +1,6 @@ package io.joern.suites -import io.joern.console.DefaultArgumentProvider +import io.joern.querydb.DefaultArgumentProvider import io.joern.dataflowengineoss.queryengine.EngineContext import io.joern.dataflowengineoss.semanticsloader.{Parser, Semantics} diff --git a/querydb/src/test/scala/io/joern/util/QueryUtil.scala b/querydb/src/test/scala/io/joern/util/QueryUtil.scala index a37b1e305060..381a1878e162 100644 --- a/querydb/src/test/scala/io/joern/util/QueryUtil.scala +++ b/querydb/src/test/scala/io/joern/util/QueryUtil.scala @@ -1,8 +1,8 @@ package io.joern.util import io.joern.suites.QDBArgumentProvider -import io.joern.console.{QueryBundle, QueryDatabase} -import io.joern.console.Query +import io.joern.querydb.{QueryBundle, QueryDatabase} +import io.joern.querydb.Query object QueryUtil { object EmptyBundle extends QueryBundle