Metadata-Version: 2.4
Name: mongo_secure
Version: 0.1.0
Summary: Sanitize MongoDB operator strings in selected function arguments.
Author-email: Thomas Perkins <contact@perkinsfund.org>
License: MIT
Project-URL: Homepage, https://github.com/YOUR_USERNAME/mongo_secure
Project-URL: Repository, https://github.com/YOUR_USERNAME/mongo_secure
Project-URL: Issues, https://github.com/YOUR_USERNAME/mongo_secure/issues
Keywords: mongodb,sanitize,decorator,security
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# mongo_secure

Sanitize selected function arguments by replacing MongoDB operators.

## Installation

```
pip install mongo_secure
```

## Usage

```python
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

```python
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
