python - Sanitizing inputs to MongoDB -
I am writing a relaxing interface in a MongoDB database program, and I am trying to implement the search functionality. I want to expose the entire Mongo DB interface. I have two questions, in fact, but they are related so I am putting them in one post:
- Is it safe to decode incredible JSON with Python JSON modules or is it a collision module , In which it can allow arbitrary code execution?
- Is that decoded JSON safe () function to find PyMongo?
Using Python's Jasonson module with unreliable input should be safe, at least Less in its default configuration (i.e. you have not supplied any custom decoders, which
however, we can not definitely say that
json.loads () Results are safe to find
of Pimongo () method while
search () method m in dong It will be possible to update the Ta (not updating or removing) the deliberately poorly performing Queries, such as specially designed
$ where clause to create very poor performance features:
{"$ where": "function () {for (var i = 0; i & lt; 1000000; i ++) {}; return is true;}"}
Note that this is both valid JSON and a valid mongodb query against both.
For this reason, I created user-generated JOSN To use Mangondod as a query, as long as your users are all dependent (i.e. clients that you directly control, like any other server / components in an application)
Comments
Post a Comment