From 12f4c9f29988f3bf996c5a821a56e29324711a7c Mon Sep 17 00:00:00 2001 From: Valera V Harseko Date: Thu, 9 Jul 2026 14:36:29 +0300 Subject: [PATCH] Add CodeQL security analysis workflow Adds a CodeQL scanning workflow (java-kotlin, javascript-typescript, actions) using build-mode 'none', running on push/PR to master, a weekly schedule, and manual dispatch. --- .github/workflows/codeql.yml | 116 +++++++++++++++++++++++++++++++++++ 1 file changed, 116 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 00000000..60046426 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,116 @@ +# The contents of this file are subject to the terms of the Common Development and +# Distribution License (the License). You may not use this file except in compliance with the +# License. +# +# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the +# specific language governing permission and limitations under the License. +# +# When distributing Covered Software, include this CDDL Header Notice in each file and include +# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL +# Header, with the fields enclosed by brackets [] replaced by your own identifying +# information: "Portions copyright [year] [name of copyright owner]". +# +# Copyright 2026 3A Systems, LLC. +name: "CodeQL" + +on: + push: + branches: [ 'master' ] + pull_request: + branches: [ 'sustaining/5.4.x', 'master' ] + schedule: + # Weekly run, Mondays at 03:27 UTC + - cron: '27 3 * * 1' + # Allows running this workflow manually from the Actions tab or via the gh CLI. + workflow_dispatch: + +# Cancel superseded runs on the same ref to avoid the long-running, +# eventually-cancelled analyses seen with the previous default setup. +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + runs-on: ubuntu-latest + timeout-minutes: 360 + permissions: + # Required to upload results to code scanning. + security-events: write + # Only needed for workflows in private repositories. + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + # This large multi-module Maven build is expensive to compile, so we + # use build-mode 'none': CodeQL builds its model straight from the + # Java/Kotlin sources without invoking Maven. This avoids the long, + # eventually-cancelled autobuild that the previous default setup hit. + # + # For higher precision (dataflow through compiled dependencies) switch + # this to 'manual' and uncomment the "Build with Maven" step below. + - language: java-kotlin + build-mode: none + # The openig-ui / openig-doc modules. Interpreted, so no compilation: + # extracted straight from source. + - language: javascript-typescript + build-mode: none + # Scans the repository's own GitHub Actions workflows. + - language: actions + build-mode: none + + steps: + - name: Checkout repository + uses: actions/checkout@v7 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v4 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + queries: security-and-quality + # Exclude test sources and generated / vendored output. With + # build-mode 'none' CodeQL extracts straight from source, so + # paths-ignore reliably scopes the analysis (it is honored for + # compiled languages only when build-mode is 'none'). + config: | + paths-ignore: + - '**/src/test/**' + - '**/src/it/**' + # Third-party / vendored JavaScript — analysing it only adds noise. + - '**/*.min.js' + - '**/node_modules/**' + - '**/test-output/**' + # Generated Maven / build output (bundles vendored CodeMirror etc.). + - '**/target/**' + - '**/bin/**' + + # --- Manual build (only used when build-mode is 'manual') ------------- + # - name: Set up JDK 11 + # uses: actions/setup-java@v5 + # with: + # java-version: '11' + # distribution: 'zulu' + # - name: Cache Maven packages + # uses: actions/cache@v6 + # with: + # path: ~/.m2/repository + # key: ${{ runner.os }}-m2-repository-${{ hashFiles('**/pom.xml') }} + # restore-keys: ${{ runner.os }}-m2-repository + # - name: Build with Maven + # env: + # MAVEN_OPTS: -Dhttps.protocols=TLSv1.2 -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 -Dmaven.wagon.http.retryHandler.requestSentEnabled=true -Dmaven.wagon.http.retryHandler.count=10 + # run: mvn --batch-mode --errors -DskipTests -Dmaven.test.skip=true clean compile --file pom.xml + # --------------------------------------------------------------------- + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v4 + with: + category: "/language:${{ matrix.language }}"