From 90e7b914b4f22e88b936f9512e165b27bb0d8717 Mon Sep 17 00:00:00 2001 From: pshu Date: Tue, 2 Jun 2026 11:51:25 +0800 Subject: [PATCH] ci: restore CodeQL code scanning workflow The GitHub-managed default code scanning setup was turned off (default-setup = not-configured), so no analysis runs to re-evaluate alerts. The 13 open 'actions/missing-workflow-permissions' alerts were already fixed by #211 but stay open with nothing to close them. Add an advanced-setup CodeQL workflow (actions + javascript-typescript) so a run on main re-scans the now-hardened workflows and auto-closes the stale alerts. The workflow itself follows least privilege: top-level permissions {} plus narrow per-job grants. --- .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 00000000..571a86b2 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,46 @@ +# Re-enables code scanning after the GitHub-managed default setup was turned off, +# which left the workflow-permission alerts stranded as "open" with no analysis to +# close them. A fresh run on main re-evaluates the (now hardened) workflows. +name: CodeQL + +on: + push: + branches: + - main + pull_request: + branches: + - main + schedule: + - cron: "0 0 * * 1" + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} + cancel-in-progress: ${{ github.ref_name != 'main' }} + +permissions: {} + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + runs-on: ubuntu-latest + permissions: + contents: read # checkout + security-events: write # upload CodeQL results + strategy: + fail-fast: false + matrix: + language: + - actions + - javascript-typescript + steps: + - uses: taiki-e/checkout-action@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2 + + - name: Initialize CodeQL + uses: github/codeql-action/init@03e4368ac7daa2bd82b3e85262f3bf87ee112f57 # v3 + with: + languages: ${{ matrix.language }} + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@03e4368ac7daa2bd82b3e85262f3bf87ee112f57 # v3 + with: + category: "/language:${{ matrix.language }}"