Skip to content

Run CodeQL's security queries, not security-and-quality - #8

Merged
sadeqabuhattem merged 2 commits into
mainfrom
ci/codeql-security-queries
Oct 10, 2026
Merged

sadeqabuhattem merged 2 commits into
mainfrom
ci/codeql-security-queries

Conversation

@sadeqabuhattem

Copy link
Copy Markdown
Member

Code scanning posts findings as PR review comments, and the ruleset on main sets
required_review_thread_resolution: true. The result is that every pull request arrives with the
merge button already blocked by whatever CodeQL's quality suite has to say about the diff.

#7 carried 11 such threads. Three were real and got fixed. The other eight
were deliberate code or false positives and had to be dismissed by hand:

Finding Why it was not a finding
Call to obsolete method ×3 Inside a #pragma warning disable CS0618 whose whole purpose is to exercise the obsolete forwarder
Useless upcast ×2 The cast is load-bearing — Task.FromResult infers the wrong tuple type without it
Generic catch clause The observer catch that is documented as logged-and-swallowed by design
Missed opportunity to use Where Style
String concatenation in loop Style, in a test helper

Eight dismissals per PR as the steady state trains everyone to click through the one list that is
meant to be read.

This is a real loss, not a free win

Narrowing the suite changes what runs, not what is reported. The bare-catch bug fixed in 0f2ef53
— a write silently replacing an undecryptable secret with its compile-time default — was found
by a quality query, not a security one.
That is worth stating plainly rather than burying.

The trade accepted here:

  • The quality rules are the analyser's weakest signal on this codebase: 8 of 11 were noise.
  • The compiler already enforces more than they do — TreatWarningsAsErrors, AnalysisLevel latest-recommended, and CA rules that rejected a return type during the work on Close the API gaps: write observers, discovery endpoints, projectors #7.
  • The friction landed on every PR, while the one genuine catch was a one-off.

If the quality queries should come back

The better shape is to keep them and stop them blocking, rather than stop running them:

  • a codeql-config.yml with query-filters excluding the specific noisy rules, or
  • paths-ignore for tests/, which is where seven of the eight sat.

Happy to do either instead of this — say so and I'll swap it.

Verification

This PR is its own test: with queries: security, it should produce no blocking quality threads,
so the merge button should be available on a green build without any manual dismissals.

🤖 Generated with Claude Code

sadeqabuhattem and others added 2 commits October 10, 2026 21:58
Code scanning posts its findings as pull request review comments, and
the ruleset on main sets required_review_thread_resolution, so every PR
arrived with the merge button already blocked by whatever the quality
suite had to say. #7 carried eleven such threads. Three were real and
fixed; the other eight were deliberate code or false positives and had
to be dismissed by hand:

  - three "call to obsolete method" on calls inside a
    #pragma warning disable CS0618 whose entire purpose is to exercise
    the obsolete forwarder
  - two "useless upcast" where the cast is load-bearing, because
    Task.FromResult infers the wrong tuple type without it
  - one "missed opportunity to use Where"
  - one "generic catch clause" on the observer catch that is documented
    as logged-and-swallowed by design
  - one "string concatenation in loop" in a test helper

That is eight dismissals per PR as the steady state, which trains
everyone to click through the one list that is supposed to be read.

This narrows what runs, not what is reported, so it is a real loss and
worth naming: the bare-catch bug fixed in 0f2ef53 — a write replacing an
undecryptable secret with its default — was found by a quality query,
not a security one. Against that, the quality rules are the analyser's
weakest signal here, the compiler already enforces more than they do
(warnings-as-errors, AnalysisLevel latest-recommended, and CA rules that
rejected a return type during this very change), and the friction landed
on every PR rather than occasionally.

If the quality queries are wanted back, the better shape is to keep them
and stop them blocking: a codeql-config with query-filters excluding the
specific noisy rules, or paths-ignore for tests/, which is where seven of
the eight sat.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
190abec passed `queries: security`, which fails init outright:

  A fatal error occurred: Query pack security cannot be found.
  Check the spelling of the pack.

There is no pack by that name. The named suites are security-extended,
security-and-quality and security-experimental; the security-only suite
is CodeQL's default and is selected by passing no `queries` input at
all. A wrong name is not ignored and does not fall back — unlike the
minimumCoverage input two commits earlier, which GitHub dropped with a
warning. Here the whole job failed in 22 seconds, which is the better
behaviour and is how this was caught.

security-extended would also have excluded the quality rules, but it
adds lower-precision security queries, which is new noise in place of
the noise being removed. The default suite is the one that matches the
intent.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@sadeqabuhattem
sadeqabuhattem merged commit fa6009a into main Oct 10, 2026
10 checks passed
@sadeqabuhattem
sadeqabuhattem deleted the ci/codeql-security-queries branch October 10, 2026 19:15
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.

1 participant