@@ -7,83 +7,98 @@ import go
77/** Provides classes for working with NoSQL-related APIs. */
88module NoSQL {
99 /**
10- * A data-flow node whose string value is interpreted as (part of) a NoSQL query.
10+ * A data-flow node whose value is interpreted as (part of) a NoSQL query.
1111 *
1212 * Extend this class to refine existing API models. If you want to model new APIs,
13- * extend `NoSQL::QueryString ::Range` instead.
13+ * extend `NoSQL::Query ::Range` instead.
1414 */
15- class NoSQLQueryString extends DataFlow:: Node {
16- NoSQLQueryString :: Range self ;
15+ class Query extends DataFlow:: Node {
16+ Query :: Range self ;
1717
18- NoSQLQueryString ( ) { this = self }
18+ Query ( ) { this = self }
1919 }
2020
21- /** Provides classes for working with SQL query strings . */
22- module NoSQLQueryString {
21+ /** Provides classes for working with NoSQL queries . */
22+ module Query {
2323 /**
24- * A data-flow node whose string value is interpreted as (part of) a NoSQL query.
24+ * A data-flow node whose value is interpreted as (part of) a NoSQL query.
2525 *
2626 * Extend this class to model new APIs. If you want to refine existing API models,
27- * extend `NoSQL::QueryString ` instead.
27+ * extend `NoSQL::Query ` instead.
2828 */
2929 abstract class Range extends DataFlow:: Node { }
3030
3131 /**
32- * Holds if method `name` of `Collection` struct of `go.mongodb.org/mongo-driver/mongo`
33- * package interprets parameter `n` as a query.
32+ * Holds if method `name` of struct `Collection` from package
33+ * [go.mongodb.org/mongo-driver/mongo](https://pkg.go.dev/go.mongodb.org/mongo-driver/mongo)
34+ * interprets parameter `n` as a query.
3435 */
35- private predicate collectionMethods ( string name , int n ) {
36- // func (coll *Collection) CountDocuments(ctx context.Context, filter interface{}, opts ...*options.CountOptions) (int64, error)
36+ private predicate mongoDbCollectionMethod ( string name , int n ) {
37+ // func (coll *Collection) CountDocuments(ctx context.Context, filter interface{},
38+ // opts ...*options.CountOptions) (int64, error)
3739 name = "CountDocuments" and n = 1
3840 or
39- // func (coll *Collection) DeleteMany(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (*DeleteResult, error)
41+ // func (coll *Collection) DeleteMany(ctx context.Context, filter interface{},
42+ // opts ...*options.DeleteOptions) (*DeleteResult, error)
4043 name = "DeleteMany" and n = 1
4144 or
42- // func (coll *Collection) DeleteOne(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (*DeleteResult, error)
45+ // func (coll *Collection) DeleteOne(ctx context.Context, filter interface{},
46+ // opts ...*options.DeleteOptions) (*DeleteResult, error)
4347 name = "DeleteOne" and n = 1
4448 or
45- // func (coll *Collection) Distinct(ctx context.Context, fieldName string, filter interface{}, ...) ([]interface{}, error)
49+ // func (coll *Collection) Distinct(ctx context.Context, fieldName string, filter interface{},
50+ // ...) ([]interface{}, error)
4651 name = "Distinct" and n = 2
4752 or
48- // func (coll *Collection) Find(ctx context.Context, filter interface{}, opts ...*options.FindOptions) (*Cursor, error)
53+ // func (coll *Collection) Find(ctx context.Context, filter interface{},
54+ // opts ...*options.FindOptions) (*Cursor, error)
4955 name = "Find" and n = 1
5056 or
51- // func (coll *Collection) FindOne(ctx context.Context, filter interface{}, opts ...*options.FindOneOptions) *SingleResult
57+ // func (coll *Collection) FindOne(ctx context.Context, filter interface{},
58+ // opts ...*options.FindOneOptions) *SingleResult
5259 name = "FindOne" and n = 1
5360 or
54- // func (coll *Collection) FindOneAndDelete(ctx context.Context, filter interface{}, ...) *SingleResult
61+ // func (coll *Collection) FindOneAndDelete(ctx context.Context, filter interface{}, ...)
62+ // *SingleResult
5563 name = "FindOneAndDelete" and n = 1
5664 or
57- // func (coll *Collection) FindOneAndReplace(ctx context.Context, filter interface{}, replacement interface{}, ...) *SingleResult
65+ // func (coll *Collection) FindOneAndReplace(ctx context.Context, filter interface{},
66+ // replacement interface{}, ...) *SingleResult
5867 name = "FindOneAndReplace" and n = 1
5968 or
60- // func (coll *Collection) FindOneAndUpdate(ctx context.Context, filter interface{}, update interface{}, ...) *SingleResult
69+ // func (coll *Collection) FindOneAndUpdate(ctx context.Context, filter interface{},
70+ // update interface{}, ...) *SingleResult
6171 name = "FindOneAndUpdate" and n = 1
6272 or
63- // func (coll *Collection) ReplaceOne(ctx context.Context, filter interface{}, replacement interface{}, ...) (*UpdateResult, error)
73+ // func (coll *Collection) ReplaceOne(ctx context.Context, filter interface{},
74+ // replacement interface{}, ...) (*UpdateResult, error)
6475 name = "ReplaceOne" and n = 1
6576 or
66- // func (coll *Collection) UpdateMany(ctx context.Context, filter interface{}, update interface{}, ...) (*UpdateResult, error)
77+ // func (coll *Collection) UpdateMany(ctx context.Context, filter interface{},
78+ // update interface{}, ...) (*UpdateResult, error)
6779 name = "UpdateMany" and n = 1
6880 or
69- // func (coll *Collection) UpdateOne(ctx context.Context, filter interface{}, update interface{}, ...) (*UpdateResult, error)
81+ // func (coll *Collection) UpdateOne(ctx context.Context, filter interface{},
82+ // update interface{}, ...) (*UpdateResult, error)
7083 name = "UpdateOne" and n = 1
7184 or
72- // func (coll *Collection) Watch(ctx context.Context, pipeline interface{}, ...) (*ChangeStream, error)
85+ // func (coll *Collection) Watch(ctx context.Context, pipeline interface{}, ...)
86+ // (*ChangeStream, error)
7387 name = "Watch" and n = 1
7488 or
75- // func (coll *Collection) Aggregate(ctx context.Context, pipeline interface{}, opts ...*options.AggregateOptions) (*Cursor, error)
89+ // func (coll *Collection) Aggregate(ctx context.Context, pipeline interface{},
90+ // opts ...*options.AggregateOptions) (*Cursor, error)
7691 name = "Aggregate" and n = 1
7792 }
7893
7994 /**
80- * A query string used in an API function acting on a `Collection` struct of
81- * ` go.mongodb.org/mongo-driver/mongo` package
95+ * A query used in an API function acting on a `Collection` struct of package
96+ * [ go.mongodb.org/mongo-driver/mongo](https://pkg.go.dev/go.mongodb.org/mongo-driver/mongo).
8297 */
83- private class MongoDbCollectionQueryString extends Range {
84- MongoDbCollectionQueryString ( ) {
98+ private class MongoDbCollectionQuery extends Range {
99+ MongoDbCollectionQuery ( ) {
85100 exists ( Method meth , string methodName , int n |
86- collectionMethods ( methodName , n ) and
101+ mongoDbCollectionMethod ( methodName , n ) and
87102 meth .hasQualifiedName ( "go.mongodb.org/mongo-driver/mongo" , "Collection" , methodName ) and
88103 this = meth .getACall ( ) .getArgument ( n )
89104 )
@@ -97,7 +112,7 @@ module NoSQL {
97112 predicate isAdditionalMongoTaintStep ( DataFlow:: Node pred , DataFlow:: Node succ ) {
98113 // Taint an entry if the `Value` is tainted
99114 exists ( Write w , DataFlow:: Node base , Field f | w .writesField ( base , f , pred ) |
100- base = succ .getASuccessor * ( ) and
115+ base = succ .( DataFlow :: PostUpdateNode ) . getPreUpdateNode ( ) and
101116 base .getType ( ) .hasQualifiedName ( "go.mongodb.org/mongo-driver/bson/primitive" , "E" ) and
102117 f .getName ( ) = "Value"
103118 )
0 commit comments