-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Go: Add database
source models for the squirrel
package (#2)
#19090
Conversation
Click to show differences in coveragegoGenerated file changes for go
- `Squirrel <https://github.com/Masterminds/squirrel>`_,"``github.com/Masterminds/squirrel*``, ``github.com/lann/squirrel*``, ``gopkg.in/Masterminds/squirrel``",,,96
+ `Squirrel <https://github.com/Masterminds/squirrel>`_,"``github.com/Masterminds/squirrel*``, ``github.com/lann/squirrel*``, ``gopkg.in/Masterminds/squirrel``",81,,96
- Totals,,560,1048,1556
+ Totals,,641,1048,1556
- github.com/Masterminds/squirrel,32,,,,,,,,,,,,,,32,,,,,,,,,,,,
+ github.com/Masterminds/squirrel,32,27,,,,,,,,,,,,,32,,,,,,27,,,,,,
- github.com/lann/squirrel,32,,,,,,,,,,,,,,32,,,,,,,,,,,,
+ github.com/lann/squirrel,32,27,,,,,,,,,,,,,32,,,,,,27,,,,,,
- gopkg.in/Masterminds/squirrel,32,,,,,,,,,,,,,,32,,,,,,,,,,,,
+ gopkg.in/Masterminds/squirrel,32,27,,,,,,,,,,,,,32,,,,,,27,,,,,, |
ab53cd9
to
0fbeef8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds database source models for the github.com/Masterminds/squirrel ORM package along with corresponding tests and YAML configuration updates.
- Introduces new test functions in Go to validate taint flows from various squirrel methods.
- Updates YAML extension files (test and source) with new source model configurations.
- Adds change notes to document the introduction of the database source models.
Reviewed Changes
Copilot reviewed 8 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/test_Masterminds_squirrel.go | New test functions for database flows using squirrel methods |
go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/test.ext.yml | Added source model configuration for the database flows |
go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/source.ext.yml | Added source model configuration for the database flows |
go/ql/lib/ext/github.com.masterminds.squirrel.model.yml | Extended the model with new source model entries for squirrel |
go/ql/lib/change-notes/2025-03-02-squirrel-source-models.md | Added change notes for the new database source models |
Files not reviewed (3)
- go/ql/lib/go.qll: Language not supported
- go/ql/lib/semmle/go/frameworks/Squirrel.qll: Language not supported
- go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/go.mod: Language not supported
Tip: Copilot code review supports C#, Go, Java, JavaScript, Markdown, Python, Ruby and TypeScript, with more languages coming soon. Learn more
if err != nil { | ||
return | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error check after calling std.QueryRow("") is invalid since QueryRow does not return an error. Remove the error check on line 97.
if err != nil { | |
return | |
} |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks plausible. Haven't trawled the godoc of the library for other modelling candidates.
FunctionOutput outp; | ||
|
||
BuilderScan() { | ||
// signature: func (b InsertBuilder) Scan(dest ...interface{}) error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// signature: func (b InsertBuilder) Scan(dest ...interface{}) error | |
// signature: func (b {Insert,Delete,Select,Update}Builder) Scan(dest ...interface{}) error |
FunctionOutput outp; | ||
|
||
BuilderScanContext() { | ||
// signature: func (b InsertBuilder) ScanContext(ctx context.Context, dest ...interface{}) error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// signature: func (b InsertBuilder) ScanContext(ctx context.Context, dest ...interface{}) error | |
// signature: func (b {Insert,Delete,Select,Update}Builder) ScanContext(ctx context.Context, dest ...interface{}) error |
- ["group:squirrel", "", True, "QueryRowContextWith", "", "", "ReturnValue", "database", "manual"] | ||
- ["group:squirrel", "", True, "QueryRowWith", "", "", "ReturnValue", "database", "manual"] | ||
- ["group:squirrel", "", True, "QueryWith", "", "", "ReturnValue[0]", "database", "manual"] | ||
- ["group:squirrel", "DeleteBuilder", True, "Query", "", "", "ReturnValue[0]", "database", "manual"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a comment to the yml models pointing out there are also QL models and vice versa
Copy of #18902 with some reviews applied that were more easily done on the command line.