Skip to content

chore: resolve open CodeQL code-quality alerts - #26

Merged
StuartMeeks merged 1 commit into
mainfrom
chore/resolve-code-scanning-alerts
Aug 21, 2026
Merged

chore: resolve open CodeQL code-quality alerts#26
StuartMeeks merged 1 commit into
mainfrom
chore/resolve-code-scanning-alerts

Conversation

@StuartMeeks

Copy link
Copy Markdown
Owner

Works toward the 1.0.0 "ducks in a row" goal by clearing the open code-scanning backlog. Every code change is a genuine fix, not a suppression.

Starting state: 52 open alerts — 29× cs/path-combine, 15× cs/catch-of-all-exceptions, 6× cs/linq/missed-where, 2× cs/missed-ternary-operator.

Fixed in this PR (39 alerts)

  • cs/path-combine (29)Path.CombinePath.Join across src + tests (resolves Replace Path.Combine with Path.Join across the repo #24). Path.Join never treats a later segment as rooted, so it can't silently drop earlier arguments; defence-in-depth for the already-validated credential/keystore paths.
  • cs/linq/missed-where (6) — filter-loops → idiomatic LINQ: providerName.Any(...) (×3 ValidateProviderName), Distinct(OrdinalIgnoreCase) (list column-key union), .Where(...) + .FirstOrDefault(predicate) (Keychain).
  • cs/catch-of-all-exceptions — crypto translation (4) — narrowed DPAPI + LocalFileCredentialEncryption catch (Exception) to the specific expected types (CryptographicException, FormatException, IOException, UnauthorizedAccessException). Unexpected exceptions now propagate instead of being masked as a generic failure.

Handled by dismissal-with-justification (13 alerts, out of band — agreed approach)

  • 11× deliberately-broad boundary catches — 6 CLI command top-level handlers (friendly error + exit code) and 5 best-effort cleanup swallows (AtomicFile.TryDelete, TempDir.Dispose, test cleanup). Catching everything here is the correct boundary pattern; narrowing would reintroduce crashes.
  • cs/missed-ternary-operator in the generated obj/Release/.../XunitAutoGeneratedEntryPoint.cs — not our source, already excluded by the CodeQL config; stale alerts.

Verification

334/334 tests pass on net8.0 + net10.0 locally. I'll confirm the 39 alerts flip to fixed on this PR's CodeQL run before merging, then apply the 13 dismissals.

🤖 Generated with Claude Code

Genuine fixes across the code-scanning backlog (no suppression hacks):

- Path.Combine -> Path.Join repo-wide (src + tests). Path.Join never treats a
  later segment as rooted, so it can't silently drop earlier arguments — a
  defence-in-depth improvement for the input-validated credential/keystore
  path construction. Resolves #24 and clears the cs/path-combine alerts.
- cs/linq/missed-where: replaced filter-style loops with idiomatic LINQ —
  providerName.Any(...) in the three ValidateProviderName checks,
  Distinct(OrdinalIgnoreCase) for the accounts-list column-key union, and
  .Where(...) / .FirstOrDefault(predicate) in the Keychain backend.
- cs/catch-of-all-exceptions (crypto translation): narrowed
  DpapiCredentialEncryption and LocalFileCredentialEncryption from
  catch (Exception) to the specific expected types (CryptographicException,
  FormatException, IOException, UnauthorizedAccessException). Unexpected
  exceptions now propagate rather than being masked.

The deliberately-broad boundary catches (CLI command handlers, best-effort
cleanup) and the two generated-code alerts in the xUnit entry point are handled
by dismissal with justification, out of band from this PR.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@StuartMeeks
StuartMeeks merged commit e9b7966 into main Aug 21, 2026
9 checks passed
@StuartMeeks
StuartMeeks deleted the chore/resolve-code-scanning-alerts branch August 21, 2026 04:53
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.

Replace Path.Combine with Path.Join across the repo

1 participant