PyMongo is the official MongoDB driver for Python. Collection methods accept filter dicts; NoSQL injection occurs when filter dicts are built from user-supplied JSON that lets attackers inject $where, $regex, or operator keys.
.find().find_one().update_one().delete_one().aggregate().find()SinkCollection.find(filter: Mapping = None, projection: Mapping = None, ...) -> Cursor
Queries documents. NoSQL injection sink if filter is built from user input.
0.find_one()SinkCollection.find_one(filter: Mapping = None, ...) -> dict | None
Returns first matching document. Same NoSQL injection risk.
0.update_one()SinkCollection.update_one(filter: Mapping, update: Mapping, ...) -> UpdateResult
Updates a single document. Injection sink on filter and update args.
0, 1.delete_one()SinkCollection.delete_one(filter: Mapping, ...) -> DeleteResult
Deletes a single document. NoSQL injection sink.
0.aggregate()SinkCollection.aggregate(pipeline: Sequence[Mapping], ...) -> CommandCursor
Runs an aggregation pipeline. Each stage can be injection-sensitive.
0| FQN | Field | |
|---|---|---|
| pymongo | fqns[0] | |
| pymongo.collection.Collection | fqns[1] | |
| pymongo.MongoClient | fqns[2] |
Wrong FQN → 0 findings. Verify with: change fqns to garbage → must produce 0 results.
from codepathfinder.go_rule import PyPyMongo