Skip to content

Commit c0dc495

Browse files
committed
Add fake source library for tests
1 parent 21e5f84 commit c0dc495

File tree

6 files changed

+25
-2
lines changed

6 files changed

+25
-2
lines changed

go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ require (
66
gorm.io/gorm v1.23.0
77
github.com/jmoiron/sqlx v1.4.0
88
go.mongodb.org/mongo-driver/mongo v1.17.2
9+
github.com/nonexistent/sources v0.0.0-20250300000000-000000000000
910
)

go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/source.ext.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,9 @@ extensions:
33
pack: codeql/threat-models
44
extensible: threatModelConfiguration
55
data:
6-
- ["database", true, 0]
6+
- ["database", true, 0]
7+
- addsTo:
8+
pack: codeql/go-all
9+
extensible: sourceModel
10+
data:
11+
- ["github.com/nonexistent/sources", "", False, "Source", "", "", "ReturnValue", "database", "manual"]

go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/test.ext.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,9 @@ extensions:
55
extensible: threatModelConfiguration
66
data:
77
- ["database", true, 0]
8+
9+
- addsTo:
10+
pack: codeql/go-all
11+
extensible: sourceModel
12+
data:
13+
- ["github.com/nonexistent/sources", "", False, "Source", "", "", "ReturnValue", "database", "manual"]

go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/test.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ import experimental.frameworks.CleverGo
55
import utils.test.InlineFlowTest
66

77
module Config implements DataFlow::ConfigSig {
8-
predicate isSource(DataFlow::Node source) { source instanceof ActiveThreatModelSource }
8+
predicate isSource(DataFlow::Node source) {
9+
source instanceof ActiveThreatModelSource or
10+
source.asExpr().(CallExpr).getCalleeName() = "source"
11+
}
912

1013
predicate isSink(DataFlow::Node sink) {
1114
sink.asExpr() = any(CallExpr c | c.getTarget().getName() = "sink").getAnArgument()

go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/vendor/github.com/nonexistent/sources/stub.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/vendor/modules.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ github.com/jmoiron/sqlx
77
# go.mongodb.org/mongo-driver/mongo v1.17.2
88
## explicit
99
go.mongodb.org/mongo-driver/mongo
10+
# github.com/nonexistent/sources v0.0.0-20250300000000-000000000000
11+
## explicit
12+
github.com/nonexistent/sources

0 commit comments

Comments
 (0)