fix: audit SQL construction and general exception catches (CA2100, CA1031) - #157
Merged
Conversation
…1031) Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
DeepDiver1975
force-pushed
the
fix/analyzer-sql-catches
branch
from
August 30, 2026 20:22
fa83bdd to
e2c2337
Compare
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.
Part of the analyzer-hardening effort (see #153 for rule scoping).
CA2100 (12 sites) — audited, then suppressed per helper.
Every SQL statement is built exclusively from compile-time schema constants (table/column names in Migrations, MasterDataStore, IncidentRepository) or literal PRAGMA statements; all data values flow through bound parameters (
$v/$t/$c). No user input ever reachesCommandText. Each helper is marked with a justifiedSuppressMessage:IncidentRepositoryReadRow/ReadAll/Run/ExecMasterDataStoreReadColumn/Run/Exec,Migrations.Exec,SchemaHelpersAddColumnIfMissing/ColumnExists,SqliteConnectionFactory.ExecuteMigrationForwardCompatTestsversion-marker SQL now binds the value instead of interpolating itCA1031 (13 sites) — all deliberate, documented broad catches; each carries a justified
SuppressMessagebecause narrowing the exception types would change the documented behavior:StorageProviderFileDialogService.ResolveStartLocation,SystemAlarmServicePlay/TempFileFor/TryLoadIncidentFileStore.TryReadBytes,IncidentRepository.TryReadStateTestDoubles.InvokeAsync(test fixture): exceptions delivered via TaskCompletionSource, not swallowedVerification: harness build (
--no-incremental,AnalysisMode=All) shows CA2100 = 0 and CA1031 = 0 with 0 errors and no new warnings in any other rule; all 801 tests pass.