Sanitize MongoDB operator strings in selected function arguments.
Project description
mongo_secure
Sanitize selected function arguments by replacing MongoDB operators.
Installation
pip install mongo_secure
Usage
from mongo_secure import sanitize
@sanitize("name", "place")
def hello_world(name, place):
print(name)
print(place)
hello_world("$toInt", "$gt")
#<= _toInt
#<= _gt
Nested objects are sanitized recursively
from mongo_secure import replace_blocked_mongo_operators
payload = {
"$set": {
"age": "$toInt",
"tags": ["safe", "$where"]
}
}
print(replace_blocked_mongo_operators(payload))
#<= {"_set": {"age": "_toInt", "tags": ["safe", "_where"]}}
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mongo_secure-0.1.3.tar.gz
(4.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mongo_secure-0.1.3.tar.gz.
File metadata
- Download URL: mongo_secure-0.1.3.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2583a9de9756590049204addb00ff924360fd3c9ba5f501c1c4cede29dc2efb
|
|
| MD5 |
5f0a962a24705fc5da50d261b2d200f1
|
|
| BLAKE2b-256 |
abae5ee39307e3b9a9aa65f43bd608cda0a02c0b84711b68ae72ae072d98af16
|
File details
Details for the file mongo_secure-0.1.3-py3-none-any.whl.
File metadata
- Download URL: mongo_secure-0.1.3-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb218bd360a4e2e494900c84177679b243adeb4c87cc397c740ff835151eb1e7
|
|
| MD5 |
023e2e5b45519f5fc52bed4f759cc4b4
|
|
| BLAKE2b-256 |
2a38bee48cc2df52ec0b13c759314d75035bf3d154ceec5dd6b418bdd8d9de1b
|