From 6e784ae8c8d82f129ceb341c3ffb285e5ef52475 Mon Sep 17 00:00:00 2001 From: Oleg Ovcharuk Date: Mon, 5 Oct 2026 18:10:27 +0300 Subject: [PATCH 1/4] ci: standardize CodeQL security analysis --- .github/codeql/README.md | 9 +++++ .github/codeql/actions.yml | 4 +++ .github/codeql/sdk.yml | 4 +++ .github/workflows/codeql.yml | 66 ++++++++++++++++++++++++++++++++++++ 4 files changed, 83 insertions(+) create mode 100644 .github/codeql/README.md create mode 100644 .github/codeql/actions.yml create mode 100644 .github/codeql/sdk.yml create mode 100644 .github/workflows/codeql.yml diff --git a/.github/codeql/README.md b/.github/codeql/README.md new file mode 100644 index 000000000..2e4aa5a9e --- /dev/null +++ b/.github/codeql/README.md @@ -0,0 +1,9 @@ +# Security analysis + +The CodeQL workflow runs the `security-extended` query suite for the SDK language and GitHub Actions on pull requests, pushes, merge queues and a weekly schedule. It can also be started manually. + +The SDK scan traces clean Maven builds of the reactor and the separate auth-api project, with test compilation disabled. + +Results are published to **Security and quality → Code scanning**, with a separate category for each language. Review initial findings and record a reason for every dismissed alert. + +After merging, configure a branch ruleset with **Require code scanning results → CodeQL → Security alerts: High or higher** for supported branches. Successful workflow execution alone does not enforce this threshold. Track the latest analysis commit/date, extraction errors and open findings by security severity. diff --git a/.github/codeql/actions.yml b/.github/codeql/actions.yml new file mode 100644 index 000000000..57959b9da --- /dev/null +++ b/.github/codeql/actions.yml @@ -0,0 +1,4 @@ +name: GitHub Actions security baseline + +queries: + - uses: security-extended diff --git a/.github/codeql/sdk.yml b/.github/codeql/sdk.yml new file mode 100644 index 000000000..61d31213b --- /dev/null +++ b/.github/codeql/sdk.yml @@ -0,0 +1,4 @@ +name: SDK security baseline + +queries: + - uses: security-extended diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 000000000..f7f359b54 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,66 @@ +name: CodeQL + +on: + push: + branches: ["master", "develop", "release*"] + pull_request: + branches: ["master", "develop", "release*"] + merge_group: + schedule: + - cron: '23 3 * * 1' + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: codeql-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + analyze: + name: CodeQL (${{ matrix.language }}) + runs-on: ubuntu-24.04 + timeout-minutes: 45 + permissions: + contents: read + security-events: write + strategy: + fail-fast: false + matrix: + include: + - language: java-kotlin + build-mode: manual + config: .github/codeql/sdk.yml + - language: actions + build-mode: none + config: .github/codeql/actions.yml + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Set up Java + if: matrix.language == 'java-kotlin' + uses: actions/setup-java@v5 + with: + distribution: temurin + java-version: '17' + cache: maven + + - name: Initialize CodeQL + uses: github/codeql-action/init@v4 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + config-file: ${{ matrix.config }} + + - name: Build Java SDK and authentication API + if: matrix.language == 'java-kotlin' + run: | + mvn --batch-mode --no-transfer-progress -Dmaven.test.skip=true clean package + mvn --batch-mode --no-transfer-progress -Dmaven.test.skip=true -f auth-api/pom.xml clean package + + - name: Analyze and upload results + uses: github/codeql-action/analyze@v4 + with: + category: /language:${{ matrix.language }} From 818a5bffdf3fc568c6c3b5f14c97e70486c39ca7 Mon Sep 17 00:00:00 2001 From: Oleg Ovcharuk Date: Mon, 5 Oct 2026 18:17:47 +0300 Subject: [PATCH 2/4] docs: require complete CodeQL analysis --- .github/codeql/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/codeql/README.md b/.github/codeql/README.md index 2e4aa5a9e..c71cb3fca 100644 --- a/.github/codeql/README.md +++ b/.github/codeql/README.md @@ -6,4 +6,4 @@ The SDK scan traces clean Maven builds of the reactor and the separate auth-api Results are published to **Security and quality → Code scanning**, with a separate category for each language. Review initial findings and record a reason for every dismissed alert. -After merging, configure a branch ruleset with **Require code scanning results → CodeQL → Security alerts: High or higher** for supported branches. Successful workflow execution alone does not enforce this threshold. Track the latest analysis commit/date, extraction errors and open findings by security severity. +After merging, require both **CodeQL (java-kotlin)** and **CodeQL (actions)** job checks for supported branches. Also enable **Require code scanning results → CodeQL → Security alerts: High or higher** in the branch ruleset. Successful workflow execution alone does not enforce this threshold. Track the latest analysis commit/date, extraction errors and open findings by security severity. From 2b0aeb97b3bc55d8443d5751e1750401e99d72e2 Mon Sep 17 00:00:00 2001 From: Oleg Ovcharuk Date: Wed, 7 Oct 2026 16:03:40 +0300 Subject: [PATCH 3/4] ci: build auth-api through the Maven profile for CodeQL --- .github/codeql/README.md | 2 +- .github/workflows/codeql.yml | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/codeql/README.md b/.github/codeql/README.md index c71cb3fca..f0ef0bd07 100644 --- a/.github/codeql/README.md +++ b/.github/codeql/README.md @@ -2,7 +2,7 @@ The CodeQL workflow runs the `security-extended` query suite for the SDK language and GitHub Actions on pull requests, pushes, merge queues and a weekly schedule. It can also be started manually. -The SDK scan traces clean Maven builds of the reactor and the separate auth-api project, with test compilation disabled. +The SDK scan traces a clean Maven reactor build with the `with-auth-api` profile, which includes the authentication API, and test compilation disabled. Results are published to **Security and quality → Code scanning**, with a separate category for each language. Review initial findings and record a reason for every dismissed alert. diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index f7f359b54..bdd590097 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -57,8 +57,7 @@ jobs: - name: Build Java SDK and authentication API if: matrix.language == 'java-kotlin' run: | - mvn --batch-mode --no-transfer-progress -Dmaven.test.skip=true clean package - mvn --batch-mode --no-transfer-progress -Dmaven.test.skip=true -f auth-api/pom.xml clean package + mvn --batch-mode --no-transfer-progress -Pwith-auth-api -Dmaven.test.skip=true clean package - name: Analyze and upload results uses: github/codeql-action/analyze@v4 From 68dc54ba152b67bf9aac9dd8fd57a05be469d2a3 Mon Sep 17 00:00:00 2001 From: Alexandr Gorshenin Date: Wed, 7 Oct 2026 17:01:30 +0300 Subject: [PATCH 4/4] Updated version by alex268 --- .github/codeql/README.md | 9 ------ .github/codeql/actions.yml | 4 --- .github/codeql/sdk.yml | 4 --- .github/workflows/codeql.yml | 61 +++++++++++++++++++----------------- 4 files changed, 33 insertions(+), 45 deletions(-) delete mode 100644 .github/codeql/README.md delete mode 100644 .github/codeql/actions.yml delete mode 100644 .github/codeql/sdk.yml diff --git a/.github/codeql/README.md b/.github/codeql/README.md deleted file mode 100644 index f0ef0bd07..000000000 --- a/.github/codeql/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Security analysis - -The CodeQL workflow runs the `security-extended` query suite for the SDK language and GitHub Actions on pull requests, pushes, merge queues and a weekly schedule. It can also be started manually. - -The SDK scan traces a clean Maven reactor build with the `with-auth-api` profile, which includes the authentication API, and test compilation disabled. - -Results are published to **Security and quality → Code scanning**, with a separate category for each language. Review initial findings and record a reason for every dismissed alert. - -After merging, require both **CodeQL (java-kotlin)** and **CodeQL (actions)** job checks for supported branches. Also enable **Require code scanning results → CodeQL → Security alerts: High or higher** in the branch ruleset. Successful workflow execution alone does not enforce this threshold. Track the latest analysis commit/date, extraction errors and open findings by security severity. diff --git a/.github/codeql/actions.yml b/.github/codeql/actions.yml deleted file mode 100644 index 57959b9da..000000000 --- a/.github/codeql/actions.yml +++ /dev/null @@ -1,4 +0,0 @@ -name: GitHub Actions security baseline - -queries: - - uses: security-extended diff --git a/.github/codeql/sdk.yml b/.github/codeql/sdk.yml deleted file mode 100644 index 61d31213b..000000000 --- a/.github/codeql/sdk.yml +++ /dev/null @@ -1,4 +0,0 @@ -name: SDK security baseline - -queries: - - uses: security-extended diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index bdd590097..7378e978e 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -2,45 +2,52 @@ name: CodeQL on: push: - branches: ["master", "develop", "release*"] + branches: ["master", "release*"] pull_request: - branches: ["master", "develop", "release*"] - merge_group: + type: [opened, reopened, edited, synchronize] schedule: - cron: '23 3 * * 1' - workflow_dispatch: permissions: contents: read + security-events: write concurrency: group: codeql-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: - analyze: - name: CodeQL (${{ matrix.language }}) + analyze-actions: + name: CodeQL (Github Actions) runs-on: ubuntu-24.04 timeout-minutes: 45 - permissions: - contents: read - security-events: write - strategy: - fail-fast: false - matrix: - include: - - language: java-kotlin - build-mode: manual - config: .github/codeql/sdk.yml - - language: actions - build-mode: none - config: .github/codeql/actions.yml + + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v4 + with: + languages: actions + build-mode: none + queries: security-extended + + - name: Analyze and upload results + uses: github/codeql-action/analyze@v4 + with: + category: /language:actions + + analyze-sdk: + name: CodeQL (YDB Java SDK) + runs-on: ubuntu-24.04 + timeout-minutes: 45 + steps: - name: Checkout uses: actions/checkout@v6 - name: Set up Java - if: matrix.language == 'java-kotlin' uses: actions/setup-java@v5 with: distribution: temurin @@ -50,16 +57,14 @@ jobs: - name: Initialize CodeQL uses: github/codeql-action/init@v4 with: - languages: ${{ matrix.language }} - build-mode: ${{ matrix.build-mode }} - config-file: ${{ matrix.config }} + languages: java-kotlin + build-mode: manual + queries: security-extended - - name: Build Java SDK and authentication API - if: matrix.language == 'java-kotlin' - run: | - mvn --batch-mode --no-transfer-progress -Pwith-auth-api -Dmaven.test.skip=true clean package + - name: Build Java SDK + run: mvn --batch-mode --no-transfer-progress -Pwith-auth-api -Dmaven.test.skip=true clean package - name: Analyze and upload results uses: github/codeql-action/analyze@v4 with: - category: /language:${{ matrix.language }} + category: /language:java-kotlin