Skip to content

fix: resolve the three open CodeQL alerts - #77

Merged
StuartMeeks merged 2 commits into
mainfrom
fix/code-scanning-alerts
Aug 26, 2026
Merged

fix: resolve the three open CodeQL alerts#77
StuartMeeks merged 2 commits into
mainfrom
fix/code-scanning-alerts

Conversation

@StuartMeeks

Copy link
Copy Markdown
Owner

Closes the three open code scanning alerts. All three are in code added during this cycle — none are pre-existing, so this is cleaning up after the recent work rather than paying down old debt.

Alert Rule Severity Where
#208 cs/local-not-disposed warning AtomicFile.cs:71
#207 cs/linq/missed-select note LibsecretCredentialManager.cs:514
#209 cs/inefficient-containskey note FileCredentialManagerTests.cs:317

#208 — the only one that is more than style

WriteTempAsync assigned the FileStream to a local and then opened await using (stream.ConfigureAwait(false)). It is disposed in practice, but there is a window between construction and the using taking effect that the analyser cannot prove, and it was flagged accordingly. Rewritten as an await using declaration, which is provably correct and two lines shorter.

Worth noting this is code from the #54 permissions fix — the alert is a fair catch on my own change.

#207 and #209 — notes

ResolveStoredProviderName ran a filter-then-project foreach; it now says so with Select + FirstOrDefault. A test paired ContainsKey with the indexer where TryGetValue is one lookup, and the out value makes the assertion read better.

Verification

Build clean, 416 tests (358 passed, 58 skipped) — unchanged. No behaviour change; the CodeQL run on this PR is the actual check.

🤖 Generated with Claude Code

StuartMeeks and others added 2 commits August 26, 2026 12:15
All three are in code this cycle added, not pre-existing.

#208 cs/local-not-disposed (warning) -- AtomicFile.WriteTempAsync assigned the
FileStream to a local and then opened `await using (stream...)`. It is disposed
in practice, but the analyser cannot prove it for the window between
construction and the using taking effect. Rewritten as an `await using`
declaration, which is both provably correct and shorter.

#207 cs/linq/missed-select (note) -- ResolveStoredProviderName ran a
filter-then-project foreach. Expressed as Select + FirstOrDefault, which says
what it does.

#209 cs/inefficient-containskey (note) -- a test called ContainsKey and then the
indexer, two lookups where TryGetValue is one, and the out value makes the
assertion read better besides.

No behaviour change; 416 tests unchanged.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The entry was missing from the previous commit: the scripted edit asserted on a
unique '### Fixed' heading, which is no longer unique now that [Unreleased] has
both Breaking and Fixed sections. The assertion fired, the CHANGELOG was left
untouched, and the commit went ahead with only the source changes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@StuartMeeks
StuartMeeks merged commit 4402141 into main Aug 26, 2026
9 checks passed
@StuartMeeks
StuartMeeks deleted the fix/code-scanning-alerts branch August 26, 2026 04:20
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