Repository navigation
Go: Add models for go 1.21 - #22797
Conversation
Click to show differences in coveragegoGenerated file changes for go
- `Standard library <https://pkg.go.dev/std>`_,"````, ``archive/*``, ``bufio``, ``bytes``, ``cmp``, ``compress/*``, ``container/*``, ``context``, ``crypto``, ``crypto/*``, ``database/*``, ``debug/*``, ``embed``, ``encoding``, ``encoding/*``, ``errors``, ``expvar``, ``flag``, ``fmt``, ``go/*``, ``hash``, ``hash/*``, ``html``, ``html/*``, ``image``, ``image/*``, ``index/*``, ``io``, ``io/*``, ``log``, ``log/*``, ``maps``, ``math``, ``math/*``, ``mime``, ``mime/*``, ``net``, ``net/*``, ``os``, ``os/*``, ``path``, ``path/*``, ``plugin``, ``reflect``, ``reflect/*``, ``regexp``, ``regexp/*``, ``slices``, ``sort``, ``strconv``, ``strings``, ``sync``, ``sync/*``, ``syscall``, ``syscall/*``, ``testing``, ``testing/*``, ``text/*``, ``time``, ``time/*``, ``unicode``, ``unicode/*``, ``unsafe``, ``weak``",52,674,127
+ `Standard library <https://pkg.go.dev/std>`_,"````, ``archive/*``, ``bufio``, ``bytes``, ``cmp``, ``compress/*``, ``container/*``, ``context``, ``crypto``, ``crypto/*``, ``database/*``, ``debug/*``, ``embed``, ``encoding``, ``encoding/*``, ``errors``, ``expvar``, ``flag``, ``fmt``, ``go/*``, ``hash``, ``hash/*``, ``html``, ``html/*``, ``image``, ``image/*``, ``index/*``, ``io``, ``io/*``, ``log``, ``log/*``, ``maps``, ``math``, ``math/*``, ``mime``, ``mime/*``, ``net``, ``net/*``, ``os``, ``os/*``, ``path``, ``path/*``, ``plugin``, ``reflect``, ``reflect/*``, ``regexp``, ``regexp/*``, ``slices``, ``sort``, ``strconv``, ``strings``, ``sync``, ``sync/*``, ``syscall``, ``syscall/*``, ``testing``, ``testing/*``, ``text/*``, ``time``, ``time/*``, ``unicode``, ``unicode/*``, ``unsafe``, ``weak``",52,696,127
- Totals,,690,1134,1580
+ Totals,,690,1156,1580
- context,,,5,,,,,,,,,,,,,,,,,,,,,,,5,
+ context,,,10,,,,,,,,,,,,,,,,,,,,,,,10,
- crypto,,,10,,,,,,,,,,,,,,,,,,,,,,,10,
+ crypto,,,24,,,,,,,,,,,,,,,,,,,,,,,24,
- io,5,4,34,,,,,,5,,,,,,,,,,,,,,4,,,34,
+ io,5,4,36,,,,,,5,,,,,,,,,,,,,,4,,,36,
- math/big,,,1,,,,,,,,,,,,,,,,,,,,,,,1,
+ math/big,,,2,,,,,,,,,,,,,,,,,,,,,,,2, |
There was a problem hiding this comment.
🟡 Changes recommended
The TLS summaries currently introduce false-positive flows from unused ConnectionState arguments.
4 open findings
What changed in this PR
Adds Go 1.21 standard-library data-flow models and corresponding regression coverage.
Changes:
- Models new
context,crypto/tls,io/fs, andmath/bigAPIs. - Adds taint-flow fixtures and a change note.
| File | Description |
|---|---|
go/ql/lib/ext/context.model.yml |
Models new context APIs. |
go/ql/lib/ext/crypto.tls.model.yml |
Models TLS session and QUIC APIs. |
go/ql/lib/ext/io.fs.model.yml |
Models filesystem formatting functions. |
go/ql/lib/ext/math.big.model.yml |
Models Int.Float64. |
go/ql/test/library-tests/semmle/go/frameworks/StdlibTaintFlow/Context.go |
Tests context summaries. |
go/ql/test/library-tests/semmle/go/frameworks/StdlibTaintFlow/CryptoTls.go |
Tests TLS summaries. |
go/ql/test/library-tests/semmle/go/frameworks/StdlibTaintFlow/IoFs.go |
Tests filesystem summaries. |
go/ql/test/library-tests/semmle/go/frameworks/StdlibTaintFlow/MathBig.go |
Tests Int.Float64. |
go/ql/src/change-notes/2026-09-30-model-go1.21-minor-library-changes.md |
Documents the analysis improvement. |
Files not reviewed (2)
- go/ql/test/library-tests/semmle/go/frameworks/StdlibTaintFlow/Context.go: Generated file
- go/ql/test/library-tests/semmle/go/frameworks/StdlibTaintFlow/CryptoTls.go: Generated file
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
b89c8f4 to
1b8dc00
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
michaelnebel
left a comment
There was a problem hiding this comment.
LGTM!
Perhaps, run DCA before merging?
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Active modeling gaps lose taint through TLS fields, context cause retrieval, and filesystem name formatting, leaving relevant flows untracked and needing targeted fixes and regression tests.
5 open issues
4 resolved since last review
Review effort: Max
| @@ -0,0 +1,4 @@ | |||
| reverseRead | |||
| | CryptoTls.go:66:23:66:27 | implicit-deref state | Origin of readStep is missing a PostUpdateNode. | | |||
There was a problem hiding this comment.
Are you planning to address these consistency failures?
There was a problem hiding this comment.
Not in this PR. It's a pre-existing problem that's out of scope for adding these models. But thanks for the prod - I'll have a look into addressing it in a separate PR.
There was a problem hiding this comment.
I've made a draft PR #23245 to fix those consistency test results. I'll update it after this has merged, and then run DCA and QA, as it might lead to a lot more results, if this lack of post-update nodes was stopping flow.
|
DCA looks totally neutral. |


Add models for the minor library changes from Go 1.21.