From 3c6752644a2994cc1d20f41dd9b8e3b7c2a5819f Mon Sep 17 00:00:00 2001 From: Alexey <247128645+axkurcom@users.noreply.github.com> Date: Thu, 12 Feb 2026 18:56:08 +0300 Subject: [PATCH 1/4] Create codeql.yml --- .github/workflows/codeql.yml | 46 ++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..c98d8d9 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,46 @@ +name: "CodeQL Advanced" + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + schedule: + - cron: '0 0 * * 0' + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + + permissions: + security-events: write + packages: read + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + - language: actions + build-mode: none + - language: rust + build-mode: none + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v4 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + config-file: .github/codeql/codeql-config.yml + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v4 + with: + category: "/language:${{ matrix.language }}" +)Ж00 From 6e445be108b32562e7bd560b93a40a16dbf4d8d2 Mon Sep 17 00:00:00 2001 From: Alexey <247128645+axkurcom@users.noreply.github.com> Date: Thu, 12 Feb 2026 18:58:03 +0300 Subject: [PATCH 2/4] CodeQL Tuning --- .../queries/common/ProductionOnly.qll | 20 +++++++++++++++++++ .github/workflows/queries/qlpack.yml | 4 ++++ 2 files changed, 24 insertions(+) create mode 100644 .github/workflows/queries/common/ProductionOnly.qll create mode 100644 .github/workflows/queries/qlpack.yml diff --git a/.github/workflows/queries/common/ProductionOnly.qll b/.github/workflows/queries/common/ProductionOnly.qll new file mode 100644 index 0000000..c51cb3a --- /dev/null +++ b/.github/workflows/queries/common/ProductionOnly.qll @@ -0,0 +1,20 @@ +import rust + +predicate isTestOnly(Item i) { + exists(ConditionalCompilation cc | + cc.getItem() = i and + cc.getCfg().toString() = "test" + ) +} + +predicate hasTestAttribute(Item i) { + exists(Attribute a | + a.getItem() = i and + a.getName() = "test" + ) +} + +predicate isProductionCode(Item i) { + not isTestOnly(i) and + not hasTestAttribute(i) +} diff --git a/.github/workflows/queries/qlpack.yml b/.github/workflows/queries/qlpack.yml new file mode 100644 index 0000000..c9da5ba --- /dev/null +++ b/.github/workflows/queries/qlpack.yml @@ -0,0 +1,4 @@ +name: rust-production-only +version: 0.0.1 +dependencies: + codeql/rust-all: "*" From 3ba97a08fac9681938efaf496a28e2fee25bd897 Mon Sep 17 00:00:00 2001 From: Alexey <247128645+axkurcom@users.noreply.github.com> Date: Thu, 12 Feb 2026 18:58:42 +0300 Subject: [PATCH 3/4] Update codeql.yml --- .github/workflows/codeql.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index c98d8d9..3ad41f5 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -43,4 +43,4 @@ jobs: uses: github/codeql-action/analyze@v4 with: category: "/language:${{ matrix.language }}" -)Ж00 +) From 91eea914b36fe889ec3c481c292181930b756159 Mon Sep 17 00:00:00 2001 From: Alexey <247128645+axkurcom@users.noreply.github.com> Date: Thu, 12 Feb 2026 19:00:12 +0300 Subject: [PATCH 4/4] Update codeql.yml --- .github/workflows/codeql.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 3ad41f5..d830d0b 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -43,4 +43,3 @@ jobs: uses: github/codeql-action/analyze@v4 with: category: "/language:${{ matrix.language }}" -)