feat(ci): add CodeQL code scanning; make code-scanning workflows private-safe - #68
feat(ci): add CodeQL code scanning; make code-scanning workflows private-safe#68JartanFTW wants to merge 1 commit into
Conversation
…ate-safe - codeql.yml (new): CodeQL SAST on push/PR/weekly, Python matrix (build-mode none). A `visibility` guard job resolves repo visibility via the API so a private fork skips cleanly instead of failing the SARIF upload. - scorecard.yml: add the same guard so it also skips (not fails) on private forks; drop the stale "set false on a private fork" guidance. - README: list CodeQL in the workflow inventory; reconcile the checklist — default CodeQL setup conflicts with the shipped advanced workflow, scorecard now skips on private (no delete needed), and non-Python forks change the matrix language/build-mode rather than delete. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Closing in favor of GitHub's default CodeQL setup, which is already enabled on this repo ( Why. For the template we want forks pointed at the best scanner with the least maintenance. Default setup is GitHub-tuned, auto-detects and auto-updates languages, and runs curated query suites. It also can't coexist with a committed advanced workflow — this PR's Net: no change to this repo's CodeQL (default setup stays on), and the README keeps recommending default setup for forks. The one independently-useful piece from this branch — making |
Summary
Adds CodeQL (SAST) — the one missing layer alongside zizmor (workflow lint), scorecard (supply chain), dependabot + pip-audit (deps), actionlint. Also closes a gap the addition exposed: code-scanning workflows now skip cleanly on a private fork instead of failing the SARIF upload, so a forker who doesn't delete them isn't greeted by red runs.
What changed
.github/workflows/codeql.yml(new) — CodeQL onpush/pull_request(main) + weekly schedule (Mon 07:30 UTC, offset from scorecard/link-check). Python matrix withbuild-mode: none; reuses thegithub/codeql-action@v3.36.3pin already present inscorecard.yml..github/workflows/scorecard.yml— same visibility guard added so it also skips (not fails) on private forks; the stale "set false on a private fork" note is gone.README.md— CodeQL added to the workflow inventory; checklist reconciled (see below).Private-safe design
Each workflow gets a tiny
visibilityguard job that resolves repo visibility viagh api repos/$GITHUB_REPOSITORY --jq .visibilityand exposes it as an output; the analysis job gates onneeds.visibility.outputs.public == 'true'. The API is used instead ofgithub.event.repository.visibilitybecause that field is absent onscheduleruns, whereas$GITHUB_REPOSITORYis always set. On a private fork the analysis job is skipped (green); on public it runs normally. Private repo with GitHub Advanced Security? Drop the gate.README reconciliation
language(andbuild-modefor compiled stacks), not delete the file — CodeQL is multi-language.Verification
make lintgreen — actionlint (incl. shellcheck on the guardrun:), zizmor, check-yaml, markdownlint all pass.411c4c9a…dereferences to annotated tagv3.36.3;build-mode: noneconfirmed supported there.gh apidegrades topublic=falseunder theif-test idiom (no red).pull_requestrun exercisescodeql.ymlend to end (public repo → analyze runs).🤖 Generated with Claude Code