# CodeQL for C# AND C++ (docs/13_CI_CD.md). # # The native layer is where memory-safety bugs would live — a lock-free ring # written from inside a host process we do not own. Scanning only the managed # side would defeat the purpose. # # Repo-local for now. The ops repo has codeql-mixed.yml, but C++ needs manual # build mode driven by the CMake preset, and that input surface has not been # verified. Switch to a caller stub once it has. # # AND the workflows themselves, since 2026-10-25: CodeQL's `actions` language # reads .github/workflows for injection from event data, untrusted checkouts # and over-broad tokens — the same class of finding SonarCloud raised once # (githubactions:S7631, wiki.yml, beta.26). Its context, `analyze (actions, # none)`, is not one of main's required checks. name: CodeQL # `workflow_dispatch` since 2026-11-11 (beta.37): on a pull request the C# analysis # is an OVERLAY - it extracts the changed files on top of the database cached from # `main` - so it cannot show what the extractor makes of the whole source, or of a # construct it has not met (the move to .NET 11, a C# 15 feature). A dispatch on a # branch is a full analysis of that branch (docs/13_CI_CD.md §C# 15 and the analyses). on: push: branches: [main] pull_request: branches: [main] schedule: - cron: '27 4 * * 1' workflow_dispatch: permissions: contents: read security-events: write # A new push to a pull request replaces its run. A push to main and the weekly # scan each get a group of their own (the run id), so none of them is ever # cancelled or left pending behind another, and the default branch's alerts # always come from a finished analysis. concurrency: group: codeql-${{ github.event_name == 'pull_request' && github.ref || github.run_id }} cancel-in-progress: true jobs: analyze: runs-on: windows-latest timeout-minutes: 60 strategy: fail-fast: false matrix: include: - language: csharp build-mode: none - language: cpp build-mode: manual - language: actions build-mode: none steps: - uses: actions/checkout@v7 - name: Set up .NET if: matrix.language == 'csharp' uses: actions/setup-dotnet@v6 with: global-json-file: global.json - name: Set up MSVC (x64) if: matrix.language == 'cpp' uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 with: arch: x64 - name: Initialize CodeQL uses: github/codeql-action/init@v4 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} - name: Build native if: matrix.language == 'cpp' shell: pwsh run: | cmake --preset x64-release cmake --build --preset x64-release working-directory: src/native - name: Analyze uses: github/codeql-action/analyze@v4 with: category: /language:${{ matrix.language }}