Skip to content
This repository was archived by the owner on Oct 27, 2021. It is now read-only.

Commit

Permalink
Merge pull request #103 from joernio/claudiu/fixid
Browse files Browse the repository at this point in the history
Ensure uniqueness of query names across bundles
  • Loading branch information
ursachec authored Sep 3, 2021
2 parents 21373a6 + 1a4f607 commit 8e9d25d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ object DangerousFunctions extends QueryBundle {
@q
def strcpyUsed(): Query =
Query.make(
name = "call-to-strcpy",
name = "call-to-strcpy-ghidra",
author = Crew.suchakra,
title = "Dangerous functions `strcpy` or `strncpy` used",
description =
Expand Down
27 changes: 27 additions & 0 deletions src/test/scala/io/joern/suites/AllBundlesTestSuite.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package io.joern.suites

import io.shiftleft.console.QueryDatabase
import io.shiftleft.semanticcpg.language._
import org.scalatest.wordspec.AnyWordSpec
import io.shiftleft.dataflowengineoss.queryengine.EngineContext
import io.shiftleft.dataflowengineoss.semanticsloader.Semantics
import org.scalatest.matchers.should.Matchers.convertToAnyShouldWrapper

import org.scalatest.matchers.should.Matchers._


class AllBundlesTestSuite extends AnyWordSpec {
val argumentProvider = new QDBArgumentProvider(3)

"Complete QueryDatabase" should {
"should contain queries with unique names" in {
val qdb = new QueryDatabase(argumentProvider)
val nonUniqueNames =
qdb.allQueries
.groupBy(_.name)
.filter{ q => q._2.size > 1 }
.map(_._1)
nonUniqueNames shouldBe List()
}
}
}

0 comments on commit 8e9d25d

Please sign in to comment.