Skip to content

fix: resolve open CodeQL code-scanning alerts with genuine fixes - #16

Merged
StuartMeeks merged 1 commit into
mainfrom
fix/code-scanning-alerts
Aug 22, 2026
Merged

fix: resolve open CodeQL code-scanning alerts with genuine fixes#16
StuartMeeks merged 1 commit into
mainfrom
fix/code-scanning-alerts

Conversation

@StuartMeeks

Copy link
Copy Markdown
Owner

Resolves every open CodeQL code-scanning alert from the security-and-quality pack with a real code change — no # codeql suppressions, no alert dismissals. No consumer-visible behaviour changes; build is clean under TreatWarningsAsErrors and all 64 tests (32 × net8.0/net10.0) pass.

What each alert got

  • cs/path-combine (×8) — Path.CombinePath.Join everywhere (one in ServiceCollectionExtensions, the rest in test infrastructure). This is CodeQL's own recommendation: Path.Join concatenates segments unconditionally, so it can't silently discard the base directory the way Path.Combine does when a later segment looks rooted.
  • cs/catch-of-all-exceptions (×6) — the query clears a catch once it carries a when filter:
    • Best-effort cleanup catches (AtomicFile.TryDelete, SettingsStore.TryBackupCorruptFile, test TempDir.Dispose) now catch only the IOException/UnauthorizedAccessException they expect, so an unexpected exception surfaces instead of being swallowed.
    • The three intentionally broad catches — the fire-and-forget persistence safety net in SettingsBase and the two settings command boundaries — must stay broad (a pluggable persister/store can throw any type, and a test asserts a custom InvalidOperationException reaches the handler). They keep routing every operational failure to their handler but now exclude a process-fatal OutOfMemoryException, which propagates rather than being mislabelled.
  • cs/linq/missed-where (×1) — SettingsStore.ResetInstanceToDefaults filters settable properties with .Where(...) instead of an if inside the loop.
  • cs/missed-using-statement (×1) — the debounce task scopes its CancellationTokenSource with a using block instead of a manual finally-dispose. Disposal semantics are unchanged (still idempotent; a superseding change/Save disposing its own reference remains harmless).
  • cs/local-not-disposed (×1) — the test CLI harness now usings its TestConsole.

The two remaining open alerts (cs/missed-ternary-operator) are in obj/Release/** generated files (the xUnit auto-generated entry point). They're already excluded by codeql.yml's paths-ignore and will auto-close on the next scan of main — nothing to change in source.

🤖 Generated with Claude Code

Address every open alert from the security-and-quality pack without
suppressions or dismissals. No consumer-visible behaviour changes.

- cs/path-combine: Path.Combine -> Path.Join at all 8 sites (Path.Join
  concatenates unconditionally, so a rooted later segment can't silently
  drop the base directory).
- cs/catch-of-all-exceptions: best-effort cleanup catches
  (AtomicFile.TryDelete, SettingsStore.TryBackupCorruptFile, test
  TempDir.Dispose) now catch only IOException/UnauthorizedAccessException;
  the intentionally broad catches (SettingsBase fire-and-forget safety net,
  the two settings-command boundaries) keep routing operational failures to
  their handler via a when-filter but let a process-fatal
  OutOfMemoryException propagate.
- cs/linq/missed-where: ResetInstanceToDefaults filters with .Where(...).
- cs/missed-using-statement: the debounce task scopes its
  CancellationTokenSource with a using block, preserving the existing
  idempotent disposal semantics.
- cs/local-not-disposed: the test CLI harness disposes its TestConsole.

Build clean (0 warnings, TreatWarningsAsErrors); 64/64 tests pass on
net8.0 and net10.0.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
app.Configure(config => config.AddSettingsBranch());

var console = new TestConsole().Interactive();
using var console = new TestConsole().Interactive();
@StuartMeeks
StuartMeeks merged commit d692efc into main Aug 22, 2026
9 checks passed
@StuartMeeks
StuartMeeks deleted the fix/code-scanning-alerts branch August 22, 2026 00:29
@StuartMeeks StuartMeeks mentioned this pull request Aug 22, 2026
StuartMeeks added a commit that referenced this pull request Aug 22, 2026
Patch release — no consumer-visible API or runtime behaviour change. Bumps
<Version> to 1.0.1 and finalises the CHANGELOG [1.0.1] section (dated
2026-08-22) from [Unreleased].

The shipped assembly carries only the behaviour-neutral internal refactors from
#16 that cleared the CodeQL security-and-quality findings (Path.Join, narrowed
catches, .Where(...), using(cts)); the remainder is CI-only (the #17 move to
buildless CodeQL analysis).

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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