From 6b728acd9e9a811b1e41667a83c9b970f117bdeb Mon Sep 17 00:00:00 2001 From: Tom Hvitved Date: Thu, 1 Sep 2022 19:34:18 +0200 Subject: [PATCH] Use specific `codeql/shared-ssa` pack for the SSA library --- .github/workflows/ruby-build.yml | 2 +- codeql-workspace.yml | 1 + cpp/ql/lib/qlpack.yml | 2 +- .../code/cpp/ir/dataflow/internal/SsaInternals.qll | 2 +- csharp/ql/lib/qlpack.yml | 2 +- csharp/ql/lib/semmle/code/cil/internal/SsaImpl.qll | 2 +- .../code/csharp/controlflow/internal/PreSsa.qll | 2 +- .../semmle/code/csharp/dataflow/internal/BaseSSA.qll | 2 +- .../semmle/code/csharp/dataflow/internal/SsaImpl.qll | 2 +- ruby/ql/lib/codeql/ruby/dataflow/internal/SsaImpl.qll | 2 +- ruby/ql/lib/qlpack.yml | 2 +- shared/README.md | 11 ++++++++--- .../shared/dataflow => ssa/codeql/shared/ssa}/Ssa.qll | 0 shared/{ql/lib => ssa}/qlpack.yml | 2 +- swift/ql/lib/codeql/swift/dataflow/Ssa.qll | 2 +- swift/ql/lib/qlpack.yml | 2 +- 16 files changed, 22 insertions(+), 16 deletions(-) rename shared/{ql/lib/codeql/shared/dataflow => ssa/codeql/shared/ssa}/Ssa.qll (100%) rename shared/{ql/lib => ssa}/qlpack.yml (64%) diff --git a/.github/workflows/ruby-build.yml b/.github/workflows/ruby-build.yml index 264739a121a..08e2b0b4ab6 100644 --- a/.github/workflows/ruby-build.yml +++ b/.github/workflows/ruby-build.yml @@ -95,7 +95,7 @@ jobs: uses: ./.github/actions/fetch-codeql - name: Build Query Pack run: | - codeql pack create ../shared/ql/lib --output target/packs + codeql pack create ../shared/ssa --output target/packs codeql pack create ql/lib --output target/packs codeql pack install ql/src codeql pack create ql/src --output target/packs diff --git a/codeql-workspace.yml b/codeql-workspace.yml index 1bf0510af50..8a7f2bd7a74 100644 --- a/codeql-workspace.yml +++ b/codeql-workspace.yml @@ -4,6 +4,7 @@ provide: - "*/ql/test/qlpack.yml" - "*/ql/examples/qlpack.yml" - "*/ql/consistency-queries/qlpack.yml" + - "shared/*/qlpack.yml" - "cpp/ql/test/query-tests/Security/CWE/CWE-190/semmle/tainted/qlpack.yml" - "go/ql/config/legacy-support/qlpack.yml" - "go/build/codeql-extractor-go/codeql-extractor.yml" diff --git a/cpp/ql/lib/qlpack.yml b/cpp/ql/lib/qlpack.yml index d986d7af231..352980868a9 100644 --- a/cpp/ql/lib/qlpack.yml +++ b/cpp/ql/lib/qlpack.yml @@ -6,4 +6,4 @@ extractor: cpp library: true upgrades: upgrades dependencies: - codeql/shared-all: "*" + codeql/shared-ssa: "*" diff --git a/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/SsaInternals.qll b/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/SsaInternals.qll index 955a006b9e2..9763cedd3c9 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/SsaInternals.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/SsaInternals.qll @@ -4,7 +4,7 @@ private import DataFlowUtil private import DataFlowImplCommon as DataFlowImplCommon private import semmle.code.cpp.models.interfaces.Allocation as Alloc private import semmle.code.cpp.models.interfaces.DataFlow as DataFlow -private import codeql.shared.dataflow.Ssa as SsaImplCommon +private import codeql.shared.ssa.Ssa as SsaImplCommon private module SourceVariables { private newtype TSourceVariable = diff --git a/csharp/ql/lib/qlpack.yml b/csharp/ql/lib/qlpack.yml index 004a99624e7..744a7f6efed 100644 --- a/csharp/ql/lib/qlpack.yml +++ b/csharp/ql/lib/qlpack.yml @@ -6,4 +6,4 @@ extractor: csharp library: true upgrades: upgrades dependencies: - codeql/shared-all: "*" + codeql/shared-ssa: "*" diff --git a/csharp/ql/lib/semmle/code/cil/internal/SsaImpl.qll b/csharp/ql/lib/semmle/code/cil/internal/SsaImpl.qll index d3ce273b1ec..70673846caf 100644 --- a/csharp/ql/lib/semmle/code/cil/internal/SsaImpl.qll +++ b/csharp/ql/lib/semmle/code/cil/internal/SsaImpl.qll @@ -1,5 +1,5 @@ private import cil -private import codeql.shared.dataflow.Ssa as SsaImplCommon +private import codeql.shared.ssa.Ssa as SsaImplCommon private module SsaInput implements SsaImplCommon::InputSig { class BasicBlock = CIL::BasicBlock; diff --git a/csharp/ql/lib/semmle/code/csharp/controlflow/internal/PreSsa.qll b/csharp/ql/lib/semmle/code/csharp/controlflow/internal/PreSsa.qll index 900d363eff7..2f11301d94c 100644 --- a/csharp/ql/lib/semmle/code/csharp/controlflow/internal/PreSsa.qll +++ b/csharp/ql/lib/semmle/code/csharp/controlflow/internal/PreSsa.qll @@ -9,7 +9,7 @@ module PreSsa { private import AssignableDefinitions private import semmle.code.csharp.controlflow.internal.ControlFlowGraphImpl private import semmle.code.csharp.controlflow.internal.PreBasicBlocks as PreBasicBlocks - private import codeql.shared.dataflow.Ssa as SsaImplCommon + private import codeql.shared.ssa.Ssa as SsaImplCommon private predicate definitionAt( AssignableDefinition def, SsaInput::BasicBlock bb, int i, SsaInput::SourceVariable v diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/BaseSSA.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/BaseSSA.qll index 0a4482cbc05..cd1f3e4e3cb 100644 --- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/BaseSSA.qll +++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/BaseSSA.qll @@ -5,7 +5,7 @@ import csharp */ module BaseSsa { private import AssignableDefinitions - private import codeql.shared.dataflow.Ssa as SsaImplCommon + private import codeql.shared.ssa.Ssa as SsaImplCommon /** * Holds if the `i`th node of basic block `bb` is assignable definition `def`, diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/SsaImpl.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/SsaImpl.qll index 0329ccdd04e..04aa563135b 100644 --- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/SsaImpl.qll +++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/SsaImpl.qll @@ -3,7 +3,7 @@ */ import csharp -private import codeql.shared.dataflow.Ssa as SsaImplCommon +private import codeql.shared.ssa.Ssa as SsaImplCommon private import AssignableDefinitions private module SsaInput implements SsaImplCommon::InputSig { diff --git a/ruby/ql/lib/codeql/ruby/dataflow/internal/SsaImpl.qll b/ruby/ql/lib/codeql/ruby/dataflow/internal/SsaImpl.qll index 371949c696d..305e5a9bebb 100644 --- a/ruby/ql/lib/codeql/ruby/dataflow/internal/SsaImpl.qll +++ b/ruby/ql/lib/codeql/ruby/dataflow/internal/SsaImpl.qll @@ -1,4 +1,4 @@ -private import codeql.shared.dataflow.Ssa as SsaImplCommon +private import codeql.shared.ssa.Ssa as SsaImplCommon private import codeql.ruby.AST private import codeql.ruby.CFG as CFG private import codeql.ruby.ast.Variable diff --git a/ruby/ql/lib/qlpack.yml b/ruby/ql/lib/qlpack.yml index 7a068872885..530baff8355 100644 --- a/ruby/ql/lib/qlpack.yml +++ b/ruby/ql/lib/qlpack.yml @@ -6,4 +6,4 @@ dbscheme: ruby.dbscheme upgrades: upgrades library: true dependencies: - codeql/shared-all: "*" + codeql/shared-ssa: "*" diff --git a/shared/README.md b/shared/README.md index 06d1145871d..0881c1c1cdb 100644 --- a/shared/README.md +++ b/shared/README.md @@ -2,11 +2,16 @@ This folder contains shared, language-agnostic CodeQL libraries. -They can be used by adding +Libraries are organized into separate query packs, in order to allow for +individual versioning. For example, the shared static single assignment (SSA) +library exists in the `codeql/shared-ssa` pack, which can be referenced by adding ``` dependencies: - codeql/shared-all: "*" + codeql/shared-ssa: "*" ``` -to `qlpack.yml`, and the libraries all belong to the `codeql.shared` namespace. \ No newline at end of file +to `qlpack.yml`. + +All shared libraries will belong to a `codeql/shared-` pack, and live in the +namespace `codeql.shared.`. \ No newline at end of file diff --git a/shared/ql/lib/codeql/shared/dataflow/Ssa.qll b/shared/ssa/codeql/shared/ssa/Ssa.qll similarity index 100% rename from shared/ql/lib/codeql/shared/dataflow/Ssa.qll rename to shared/ssa/codeql/shared/ssa/Ssa.qll diff --git a/shared/ql/lib/qlpack.yml b/shared/ssa/qlpack.yml similarity index 64% rename from shared/ql/lib/qlpack.yml rename to shared/ssa/qlpack.yml index b82b47e882b..d30ba8baa6b 100644 --- a/shared/ql/lib/qlpack.yml +++ b/shared/ssa/qlpack.yml @@ -1,4 +1,4 @@ -name: codeql/shared-all +name: codeql/shared-ssa version: 0.0.1 groups: shared library: true diff --git a/swift/ql/lib/codeql/swift/dataflow/Ssa.qll b/swift/ql/lib/codeql/swift/dataflow/Ssa.qll index 4a41fed5ad1..11520821708 100644 --- a/swift/ql/lib/codeql/swift/dataflow/Ssa.qll +++ b/swift/ql/lib/codeql/swift/dataflow/Ssa.qll @@ -1,7 +1,7 @@ cached module Ssa { private import swift - private import codeql.shared.dataflow.Ssa as SsaImplCommon + private import codeql.shared.ssa.Ssa as SsaImplCommon private import codeql.swift.controlflow.CfgNodes private import codeql.swift.controlflow.ControlFlowGraph private import codeql.swift.controlflow.BasicBlocks as BasicBlocks diff --git a/swift/ql/lib/qlpack.yml b/swift/ql/lib/qlpack.yml index 99ca70e399a..87a43a7672b 100644 --- a/swift/ql/lib/qlpack.yml +++ b/swift/ql/lib/qlpack.yml @@ -6,4 +6,4 @@ dbscheme: swift.dbscheme upgrades: upgrades library: true dependencies: - codeql/shared-all: "*" + codeql/shared-ssa: "*"