Repository navigation
chore: drive CodeQL to zero and keep it there - #391
Merged
Merged
Conversation
The 223 open alerts on main carried no security severity between them: every one came from the quality half of the security-and-quality suite, and most were CodeQL re-reporting a decision the build had already made. The .NET analyzers run at AnalysisMode=All with TreatWarningsAsErrors, but CodeQL cannot see a per-member [SuppressMessage] or an .editorconfig severity, so each such decision surfaced again as a permanently open alert nobody could close. Record those decisions where CodeQL can see them, in a config file whose every exclusion names the CA or SA rule that already governs the same code, and fix what was genuinely wrong: - Seven dead locals, the one real defect the suite found. IDE0059 ships at suggestion severity, below the threshold TreatWarningsAsErrors acts on, which is how they accumulated in an otherwise maximally strict build. Raising it to warning makes the next one a build error -- verified by reintroducing one and watching the build fail. - .github/codeql/codeql-config.yml excludes nine queries, none carrying a security severity, each against the rule that duplicates it: CA1031 for the generic catches, CA2000 for test-local disposal, the StyleCop documentation family, CA5392 for the winmm P/Invoke that already carries DefaultDllImportSearchPaths, plus LINQ style suggestions with no Roslyn equivalent and xunit's generated entry point. - .bestpractices.json claimed there were no outstanding alerts. It now describes the policy instead of asserting a clean first run. - AGENTS.md gains a "Static analysis" section: the code rules, and what to do when a new alert appears -- fix it, or exclude it by id with a written rationale, and dismiss only a site-specific false positive. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
DeepDiver1975
added a commit
that referenced
this pull request
Sep 17, 2026
The 223 open alerts on main carried no security severity between them: every one came from the quality half of the security-and-quality suite, and most were CodeQL re-reporting a decision the build had already made. The .NET analyzers run at AnalysisMode=All with TreatWarningsAsErrors, but CodeQL cannot see a per-member [SuppressMessage] or an .editorconfig severity, so each such decision surfaced again as a permanently open alert nobody could close. Record those decisions where CodeQL can see them, in a config file whose every exclusion names the CA or SA rule that already governs the same code, and fix what was genuinely wrong: - Seven dead locals, the one real defect the suite found. IDE0059 ships at suggestion severity, below the threshold TreatWarningsAsErrors acts on, which is how they accumulated in an otherwise maximally strict build. Raising it to warning makes the next one a build error -- verified by reintroducing one and watching the build fail. - .github/codeql/codeql-config.yml excludes nine queries, none carrying a security severity, each against the rule that duplicates it: CA1031 for the generic catches, CA2000 for test-local disposal, the StyleCop documentation family, CA5392 for the winmm P/Invoke that already carries DefaultDllImportSearchPaths, plus LINQ style suggestions with no Roslyn equivalent and xunit's generated entry point. - .bestpractices.json claimed there were no outstanding alerts. It now describes the policy instead of asserting a clean first run. - AGENTS.md gains a "Static analysis" section: the code rules, and what to do when a new alert appears -- fix it, or exclude it by id with a written rationale, and dismiss only a site-specific false positive. Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
DeepDiver1975
added a commit
that referenced
this pull request
Sep 17, 2026
* refactor: join paths with Path.Join instead of Path.Combine Path.Combine silently discards every earlier argument once a later one turns out to be rooted, so a name that ever slipped past sanitisation could resolve outside the directory it was meant to land in. Path.Join always concatenates, so the same slip stays contained. Behaviour is unchanged at all 163 call sites: every later argument here is relative, and untrusted names still pass IncidentFile.SanitizeFileName or SafeFileName.Sanitize before they reach a join. This is defence in depth, and it clears the 144 cs/path-combine CodeQL alerts, which fired on 100% of the call sites rather than on any specific one. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com> * chore: drive CodeQL to zero and keep it there (#391) The 223 open alerts on main carried no security severity between them: every one came from the quality half of the security-and-quality suite, and most were CodeQL re-reporting a decision the build had already made. The .NET analyzers run at AnalysisMode=All with TreatWarningsAsErrors, but CodeQL cannot see a per-member [SuppressMessage] or an .editorconfig severity, so each such decision surfaced again as a permanently open alert nobody could close. Record those decisions where CodeQL can see them, in a config file whose every exclusion names the CA or SA rule that already governs the same code, and fix what was genuinely wrong: - Seven dead locals, the one real defect the suite found. IDE0059 ships at suggestion severity, below the threshold TreatWarningsAsErrors acts on, which is how they accumulated in an otherwise maximally strict build. Raising it to warning makes the next one a build error -- verified by reintroducing one and watching the build fail. - .github/codeql/codeql-config.yml excludes nine queries, none carrying a security severity, each against the rule that duplicates it: CA1031 for the generic catches, CA2000 for test-local disposal, the StyleCop documentation family, CA5392 for the winmm P/Invoke that already carries DefaultDllImportSearchPaths, plus LINQ style suggestions with no Roslyn equivalent and xunit's generated entry point. - .bestpractices.json claimed there were no outstanding alerts. It now describes the policy instead of asserting a clean first run. - AGENTS.md gains a "Static analysis" section: the code rules, and what to do when a new alert appears -- fix it, or exclude it by id with a written rationale, and dismiss only a site-specific false positive. Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
maincarried 223 open CodeQL alerts. Between them they had no security severity at all — every one came from the quality half of thesecurity-and-qualitysuite.The reason they piled up is duplication. The build already runs the .NET analyzers at
AnalysisMode=Allplus StyleCop withTreatWarningsAsErrors. But CodeQL cannot see a per-member[SuppressMessage]or an.editorconfigseverity, so every decision this repo had already made and written down came back as a permanently open alert that nobody could close. And CodeQL gates nothing —main's required checks arebuild-test ×2,changelog entryandDCO— so they accumulated in silence.#390 cleared 144 of them by switching to
Path.Join. This PR handles the remaining 79.The one real defect
Seven dead local assignments, left over from earlier refactors — including one in
EqualWidthWrapPanel's arrange pass, dead since the arrange path moved toColumnEdge(…).They survived an otherwise maximally strict build because
IDE0059ships at suggestion severity, below the thresholdTreatWarningsAsErrorsacts on..editorconfignow raises it towarning. Verified rather than assumed — reintroducing the dead local fails the build:Note the identical line in
MeasureOverrideis used and was left alone.The exclusions — nine queries, each against the rule that duplicates it
New
.github/codeql/codeql-config.yml. No query carrying a security severity is excluded. Every entry names the rule the build already governs it by:cs/catch-of-all-exceptions(21)[SuppressMessage]naming where the failure surfacescs/local-not-disposed,cs/dispose-not-called-on-throw(30)= noneunder[tests/**/*.cs]with a written rationalecs/xmldoc/missing-summary(4)NoWarncs/unmanaged-code,cs/call-to-unmanaged-code(2)winmm.dllP/Invoke already carries[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]cs/linq/missed-where,cs/linq/missed-select(11)cs/missed-ternary-operator(1)obj/entry pointTwo of these deserve saying out loud, because "suppress the generic catch warning" normally is the lazy answer:
SerialAudioQueuecatches broadly on purpose — "a misbehaving cue must not stop the queue from serving the next one." This is the Rückzugsalarm path in an incident log running live in an ELW. Narrowing it would let one bad cue silence every later alarm.TasksViewModel's flagged loop mutates the fire-once alarm-dedupe set inside the loop condition. Applyingcs/linq/missed-wherewould move that into a lazily-evaluated.Where(…)and change when — or whether — the Aufgabe-fällig alarm sounds. The "fix" would be the bug.paths-ignoreis not an option here: GitHub restrictspaths/paths-ignoreto interpreted languages orbuild-mode: none, and this is C# underbuild-mode: manual. Rule id is the only lever, which is why the generated-code alert is handled as a query exclusion.Honesty repair
.bestpractices.jsonasserted "There are no outstanding CodeQL alerts; the first full run on the default branch reported none." That was committed in #370 and is a public OpenSSF Best Practices claim. It now describes the policy — fix in code by default, exclude only duplicated rules, never a security query, dismiss only site-specific false positives — instead of asserting a clean first run.Keeping it at zero
Path.JoinoverPath.Combine, a justified[SuppressMessage]on everycatch (Exception), no dead locals, and the three-step procedure for a new alert.code_scanningruleset rule so a PR introducing a new alert cannot merge. It has to be added after this lands and a freshmainscan reads zero, or it would block its own enabling PR.Remaining three alerts
Handled by dismissal after merge, because they are site-specific rather than rule-wide:
cs/constant-condition×2 — false positive. CodeQL mis-modelsis falseonbool?;Dwelling.KeyAvailableisbool?andnullis the meaningful "Schlüssel unbekannt" third state rendering—. Collapsing the ternary would print "nein" for unknown keys, which in a CO-Messprotokoll is a wrong operational statement.cs/complex-block×1 — won't fix.IncidentRepository.Saveis long but flat: oneINSERTblock per table across 16 tables in one transaction, which is what makes the table list auditable at a glance.Verification
dotnet build LageBuch.Desktop.slnf -c Release→ 0 warnings, 0 errors, withIDE0059now in forcedotnet test LageBuch.Desktop.slnf -c Release→ 1324 passed, 0 failed, 1 pre-existing skipdotnet format whitespace/style --verify-no-changes→ clean.bestpractices.jsonparses (140 keys)No screenshots: deleting an unread local in
ArrangeOverridecannot change a rendered pixel, and the 178-test acceptance render suite passing unchanged demonstrates that rather than asserting it.🤖 Generated with Claude Code