Conversation
…ver a function) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The models follow existing conventions and are covered by focused flow tests.
Review effort: Balanced
Findings: None
What changed in this PR
Adds Go standard-library value-flow models for maps, following the established slices modeling pattern.
Changes:
- Models key and value flow through
maps.Cloneandmaps.Copy. - Documents intentionally unsupported APIs.
- Adds taint-flow coverage and a change note.
| File | Description |
|---|---|
go/ql/lib/ext/maps.model.yml |
Defines maps summary models. |
go/ql/test/library-tests/semmle/go/frameworks/StdlibTaintFlow/Maps.go |
Tests key and value propagation. |
go/ql/src/change-notes/2026-10-01-model-maps-package.md |
Announces the new models. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
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,678,127
- Totals,,690,1134,1580
+ Totals,,690,1138,1580
+ maps,,,4,,,,,,,,,,,,,,,,,,,,,,,,4 |
Contributor
Author
|
Duplicate of #22709 |
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.
Follows the pattern established in #18108 (which modeled the
slicespackage) to add value-flow models for the Go standard librarymapspackage.Summary
Adds a MaD (models-as-data) summary model for
mapsingo/ql/lib/ext/maps.model.yml, covering the functions that do not involve theiterpackage (which CodeQL cannot yet model):Clone—Argument[0].MapKey/MapValue→ReturnValue.MapKey/MapValue(valueflow)Copy—Argument[1].MapKey/MapValue(src) →Argument[0].MapKey/MapValue(dst) (valueflow)The remaining functions are intentionally left unmodeled, with comments explaining why:
All,Collect,Insert,Keys,Values— involveiter.Seq/iter.Seq2; should be modeled once iterator modeling is supported.DeleteFunc— only removes entries in place and returns nothing, so no new flow path is introduced.Equal,EqualFunc— return abool, so there is no value flow to model.Testing
Added
go/ql/test/library-tests/semmle/go/frameworks/StdlibTaintFlow/Maps.gowith taint-flow tests forCloneandCopy, covering both map keys and map values, following the sameRunAllTaints_*pattern used forslicesinSlices.go.Also added a change note under
go/ql/src/change-notes/.