Skip to content

CodeQL: static analysis on the pull request, not in a weekly digest - #91

Merged
arpanghoshal merged 3 commits into
mainfrom
ci/codeql
Sep 6, 2026
Merged

CodeQL: static analysis on the pull request, not in a weekly digest#91
arpanghoshal merged 3 commits into
mainfrom
ci/codeql

Conversation

@arpanghoshal

Copy link
Copy Markdown
Contributor

Why

Scorecard's SAST check is 0/10"0 commits out of 30 are checked with a SAST tool" — one of six zeroes holding the repository at 6.0. Weight 5 of 97.5, so this is worth about +0.51.

What

One workflow. security-and-quality rather than the default suite — a small codebase in the execution path of consequential actions can afford the extra queries. build-mode: none, because the core is stdlib plus pyyaml and click with every extra imported lazily, so there is nothing to build for the analyser to see the code.

Both actions are pinned to the SHA scorecard.yml already uses for upload-sarif.

It does not gate a merge

Deliberate, and asserted by test_codeql_does_not_gate_a_merge so it reads as a decision rather than an oversight. A static analyser's first run on an unfamiliar codebase is a reading list, not a verdict. The required checks stay check (3.11), check (3.12) and package.

Expect findings on the first run. They land in the code-scanning tab and none of them block anything.

Mutation table

mutation verdict
pull_request trigger dropped CAUGHT
wrong language analysed CAUGHT
security-events downgraded to read CAUGHT
timeout removed CAUGHT
analyze step deleted CAUGHT
schedule dropped CAUGHT

Checks

ruff check clean; full suite 3905 passed, 45 skipped.

Stack

Independent of #90 (release provenance) and the fuzzing PR — all three branch from main. Only trivial overlap: this touches the middle of tests/test_repository_signals.py while #90 appends to the end.

OpenSSF Scorecard reads SAST as 0/10 -- "0 commits out of 30 are checked with
a SAST tool" -- and it is one of the six zeroes holding the score at 6.0.

`security-and-quality` rather than the default suite. This is a small codebase
sitting in the execution path of consequential actions, and the extra queries
cost a few minutes a project this size can afford. `build-mode: none`, because
the core is stdlib plus pyyaml and click and every extra is imported lazily, so
there is nothing to build for the analyser to see the code.

**It deliberately does not gate a merge**, and that is recorded in a test rather
than left as an omission somebody later reads as an oversight. A static
analyser's first run on an unfamiliar codebase is a reading list, not a verdict;
the required checks stay `check (3.11)`, `check (3.12)` and `package`. If that
changes, `test_codeql_does_not_gate_a_merge` is where the argument gets
rewritten.

Runs on pull requests, on pushes to main, and weekly -- the schedule so that a
new query release reaches code that was merged before it existed. Both actions
are pinned to the SHA `scorecard.yml` already uses for `upload-sarif`.

Six mutations, six caught: the pull_request trigger dropped, the wrong language
analysed, security-events downgraded to read, the timeout removed, the analyze
step deleted, and the schedule dropped.
@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@arpanghoshal
arpanghoshal merged commit e6f5d99 into main Sep 6, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants