Skip to content

Add missing rows.Err() check in AWS consumeEntries - #1176

Merged
roger2hk merged 1 commit into
transparency-dev:mainfrom
roger2hk:aws-rows-err
Sep 15, 2026
Merged

roger2hk merged 1 commit into
transparency-dev:mainfrom
roger2hk:aws-rows-err

Conversation

@roger2hk

Copy link
Copy Markdown
Contributor

Here is the fix for the issue found by Go Analysis.

sql.Rows "rows" is used in Next loop at line 1198 without final check of rows.Err() sqlrowserr ([default](https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/sqlrowserr))

for rows.Next() stops for two different reasons, and they're indistinguishable without an extra check:

  • All rows have been consumed normally (the happy path).
  • An error occurred mid-iteration — e.g. a network/connection drop, a query cancellation, a driver-level decoding failure, or a context timeout.

Why that's dangerous here specifically: this is the sequencing consume path. If the query is truncated early by an error, the code would happily treat a partial result set as "that's all there was", then go on to consume/integrate only some of the entries — or, if zero rows were read, return false, nil ("nothing to sequence") when actually the DB call failed. Silent data-correctness bug rather than a loud error.

@roger2hk
roger2hk requested a review from AlCutter September 14, 2026 17:01
@roger2hk
roger2hk requested a review from a team as a code owner September 14, 2026 17:01
@roger2hk
roger2hk merged commit 224ddbf into transparency-dev:main Sep 15, 2026
19 of 20 checks passed
@roger2hk
roger2hk deleted the aws-rows-err branch September 15, 2026 13:05
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