Repository: joernio/joern
Pull request #787 (2021-11-26 11:41:05)

move macros over here, coming from codepropertygraph repo
* move Query over here as well, fixup everything
* rename file to match scala type
* change macro namespace to io.joern.macros


Patch:
diff --git a/build.sbt b/build.sbt
index 502669fb7..c4beb7e44 100644
--- a/build.sbt
+++ b/build.sbt
@@ -2,13 +2,14 @@ name := "joern"
 ThisBuild / organization := "io.joern"
 ThisBuild / scalaVersion := "2.13.7"
 
-val cpgVersion = "1.3.433"
+val cpgVersion = "1.3.438"
 val js2cpgVersion = "0.2.28"
 
 lazy val joerncli = Projects.joerncli
 lazy val querydb = Projects.querydb
 lazy val console = Projects.console
 lazy val dataflowengineoss = Projects.dataflowengineoss
+lazy val macros = Projects.macros
 lazy val fuzzyc2cpg = Projects.fuzzyc2cpg
 lazy val c2cpg = Projects.c2cpg
 lazy val ghidra2cpg = Projects.ghidra2cpg
diff --git a/console/build.sbt b/console/build.sbt
index 168b1e879..91bda85a9 100644
--- a/console/build.sbt
+++ b/console/build.sbt
@@ -10,12 +10,13 @@ val CirceVersion = "0.12.2"
 val AmmoniteVersion = "2.4.1"
 val ZeroturnaroundVersion = "1.13"
 
-dependsOn(Projects.fuzzyc2cpg % Test)
+dependsOn(
+  // Projects.macros,
+  Projects.fuzzyc2cpg % Test)
 
 libraryDependencies ++= Seq(
   "io.shiftleft" %% "codepropertygraph" % Versions.cpg,
   "io.shiftleft" %% "semanticcpg" % Versions.cpg,
-  "io.shiftleft" %% "macros" % Versions.cpg,
   "com.github.scopt" %% "scopt" % ScoptVersion,
   "com.github.pathikrit" %% "better-files" % BetterFilesVersion,
   "org.typelevel" %% "cats-core" % CatsVersion,
diff --git a/console/src/main/scala/io/joern/console/Query.scala b/console/src/main/scala/io/joern/console/Query.scala
new file mode 100644
index 000000000..6edecb59c
--- /dev/null
+++ b/console/src/main/scala/io/joern/console/Query.scala
@@ -0,0 +1,43 @@
+package io.joern.console
+
+import io.shiftleft.codepropertygraph.Cpg
+import io.shiftleft.codepropertygraph.generated.nodes.StoredNode
+import overflowdb.traversal.Traversal
+
+case class CodeExamples(positive: List[String], negative: List[String])
+
+case class Query(name: String,
+                 author: String,
+                 title: String,
+                 description: String,
+                 score: Double,
+                 traversal: Cpg => Traversal[StoredNode],
+                 traversalAsString: String = "",
+                 tags: List[String] = List(),
+                 language: String = "",
+                 codeExamples: CodeExamples = CodeExamples(List(), List()))
+
+object Query {
+  def make(name: String,
+           author: String,
+           title: String,
+           description: String,
+           score: Double,
+           traversalWithStrRep: TraversalWithStrRep,
+           tags: List[String] = List(),
+           codeExamples: CodeExamples = CodeExamples(List(), List())): Query = {
+    Query(
+      name = name,
+      author = author,
+      title = title,
+      description = description,
+      score = score,
+      traversal = traversalWithStrRep.traversal,
+      traversalAsString = traversalWithStrRep.strRep,
+      tags = tags,
+      codeExamples = codeExamples
+    )
+  }
+}
+
+case class TraversalWithStrRep(traversal: Cpg => Traversal[StoredNode], strRep: String = "")
diff --git a/console/src/main/scala/io/joern/console/QueryDatabase.scala b/console/src/main/scala/io/joern/console/QueryDatabase.scala
index e325d5eff..74611ea46 100644
--- a/console/src/main/scala/io/joern/console/QueryDatabase.scala
+++ b/console/src/main/scala/io/joern/console/QueryDatabase.scala
@@ -1,6 +1,6 @@
 package io.joern.console
 
-import io.shiftleft.console.Query
+import io.joern.console.Query
 import org.reflections8.Reflections
 import org.reflections8.util.{ClasspathHelper, ConfigurationBuilder}
 import org.slf4j.{Logger, LoggerFactory}
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 415761ed3..a915409c9 100644
--- a/console/src/main/scala/io/joern/console/scan/ScanPass.scala
+++ b/console/src/main/scala/io/joern/console/scan/ScanPass.scala
@@ -1,7 +1,7 @@
 package io.joern.console.scan
 
+import io.joern.console.Query
 import io.shiftleft.codepropertygraph.Cpg
-import io.shiftleft.console.Query
 import io.shiftleft.passes.{DiffGraph, KeyPoolCreator, ParallelCpgPass}
 
 class ScanPass(cpg: Cpg, queries: List[Query])
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 004bad399..9b9caf4bc 100644
--- a/console/src/main/scala/io/joern/console/scan/package.scala
+++ b/console/src/main/scala/io/joern/console/scan/package.scala
@@ -1,9 +1,9 @@
 package io.joern.console
 
+import io.joern.console.Query
 import io.shiftleft.codepropertygraph.Cpg
 import io.shiftleft.codepropertygraph.generated.NodeTypes
 import io.shiftleft.codepropertygraph.generated.nodes._
-import io.shiftleft.console.Query
 import io.shiftleft.semanticcpg.language._
 import org.slf4j.{Logger, LoggerFactory}
 import overflowdb.traversal._
diff --git a/dataflowengineoss/src/main/scala/io/joern/dataflowengineoss/queryengine/ResultTable.scala b/dataflowengineoss/src/main/scala/io/joern/dataflowengineoss/queryengine/ResultTable.scala
index 05aa80650..52c7551a2 100644
--- a/dataflowengineoss/src/main/scala/io/joern/dataflowengineoss/queryengine/ResultTable.scala
+++ b/dataflowengineoss/src/main/scala/io/joern/dataflowengineoss/queryengine/ResultTable.scala
@@ -41,6 +41,11 @@ class ResultTable {
     table.get(node)
   }
 
+  /**
+    * Returns all keys to allow for iteration through the table.
+    */
+  def keys(): Vector[StoredNode] = table.keys.toVector
+
 }
 
 /**
diff --git a/joern-cli/src/main/scala/io/joern/JoernScan.scala b/joern-cli/src/main/scala/io/joern/JoernScan.scala
index d2da3a673..27141aac5 100644
--- a/joern-cli/src/main/scala/io/joern/JoernScan.scala
+++ b/joern-cli/src/main/scala/io/joern/JoernScan.scala
@@ -2,7 +2,7 @@ package io.joern
 
 import io.joern.console.scan.{ScanPass, outputFindings}
 import io.joern.console.{BridgeBase, DefaultArgumentProvider, JoernProduct, QueryDatabase}
-import io.shiftleft.console.Query
+import io.joern.console.Query
 import io.joern.dataflowengineoss.queryengine.{EngineConfig, EngineContext}
 import io.joern.console.AmmoniteBridge
 import io.shiftleft.semanticcpg.layers.{LayerCreator, LayerCreatorContext, LayerCreatorOptions}
diff --git a/macros/build.sbt b/macros/build.sbt
new file mode 100644
index 000000000..c550314aa
--- /dev/null
+++ b/macros/build.sbt
@@ -0,0 +1,10 @@
+name := "macros"
+
+dependsOn(Projects.console)
+
+libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value
+
+scalacOptions ++= Seq( "-Yrangepos" )
+enablePlugins(JavaAppPackaging)
+
+Test / packageBin / publishArtifact := true
diff --git a/macros/src/main/scala/io/joern/macros/QueryMacros.scala b/macros/src/main/scala/io/joern/macros/QueryMacros.scala
new file mode 100644
index 000000000..8c1a1614b
--- /dev/null
+++ b/macros/src/main/scala/io/joern/macros/QueryMacros.scala
@@ -0,0 +1,29 @@
+package io.joern.macros
+
+import io.shiftleft.codepropertygraph.Cpg
+import io.shiftleft.codepropertygraph.generated.nodes.StoredNode
+import io.joern.console.TraversalWithStrRep
+import overflowdb.traversal.Traversal
+
+import scala.language.experimental.macros
+import scala.reflect.macros.whitebox
+
+object QueryMacros {
+
+  def withStrRep(traversal: Cpg => Traversal[StoredNode]): TraversalWithStrRep = macro withStrRepImpl
+  // def withStrRep[A <: StoredNode](traversal: Cpg => Traversal[A]): TraversalWithStrRep = macro withStrRepImpl
+
+  def withStrRepImpl(c: whitebox.Context)(traversal: c.Tree): c.Expr[TraversalWithStrRep] = {
+    import c.universe._
+    val fileContent = new String(traversal.pos.source.content)
+    val start = traversal.pos.start
+    val end = traversal.pos.end
+    val traversalAsString: String = fileContent.slice(start, end)
+
+    c.Expr(
+      q"""
+        TraversalWithStrRep($traversal, $traversalAsString)
+       """
+    )
+  }
+}
diff --git a/project/Projects.scala b/project/Projects.scala
index 5002be275..3fad99264 100644
--- a/project/Projects.scala
+++ b/project/Projects.scala
@@ -7,6 +7,7 @@ object Projects {
   lazy val querydb = project.in(file("querydb"))
   lazy val console = project.in(file("console"))
   lazy val dataflowengineoss = project.in(file("dataflowengineoss"))
+  lazy val macros = project.in(file("macros"))
 
   lazy val c2cpg = project.in(frontendsRoot / "c2cpg")
   lazy val ghidra2cpg = project.in(frontendsRoot / "ghidra2cpg")
diff --git a/querydb/build.sbt b/querydb/build.sbt
index baa24826f..0ac1703c8 100644
--- a/querydb/build.sbt
+++ b/querydb/build.sbt
@@ -4,6 +4,7 @@ enablePlugins(JavaAppPackaging)
 
 dependsOn(
   Projects.console,
+  Projects.macros,
   Projects.ghidra2cpg,
   Projects.ghidra2cpg % "test->test",
   Projects.c2cpg % "test->test",
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 1199a8b8e..380482609 100644
--- a/querydb/src/main/scala/io/joern/scanners/c/CopyLoops.scala
+++ b/querydb/src/main/scala/io/joern/scanners/c/CopyLoops.scala
@@ -2,8 +2,8 @@ package io.joern.scanners.c
 
 import io.joern.scanners._
 import io.joern.console._
-import io.shiftleft.console._
-import io.shiftleft.macros.QueryMacros._
+import io.joern.console._
+import io.joern.macros.QueryMacros._
 import io.shiftleft.semanticcpg.language._
 
 object CopyLoops extends QueryBundle {
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 c5ee0cea1..a6e207f78 100644
--- a/querydb/src/main/scala/io/joern/scanners/c/CredentialDrop.scala
+++ b/querydb/src/main/scala/io/joern/scanners/c/CredentialDrop.scala
@@ -2,9 +2,9 @@ package io.joern.scanners.c
 
 import io.joern.scanners._
 import io.joern.console._
-import io.shiftleft.console._
+import io.joern.console._
 import io.shiftleft.semanticcpg.language._
-import io.shiftleft.macros.QueryMacros._
+import io.joern.macros.QueryMacros._
 
 object CredentialDrop extends QueryBundle {
 
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 51f88e958..8777cf70a 100644
--- a/querydb/src/main/scala/io/joern/scanners/c/DangerousFunctions.scala
+++ b/querydb/src/main/scala/io/joern/scanners/c/DangerousFunctions.scala
@@ -2,9 +2,9 @@ package io.joern.scanners.c
 
 import io.joern.scanners._
 import io.joern.console._
-import io.shiftleft.console._
+import io.joern.console._
 import io.shiftleft.semanticcpg.language._
-import io.shiftleft.macros.QueryMacros._
+import io.joern.macros.QueryMacros._
 
 object DangerousFunctions extends QueryBundle {
 
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 d527f244e..69c18faac 100644
--- a/querydb/src/main/scala/io/joern/scanners/c/FileOpRace.scala
+++ b/querydb/src/main/scala/io/joern/scanners/c/FileOpRace.scala
@@ -3,11 +3,11 @@ package io.joern.scanners.c
 import io.joern.scanners.{Crew, QueryTags}
 import io.shiftleft.codepropertygraph.generated.nodes._
 import io.joern.console._
-import io.shiftleft.console._
+import io.joern.console._
 import io.joern.dataflowengineoss.queryengine.EngineContext
 import io.joern.dataflowengineoss.semanticsloader.Semantics
 import io.shiftleft.semanticcpg.language._
-import io.shiftleft.macros.QueryMacros._
+import io.joern.macros.QueryMacros._
 import overflowdb.traversal.Traversal
 
 object FileOpRace extends QueryBundle {
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 92e278e84..1ab26b0f1 100644
--- a/querydb/src/main/scala/io/joern/scanners/c/HeapBasedOverflow.scala
+++ b/querydb/src/main/scala/io/joern/scanners/c/HeapBasedOverflow.scala
@@ -5,9 +5,9 @@ import io.joern.dataflowengineoss.queryengine.EngineContext
 import io.shiftleft.semanticcpg.language._
 import io.joern.dataflowengineoss.language._
 import io.joern.console._
-import io.shiftleft.console._
+import io.joern.console._
 import io.joern.dataflowengineoss.semanticsloader.Semantics
-import io.shiftleft.macros.QueryMacros._
+import io.joern.macros.QueryMacros._
 
 object HeapBasedOverflow extends QueryBundle {
 
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 f135afe65..e6ff51c36 100644
--- a/querydb/src/main/scala/io/joern/scanners/c/IntegerTruncations.scala
+++ b/querydb/src/main/scala/io/joern/scanners/c/IntegerTruncations.scala
@@ -3,8 +3,8 @@ package io.joern.scanners.c
 import io.joern.scanners._
 import io.shiftleft.semanticcpg.language._
 import io.joern.console._
-import io.shiftleft.console._
-import io.shiftleft.macros.QueryMacros._
+import io.joern.console._
+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 59781f81d..1e9bad126 100644
--- a/querydb/src/main/scala/io/joern/scanners/c/Metrics.scala
+++ b/querydb/src/main/scala/io/joern/scanners/c/Metrics.scala
@@ -2,9 +2,9 @@ package io.joern.scanners.c
 
 import io.joern.scanners._
 import io.joern.console._
-import io.shiftleft.console._
+import io.joern.console._
 import io.shiftleft.semanticcpg.language._
-import io.shiftleft.macros.QueryMacros._
+import io.joern.macros.QueryMacros._
 
 object Metrics extends QueryBundle {
 
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 aafe82b0a..51dad8267 100644
--- a/querydb/src/main/scala/io/joern/scanners/c/MissingLengthCheck.scala
+++ b/querydb/src/main/scala/io/joern/scanners/c/MissingLengthCheck.scala
@@ -3,11 +3,11 @@ package io.joern.scanners.c
 import io.shiftleft.semanticcpg.language.{ICallResolver, NoResolve}
 import io.joern.scanners._
 import io.joern.console._
-import io.shiftleft.console._
+import io.joern.console._
 import io.shiftleft.codepropertygraph.generated.nodes
 import io.joern.dataflowengineoss.queryengine.EngineContext
 import io.shiftleft.semanticcpg.language._
-import io.shiftleft.macros.QueryMacros._
+import io.joern.macros.QueryMacros._
 import io.shiftleft.semanticcpg.language.operatorextension._
 import QueryLangExtensions._
 
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 4d914e55d..3421da108 100644
--- a/querydb/src/main/scala/io/joern/scanners/c/NullTermination.scala
+++ b/querydb/src/main/scala/io/joern/scanners/c/NullTermination.scala
@@ -4,10 +4,10 @@ import io.joern.scanners.{Crew, QueryTags}
 import io.shiftleft.semanticcpg.language._
 import io.joern.dataflowengineoss.language._
 import io.joern.console._
-import io.shiftleft.console._
+import io.joern.console._
 import io.joern.dataflowengineoss.queryengine.EngineContext
 import io.joern.dataflowengineoss.semanticsloader.Semantics
-import io.shiftleft.macros.QueryMacros._
+import io.joern.macros.QueryMacros._
 
 object NullTermination extends QueryBundle {
 
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 e25d3c62a..db40db1dd 100644
--- a/querydb/src/main/scala/io/joern/scanners/c/RetvalChecks.scala
+++ b/querydb/src/main/scala/io/joern/scanners/c/RetvalChecks.scala
@@ -2,8 +2,8 @@ package io.joern.scanners.c
 
 import io.joern.scanners.{Crew, QueryTags}
 import io.joern.console._
-import io.shiftleft.console._
-import io.shiftleft.macros.QueryMacros._
+import io.joern.console._
+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 ddf108b80..b63b6a6cb 100644
--- a/querydb/src/main/scala/io/joern/scanners/c/SignedLeftShift.scala
+++ b/querydb/src/main/scala/io/joern/scanners/c/SignedLeftShift.scala
@@ -3,8 +3,8 @@ package io.joern.scanners.c
 import io.joern.scanners._
 import io.shiftleft.codepropertygraph.generated.Operators
 import io.joern.console._
-import io.shiftleft.console._
-import io.shiftleft.macros.QueryMacros._
+import io.joern.console._
+import io.joern.macros.QueryMacros._
 import io.shiftleft.semanticcpg.language._
 
 object SignedLeftShift extends QueryBundle {
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 16fdcf8f9..eedec52c8 100644
--- a/querydb/src/main/scala/io/joern/scanners/c/SocketApi.scala
+++ b/querydb/src/main/scala/io/joern/scanners/c/SocketApi.scala
@@ -2,13 +2,13 @@ package io.joern.scanners.c
 
 import io.joern.scanners.{Crew, QueryTags}
 import io.joern.console._
-import io.shiftleft.console._
+import io.joern.console._
 import io.joern.dataflowengineoss.queryengine.EngineContext
 import io.joern.dataflowengineoss.semanticsloader.Semantics
-import io.shiftleft.macros.QueryMacros._
+import io.joern.macros.QueryMacros._
 import io.shiftleft.semanticcpg.language._
 import io.joern.console._
-import io.shiftleft.console._
+import io.joern.console._
 import QueryLangExtensions._
 
 object SocketApi extends QueryBundle {
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 123289ef4..5626ee142 100644
--- a/querydb/src/main/scala/io/joern/scanners/c/UseAfterFree.scala
+++ b/querydb/src/main/scala/io/joern/scanners/c/UseAfterFree.scala
@@ -4,12 +4,12 @@ import io.joern.scanners.{Crew, QueryTags}
 import io.shiftleft.codepropertygraph.generated.Operators
 import io.shiftleft.codepropertygraph.generated.nodes._
 import io.joern.console._
-import io.shiftleft.console._
+import io.joern.console._
 import io.shiftleft.semanticcpg.language._
 import io.joern.dataflowengineoss.language._
 import io.joern.dataflowengineoss.queryengine.EngineContext
 import io.joern.dataflowengineoss.semanticsloader.{Parser, Semantics}
-import io.shiftleft.macros.QueryMacros._
+import io.joern.macros.QueryMacros._
 
 object UseAfterFree extends QueryBundle {
 
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 f0cf1b19f..4618c9dc5 100644
--- a/querydb/src/main/scala/io/joern/scanners/ghidra/DangerousFunctions.scala
+++ b/querydb/src/main/scala/io/joern/scanners/ghidra/DangerousFunctions.scala
@@ -2,8 +2,8 @@ package io.joern.scanners.ghidra
 
 import io.joern.scanners._
 import io.joern.console._
-import io.shiftleft.console._
-import io.shiftleft.macros.QueryMacros._
+import io.joern.console._
+import io.joern.macros.QueryMacros._
 import io.shiftleft.semanticcpg.language._
 
 object DangerousFunctions extends QueryBundle {
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 62b492c31..2637138ef 100644
--- a/querydb/src/main/scala/io/joern/scanners/ghidra/UserInputIntoDangerousFunctions.scala
+++ b/querydb/src/main/scala/io/joern/scanners/ghidra/UserInputIntoDangerousFunctions.scala
@@ -2,8 +2,8 @@ package io.joern.scanners.ghidra
 
 import io.joern.scanners._
 import io.joern.console._
-import io.shiftleft.console._
-import io.shiftleft.macros.QueryMacros._
+import io.joern.console._
+import io.joern.macros.QueryMacros._
 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/java/CertificateChecks.scala b/querydb/src/main/scala/io/joern/scanners/java/CertificateChecks.scala
index eaa2fa626..20564a349 100644
--- a/querydb/src/main/scala/io/joern/scanners/java/CertificateChecks.scala
+++ b/querydb/src/main/scala/io/joern/scanners/java/CertificateChecks.scala
@@ -3,8 +3,8 @@ package io.joern.scanners.java
 import io.joern.scanners.{Crew, QueryTags}
 import io.shiftleft.codepropertygraph.generated._
 import io.joern.console._
-import io.shiftleft.console._
-import io.shiftleft.macros.QueryMacros._
+import io.joern.console._
+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/CompilerOptimizations.scala b/querydb/src/main/scala/io/joern/scanners/java/CompilerOptimizations.scala
index dba64d5df..f68d0f220 100644
--- a/querydb/src/main/scala/io/joern/scanners/java/CompilerOptimizations.scala
+++ b/querydb/src/main/scala/io/joern/scanners/java/CompilerOptimizations.scala
@@ -4,8 +4,8 @@ import io.joern.scanners._
 import io.shiftleft.codepropertygraph.generated.nodes.{Identifier, Type}
 import io.shiftleft.semanticcpg.language._
 import io.joern.console._
-import io.shiftleft.console._
-import io.shiftleft.macros.QueryMacros._
+import io.joern.console._
+import io.joern.macros.QueryMacros._
 import io.shiftleft.semanticcpg.language.operatorextension.opnodes.Assignment
 import io.joern.dataflowengineoss.queryengine.EngineContext
 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 697da0e4c..42aefc792 100644
--- a/querydb/src/main/scala/io/joern/scanners/java/CrossSiteScripting.scala
+++ b/querydb/src/main/scala/io/joern/scanners/java/CrossSiteScripting.scala
@@ -3,8 +3,8 @@ package io.joern.scanners.java;
 import io.joern.scanners._
 import io.shiftleft.semanticcpg.language._
 import io.joern.console._
-import io.shiftleft.console._
-import io.shiftleft.macros.QueryMacros._
+import io.joern.console._
+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 8a52543da..9cf4d639d 100644
--- a/querydb/src/main/scala/io/joern/scanners/java/DangerousFunctions.scala
+++ b/querydb/src/main/scala/io/joern/scanners/java/DangerousFunctions.scala
@@ -3,8 +3,8 @@ package io.joern.scanners.java
 import io.joern.scanners._
 import io.shiftleft.semanticcpg.language._
 import io.joern.console._
-import io.shiftleft.console._
-import io.shiftleft.macros.QueryMacros._
+import io.joern.console._
+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 4c60d8ce3..f13796b70 100644
--- a/querydb/src/main/scala/io/joern/scanners/java/SQLInjection.scala
+++ b/querydb/src/main/scala/io/joern/scanners/java/SQLInjection.scala
@@ -3,8 +3,8 @@ package io.joern.scanners.java;
 import io.joern.scanners._
 import io.shiftleft.semanticcpg.language._
 import io.joern.console._
-import io.shiftleft.console._
-import io.shiftleft.macros.QueryMacros._
+import io.joern.console._
+import io.joern.macros.QueryMacros._
 import io.joern.dataflowengineoss.language._
 import io.joern.dataflowengineoss.queryengine.EngineContext
 


Test patch:
diff --git a/console/src/test/scala/io/joern/console/QueryDatabaseTests.scala b/console/src/test/scala/io/joern/console/QueryDatabaseTests.scala
index 8c455b370..24af7403a 100644
--- a/console/src/test/scala/io/joern/console/QueryDatabaseTests.scala
+++ b/console/src/test/scala/io/joern/console/QueryDatabaseTests.scala
@@ -4,7 +4,7 @@ import io.shiftleft.codepropertygraph.Cpg
 import io.shiftleft.semanticcpg.language._
 import org.scalatest.matchers.should
 import org.scalatest.wordspec.AnyWordSpec
-import io.shiftleft.console.Query
+import io.joern.console.Query
 
 object TestBundle extends QueryBundle {
   @q def foo(n: Int = 4): Query = Query(
diff --git a/querydb/src/test/scala/io/joern/scanners/c/DangerousFunctionsTests.scala b/querydb/src/test/scala/io/joern/scanners/c/DangerousFunctionsTests.scala
index 7be4769ab..e61db4bae 100644
--- a/querydb/src/test/scala/io/joern/scanners/c/DangerousFunctionsTests.scala
+++ b/querydb/src/test/scala/io/joern/scanners/c/DangerousFunctionsTests.scala
@@ -2,7 +2,7 @@ package io.joern.scanners.c
 
 import io.joern.suites.CQueryTestSuite
 import io.shiftleft.codepropertygraph.generated.nodes
-import io.shiftleft.console.Query
+import io.joern.console.Query
 import io.shiftleft.semanticcpg.language._
 import io.joern.console.scan._
 
diff --git a/querydb/src/test/scala/io/joern/suites/CQueryTestSuite.scala b/querydb/src/test/scala/io/joern/suites/CQueryTestSuite.scala
index 197eeedac..41ff04350 100644
--- a/querydb/src/test/scala/io/joern/suites/CQueryTestSuite.scala
+++ b/querydb/src/test/scala/io/joern/suites/CQueryTestSuite.scala
@@ -5,7 +5,7 @@ import io.joern.util.QueryUtil.allQueries
 import io.shiftleft.codepropertygraph.generated.nodes
 import io.joern.console.scan._
 import io.joern.console.{QueryBundle, QueryDatabase}
-import io.shiftleft.console.Query
+import io.joern.console.Query
 import io.joern.fuzzyc2cpg.testfixtures.DataFlowCodeToCpgSuite
 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 da5ca730f..c27d806d4 100644
--- a/querydb/src/test/scala/io/joern/suites/GhidraQueryTestSuite.scala
+++ b/querydb/src/test/scala/io/joern/suites/GhidraQueryTestSuite.scala
@@ -5,7 +5,7 @@ import io.joern.console.scan._
 import io.joern.ghidra2cpg.fixtures.DataFlowBinToCpgSuite
 import io.joern.util.QueryUtil
 import io.shiftleft.codepropertygraph.generated.nodes
-import io.shiftleft.console.Query
+import io.joern.console.Query
 import io.shiftleft.semanticcpg.language._
 import io.shiftleft.utils.ProjectRoot
 import overflowdb.traversal.iterableToTraversal
diff --git a/querydb/src/test/scala/io/joern/util/QueryUtil.scala b/querydb/src/test/scala/io/joern/util/QueryUtil.scala
index c9954c726..a37b1e305 100644
--- a/querydb/src/test/scala/io/joern/util/QueryUtil.scala
+++ b/querydb/src/test/scala/io/joern/util/QueryUtil.scala
@@ -2,7 +2,7 @@ package io.joern.util
 
 import io.joern.suites.QDBArgumentProvider
 import io.joern.console.{QueryBundle, QueryDatabase}
-import io.shiftleft.console.Query
+import io.joern.console.Query
 
 object QueryUtil {
   object EmptyBundle extends QueryBundle