From 086fe9a2da777a79c0560c55de8413edfc583851 Mon Sep 17 00:00:00 2001 From: Josh Eckels Date: Thu, 4 Dec 2025 13:41:50 -0800 Subject: [PATCH 01/12] Enable Kotlin analysis in CodeQL workflow Changed build mode for Java-Kotlin from 'none' to 'autobuild' to enable Kotlin analysis. --- .github/workflows/codeql.yml | 103 +++++++++++++++++++++++++++++++++++ 1 file changed, 103 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 000000000..9fed4a92d --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,103 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL Advanced" + +on: + push: + branches: [ "develop", "release*" ] + pull_request: + branches: [ "develop", "release*" ] + schedule: + - cron: '36 17 * * 1' + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners (GitHub.com only) + # Consider using larger runners or machines with greater resources for possible analysis time improvements. + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + permissions: + # required for all workflows + security-events: write + + # required to fetch internal or private CodeQL packs + packages: read + + # only required for workflows in private repositories + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + - language: actions + build-mode: none + - language: java-kotlin + build-mode: autobuild # This mode only analyzes Java. Set this to 'autobuild' or 'manual' to analyze Kotlin too. + - language: javascript-typescript + build-mode: none + # CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift' + # Use `c-cpp` to analyze code written in C, C++ or both + # Use 'java-kotlin' to analyze code written in Java, Kotlin or both + # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both + # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, + # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. + # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how + # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Add any setup steps before running the `github/codeql-action/init` action. + # This includes steps like installing compilers or runtimes (`actions/setup-node` + # or others). This is typically only required for manual builds. + # - name: Setup runtime (example) + # uses: actions/setup-example@v1 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v4 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + # If the analyze step fails for one of the languages you are analyzing with + # "We were unable to automatically build your code", modify the matrix above + # to set the build mode to "manual" for that language. Then modify this step + # to build your code. + # â„šī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + - name: Run manual build steps + if: matrix.build-mode == 'manual' + shell: bash + run: | + echo 'If you are using a "manual" build mode for one or more of the' \ + 'languages you are analyzing, replace this with the commands to build' \ + 'your code, for example:' + echo ' make bootstrap' + echo ' make release' + exit 1 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v4 + with: + category: "/language:${{matrix.language}}" From 05a972974cf2a8e1873a0649cf7dfe2f3801dca0 Mon Sep 17 00:00:00 2001 From: Josh Eckels Date: Thu, 4 Dec 2025 13:51:14 -0800 Subject: [PATCH 02/12] Update CodeQL build mode for Java-Kotlin Changed build mode for Java-Kotlin from autobuild to manual to allow for Kotlin analysis. --- .github/workflows/codeql.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 9fed4a92d..26c029c76 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -46,7 +46,7 @@ jobs: - language: actions build-mode: none - language: java-kotlin - build-mode: autobuild # This mode only analyzes Java. Set this to 'autobuild' or 'manual' to analyze Kotlin too. + build-mode: manual # This mode only analyzes Java. Set this to 'autobuild' or 'manual' to analyze Kotlin too. - language: javascript-typescript build-mode: none # CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift' @@ -95,6 +95,12 @@ jobs: 'your code, for example:' echo ' make bootstrap' echo ' make release' + git clone https://github.com/LabKey/server + cd server/modules + git clone https://github.com/LabKey/platform + git clone https://github.com/LabKey/commonAssays + cd ../.. + ./gradlew deployApp exit 1 - name: Perform CodeQL Analysis From 25e09659eafe5aa4649d93e8d641be2d8a856c57 Mon Sep 17 00:00:00 2001 From: Josh Eckels Date: Mon, 8 Dec 2025 08:04:06 -0800 Subject: [PATCH 03/12] Modify CodeQL workflow for repository checkouts Updated CodeQL workflow to checkout multiple LabKey repositories. --- .github/workflows/codeql.yml | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 26c029c76..beeef4d12 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -58,8 +58,23 @@ jobs: # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages steps: - - name: Checkout repository + - name: Checkout LabKey/server uses: actions/checkout@v4 + with: + repository: LabKey/server + + - name: Checkout LabKey/platform + uses: actions/checkout@v4 + with: + repository: LabKey/platform + path: server/modules/platform + + - name: Checkout LabKey/commonAssays + uses: actions/checkout@v4 + with: + repository: LabKey/commonAssays + path: server/modules/commonAssays + # Add any setup steps before running the `github/codeql-action/init` action. # This includes steps like installing compilers or runtimes (`actions/setup-node` @@ -95,11 +110,6 @@ jobs: 'your code, for example:' echo ' make bootstrap' echo ' make release' - git clone https://github.com/LabKey/server - cd server/modules - git clone https://github.com/LabKey/platform - git clone https://github.com/LabKey/commonAssays - cd ../.. ./gradlew deployApp exit 1 From 4722aa6e3374189ff25e079486d10616a17d0daf Mon Sep 17 00:00:00 2001 From: Josh Eckels Date: Mon, 8 Dec 2025 08:19:33 -0800 Subject: [PATCH 04/12] Remove exit command from CodeQL workflow Removed exit command after deploying the app. --- .github/workflows/codeql.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index beeef4d12..8755e2fd0 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -111,7 +111,6 @@ jobs: echo ' make bootstrap' echo ' make release' ./gradlew deployApp - exit 1 - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v4 From ace181c468ef4982190f5d49b202abb06e5b72cf Mon Sep 17 00:00:00 2001 From: Chad Bentz <1760475+felickz@users.noreply.github.com> Date: Wed, 10 Dec 2025 16:14:32 -0500 Subject: [PATCH 05/12] Add repository owner reference to CodeQL analysis (#965) * Add repository owner reference to CodeQL analysis Added a reference to the repository owner in CodeQL analysis. * sha in CodeQL workflow is required if specifying ref --- .github/workflows/codeql.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 8755e2fd0..0dc87bb2c 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -116,3 +116,5 @@ jobs: uses: github/codeql-action/analyze@v4 with: category: "/language:${{matrix.language}}" + ref: ${{ github.repository_owner }} # since we are running this command in the root dir and that root is cloned via LabKey/server + sha: ${{ github.sha }} From 4b2f5a5689ae1893690d934c5a2e8960e1ac066c Mon Sep 17 00:00:00 2001 From: Josh Eckels Date: Wed, 10 Dec 2025 17:20:54 -0800 Subject: [PATCH 06/12] Update checkout action to use pull request head SHA --- .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 0dc87bb2c..475e86f28 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -74,7 +74,7 @@ jobs: with: repository: LabKey/commonAssays path: server/modules/commonAssays - + ref: ${{ github.event.pull_request.head.sha || github.sha }} # Add any setup steps before running the `github/codeql-action/init` action. # This includes steps like installing compilers or runtimes (`actions/setup-node` From 3be8aac8b9b463d8443a9102aa1651a31fc9bc6e Mon Sep 17 00:00:00 2001 From: RusselViola Date: Thu, 11 Dec 2025 13:48:29 -0500 Subject: [PATCH 07/12] Update CodeQL analysis ref to use github.ref (#966) Based on the most recent build error, github.repository_owner wasn't providing the correct data type that we anticipated. Our changes to be more specific about github.sha may have been enough. --- .github/workflows/codeql.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 475e86f28..2af27d7df 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -115,6 +115,6 @@ jobs: - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v4 with: - category: "/language:${{matrix.language}}" - ref: ${{ github.repository_owner }} # since we are running this command in the root dir and that root is cloned via LabKey/server + category: "/language:${{matrix.language}} + ref: ${{ github.ref }} # since we are running this command in the root dir and that root is cloned via LabKey/server sha: ${{ github.sha }} From e9e3c27acbbf4decb8cb45f3ffd4d1873a557653 Mon Sep 17 00:00:00 2001 From: Josh Eckels Date: Thu, 11 Dec 2025 10:52:40 -0800 Subject: [PATCH 08/12] Fix quote --- .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 2af27d7df..7682baa09 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -115,6 +115,6 @@ jobs: - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v4 with: - category: "/language:${{matrix.language}} + category: "/language:${{matrix.language}}" ref: ${{ github.ref }} # since we are running this command in the root dir and that root is cloned via LabKey/server sha: ${{ github.sha }} From b2b59677434cead45b9cabb36921956b8fa853bf Mon Sep 17 00:00:00 2001 From: Trey Chadick Date: Thu, 18 Dec 2025 10:34:57 -0800 Subject: [PATCH 09/12] Update CodeQL action parameters for pull requests For pull requests, `github.ref` points to the read-only merge branch for that PR (e.g. `refs/pull/964/merge`) --- .github/workflows/codeql.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 7682baa09..fbd840f6c 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -116,5 +116,5 @@ jobs: uses: github/codeql-action/analyze@v4 with: category: "/language:${{matrix.language}}" - ref: ${{ github.ref }} # since we are running this command in the root dir and that root is cloned via LabKey/server - sha: ${{ github.sha }} + ref: ${{ github.event.pull_request.head.ref || github.ref }} # since we are running this command in the root dir and that root is cloned via LabKey/server + sha: ${{ github.event.pull_request.head.sha || github.sha }} From 49ac8214bc76cba090af42950c2b9230bf813b99 Mon Sep 17 00:00:00 2001 From: Trey Chadick Date: Thu, 18 Dec 2025 11:04:50 -0800 Subject: [PATCH 10/12] Fix branch name --- .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 fbd840f6c..45b775aa2 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -116,5 +116,5 @@ jobs: uses: github/codeql-action/analyze@v4 with: category: "/language:${{matrix.language}}" - ref: ${{ github.event.pull_request.head.ref || github.ref }} # since we are running this command in the root dir and that root is cloned via LabKey/server + ref: "refs/heads/${{ github.event.pull_request.head.ref || github.ref_name }}" # since we are running this command in the root dir and that root is cloned via LabKey/server sha: ${{ github.event.pull_request.head.sha || github.sha }} From d94425127518ced318b0bf8a5f6af5f8186768c0 Mon Sep 17 00:00:00 2001 From: Trey Chadick Date: Thu, 18 Dec 2025 11:25:56 -0800 Subject: [PATCH 11/12] Update CodeQL workflow to modify language settings Comment out the java-kotlin language configuration and remove checkout step for LabKey/platform. --- .github/workflows/codeql.yml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 45b775aa2..41a3ca3fd 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -45,8 +45,8 @@ jobs: include: - language: actions build-mode: none - - language: java-kotlin - build-mode: manual # This mode only analyzes Java. Set this to 'autobuild' or 'manual' to analyze Kotlin too. + #- language: java-kotlin + # build-mode: manual # This mode only analyzes Java. Set this to 'autobuild' or 'manual' to analyze Kotlin too. - language: javascript-typescript build-mode: none # CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift' @@ -63,12 +63,6 @@ jobs: with: repository: LabKey/server - - name: Checkout LabKey/platform - uses: actions/checkout@v4 - with: - repository: LabKey/platform - path: server/modules/platform - - name: Checkout LabKey/commonAssays uses: actions/checkout@v4 with: @@ -116,5 +110,6 @@ jobs: uses: github/codeql-action/analyze@v4 with: category: "/language:${{matrix.language}}" + checkout_path: "server/modules/commonAssays" ref: "refs/heads/${{ github.event.pull_request.head.ref || github.ref_name }}" # since we are running this command in the root dir and that root is cloned via LabKey/server sha: ${{ github.event.pull_request.head.sha || github.sha }} From 85866bfef83ee01b42cc5cd7ad2933bee9acef4a Mon Sep 17 00:00:00 2001 From: Trey Chadick Date: Thu, 18 Dec 2025 14:24:26 -0800 Subject: [PATCH 12/12] Re-add Java to CodeQl matrix --- .github/workflows/codeql.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 41a3ca3fd..0b4330414 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -45,8 +45,8 @@ jobs: include: - language: actions build-mode: none - #- language: java-kotlin - # build-mode: manual # This mode only analyzes Java. Set this to 'autobuild' or 'manual' to analyze Kotlin too. + - language: java-kotlin + build-mode: manual # This mode only analyzes Java. Set this to 'autobuild' or 'manual' to analyze Kotlin too. - language: javascript-typescript build-mode: none # CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift'