You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2c53008
Browse filesBrowse the repository at this point in the historyBrowse files
feat(sast): resolve CodeQL build mode per language.
* docs(sast): document accepted CodeQL languages and fix runner docs.
* feat(sast): resolve CodeQL build mode per language.
* docs(sast): correct consumer onboarding guidance; reject unknown entry keys.
sast-scan-codeql.yml matrixed over languages but passed a single build-mode
and a single runs-on to every leg, so language sets with differing
requirements could not be expressed. Go rejects build-mode none and Rust
supports nothing else, making '["go","rust"]' impossible whichever value was
set.
Add a resolve job that normalizes languages into a matrix, deriving a build
mode per language the way GitHub Default setup does, so callers do not need to
know the support table. build-mode becomes a preference applied where the
language supports it, with each substitution reported as a job-log notice and
the resolved matrix written to the job summary. Entries may also be objects
carrying an explicit build-mode or runs-on; an explicit mode CodeQL does not
support is an error rather than a silent substitution.
Copy file name to clipboardExpand all lines: .github/workflows/README.md
+34-19Lines changed: 34 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -132,41 +132,56 @@ jobs:
132
132
| Model | Use for | How |
133
133
|---|---|---|
134
134
|**Default setup** (Security Configuration) | The vast majority of repos | Org/enterprise owner enables it centrally; no file in the repo |
135
-
|**This reusable workflow**| Repos needing custom query packs, path filters, a shared build step, or a centrally-pinned action | Add a caller (below) |
135
+
|**This reusable workflow**| Repos needing path filters, a non-default query suite, or a centrally-pinned action | Add a caller (below) |
136
136
|**Standalone advanced**| Rare repos with a bespoke, non-generalizable build | Repo-local `codeql.yml`|
137
137
138
138
Use `sast-scan-codeql.yml` only when you actually need the customization. If you don't, use Default setup.
139
139
140
140
Scan-specific prerequisites:
141
141
142
142
-**Licensing.** Public repos get code scanning free. Private/internal repos require GitHub Advanced Security (Code Security).
143
-
-**Default setup must be off.** Default setup and an advanced/reusable CodeQL workflow are mutually exclusive; if Default setup is on, this workflow's upload fails.
143
+
-**Default setup must not cover the same languages.** Default setup and this workflow both publish the `/language:<lang>` SARIF category, so any language covered by both makes the two uploads collide. Default setup covering *other* languages is fine and common — this repository runs exactly that way, with an org Security Configuration analyzing `python` while the self-test analyzes `actions`.
144
144
-**Runner toolchain.**`build-mode: none` needs no toolchain. `build-mode: autobuild` needs the language's build tools.
145
-
-**Rollout alerts-first.** Enable without a merge gate, triage the backlog, then enforce via branch protection — turning enforcement on fleet-wide on day one lights every repo red.
145
+
-**This workflow never fails a pull request.** It publishes findings to code scanning and always exits 0 — there is no `failure_policy` equivalent, unlike [`secret-scan-pulse.yml`](secret-scan-pulse.yml). Enabling it buys visibility, not a merge gate. Gating is a separate, repository-side decision: configure it through code-scanning alert rules and branch protection once the backlog is triaged. Plan the rollout that way deliberately — turning enforcement on fleet-wide on day one lights every repo red.
146
+
-**`queries` defaults to `security-extended`, which is broader than Default setup's `default` suite.** Expect a larger initial backlog than an equivalent Default-setup repo, and name a triage owner before enabling. Pass `queries: default` to match Default setup's volume.
147
+
-**GHCR-hosted query `packs` are not usable.** The workflow does not declare `packages: read` and a called workflow's token cannot exceed what it declares, so granting the scope in the caller has no effect.
146
148
147
-
Key inputs: `languages` (required, JSON array — one matrix leg per entry), `runs-on` (default `ubuntu-latest`), `build-mode` (default `none`), `queries` (default `security-extended`), `packs`, `config-file`.
149
+
Key inputs: `languages` (required, JSON array — one matrix leg per entry), `runs-on` (default `ubuntu-latest`), `build-mode` (default `none`), `resolve-runs-on` (default `ubuntu-latest`), `queries` (default `security-extended`), `packs`, `config-file`.
An explicit per-language `build-mode` that CodeQL does not support is an error, not a silent substitution — the run fails in the resolver with the offending
179
+
pair named, before any analysis starts. `manual` is rejected everywhere: a reusable workflow cannot carry repo-specific build steps.
180
+
181
+
Two coverage gaps to plan around:
167
182
168
183
- **No shell analyzer.** CodeQL cannot analyze Bash or other shell. Cover shell with a linter such as [`shellcheck`](https://www.shellcheck.net/), typically at pre-commit.
169
-
-**No CUDA analyzer.** The `c-cpp` extractor does not understand CUDA, so `.cu` / `.cuh` device code is not analyzed. A CUDA-heavy repository gets coverage only of its host-side translation units, and a useful C/C++ database usually needs `build-mode: autobuild` plus the full toolchain — price that build before enabling `c-cpp`.
184
+
- **No CUDA analyzer.** The `c-cpp` extractor does not understand CUDA, so `.cu` / `.cuh` device code is not analyzed. A CUDA-heavy repository pays full C/C++ extraction cost for coverage of its host-side translation units only — measure that trade before enabling `c-cpp`.
170
185
171
186
Every entry is its own matrix leg, so scan cost scales with the list. Start with the languages carrying the most risk, then widen once you have a runtime and alert-volume baseline.
Copy file name to clipboardExpand all lines: .github/workflows/ci.yml
+123-2Lines changed: 123 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -290,9 +290,130 @@ jobs:
290
290
security-events: write
291
291
uses: ./.github/workflows/security-suite.yml
292
292
293
+
# SAST resolver — contract tests for the language matrix.
294
+
#
295
+
# Runs the resolver extracted from sast-scan-codeql.yml itself, so the tests exercise the shipped script rather than a copy that can drift.
296
+
# Covers what a live scan cannot: build modes this repo has no sources for (go, rust, swift), and the rejection paths, whose expected outcome is a non-zero exit
297
+
# Asserting them here keeps the run green, matching how the Pulse negatives above are shaped.
0 commit comments