From 15682038bfeb3fef1a7e8b6aeb5683edad5dc421 Mon Sep 17 00:00:00 2001 From: nopoz Date: Sun, 5 Jul 2026 10:15:24 -0700 Subject: [PATCH 1/2] ci: add CodeQL advanced setup to scan pull requests before merge --- .github/workflows/codeql.yml | 39 ++++++++++++++++++++++++++++++++++++ 1 file changed, 39 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 0000000000..0957e836ab --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,39 @@ +name: CodeQL + +# Advanced setup so CodeQL also runs on pull requests (including from forks), +# surfacing findings before merge instead of only after a change lands on dev. +on: + push: + branches: [dev, main] + pull_request: + branches: [dev] + +permissions: + contents: read + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + runs-on: ubuntu-latest + permissions: + security-events: write + actions: read + contents: read + strategy: + fail-fast: false + matrix: + language: [actions, javascript-typescript, python] + steps: + - name: Checkout + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + persist-credentials: false + - name: Initialize CodeQL + uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2 + with: + languages: ${{ matrix.language }} + build-mode: none + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2 + with: + category: "/language:${{ matrix.language }}" From aa6e7c645c39770a3c10481f99b6a9a59d224a98 Mon Sep 17 00:00:00 2001 From: RaresKeY <158580472+RaresKeY@users.noreply.github.com> Date: Tue, 21 Jul 2026 08:21:58 +0000 Subject: [PATCH 2/2] ci(codeql): preserve scheduled scans Add a weekly advanced-setup scan and update the security CI guide so default setup remains disabled. --- .github/workflows/codeql.yml | 2 ++ docs/security-ci.md | 18 ++++++------------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 0957e836ab..bb8a8c53e7 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -7,6 +7,8 @@ on: branches: [dev, main] pull_request: branches: [dev] + schedule: + - cron: "17 3 * * 1" permissions: contents: read diff --git a/docs/security-ci.md b/docs/security-ci.md index f21643de53..8cceea2580 100644 --- a/docs/security-ci.md +++ b/docs/security-ci.md @@ -7,10 +7,9 @@ benefit. ## What runs, and why -Most checks live in files under `.github/workflows/`. CodeQL is configured -through GitHub's code scanning default setup, so it appears as a dynamic GitHub -workflow instead of a checked-in workflow file. They run automatically; you do -not start them. +Most checks live in files under `.github/workflows/`. CodeQL uses the +checked-in advanced configuration in `.github/workflows/codeql.yml`. They run +automatically; you do not start them. | Check | What it protects against | Blocks a merge? | |---|---|---| @@ -90,14 +89,9 @@ let the workflows run on one pull request first, then add them here. 2. Turn on **Dependency graph** (usually on by default for public repos) -- this powers Dependency review and Dependabot. 3. Turn on **Dependabot alerts** and **Dependabot security updates**. -4. Under **Code scanning**, use **Set up -> Default** for CodeQL. GitHub then - runs CodeQL as a dynamic workflow without the fork-token limitations that - affect checked-in advanced workflows. - - Do not also add a checked-in CodeQL workflow while default setup is enabled: - GitHub rejects advanced CodeQL uploads when default setup is active. If the - project later needs an advanced CodeQL workflow, disable default setup first - and keep only one CodeQL publishing path active. +4. Under **Code scanning**, keep **Default setup** disabled. CodeQL is + configured by `.github/workflows/codeql.yml`; enabling default setup at the + same time causes GitHub to reject uploads from the checked-in workflow. ## Keeping it current