MongoEngine / MongoEngine/mongoengine
Injection prevention
Open
Nobody has claimed this yet.
High Priority
- Dominant language
- Python
- Stars
- 4.3k
- Forks
- 1.2k
- Avg merge
- 4h 41m
- Merged PRs (30d)
- 11
Description
Hello, I was expecting MongoEngine to help developers to prevent injection vulnerabilities.
class User(Document):
name = StringField()
# assume this is controller for HTTP request
def get_users_by_name(request):
# assume that request.json is {'name': {'$gt': ''}}
q = User.objects(name=request.json['name'])
print(q._query) # this would change original query structure to {'name': {'$gt': ''}}
return list(q)
Expecting MongoEngine to not allow such behavior, because ORM's for SQL usually prevent most injection vectors. Let me know your opinion on it.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with User.objects(name=request.json['name']) and inspect q._query while reproducing the supplied request.json value in MongoEngine's Python/MongoDB path. Done should establish whether this behavior is in scope and capture the project's agreed injection-prevention behavior with coverage for the example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mongodb, python
- Domain
- databases, security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100