Metadata-Version: 2.4
Name: shieldai-zen
Version: 1.0.0
Summary: ShieldAI Zen Firewall — In-app runtime protection for Python (FastAPI, Django, Flask, Starlette). Blocks SQLi, XSS, path traversal, command injection, SSRF.
Home-page: https://github.com/shieldai/zen-python
Author: ShieldAI Security
Author-email: security@shieldai.dev
Project-URL: Homepage, https://shieldai.dev
Project-URL: Bug Reports, https://github.com/shieldai/zen-python/issues
Project-URL: Source, https://github.com/shieldai/zen-python
Project-URL: Documentation, https://docs.shieldai.dev/zen
Keywords: security firewall waf middleware sqli xss rasp runtime-protection shieldai
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Topic :: Security
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
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 :: Only
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: fastapi
Requires-Dist: starlette>=0.20.0; extra == "fastapi"
Provides-Extra: django
Requires-Dist: django>=3.2; extra == "django"
Provides-Extra: flask
Requires-Dist: flask>=2.0; extra == "flask"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license-file
Dynamic: project-url
Dynamic: provides-extra
Dynamic: requires-python
Dynamic: summary

# shieldai-zen

**In-app runtime protection for Python web applications.**

Block SQL injection, XSS, path traversal, command injection, and SSRF with less than 1ms overhead. Supports FastAPI, Django, Flask, and any ASGI/WSGI framework.

[![PyPI version](https://badge.fury.io/py/shieldai-zen.svg)](https://pypi.org/project/shieldai-zen/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

---

## Quick Start

```bash
pip install shieldai-zen
```

### FastAPI / Starlette

```python
from fastapi import FastAPI
from shieldai_zen import ZenFirewallMiddleware

app = FastAPI()
app.add_middleware(ZenFirewallMiddleware, token="zen_your_token")
```

### Django

```python
# settings.py
MIDDLEWARE = [
    'shieldai_zen.DjangoZenMiddleware',
    # ... your other middleware
]
SHIELD_ZEN_TOKEN = 'zen_your_token'
SHIELD_ZEN_MODE = 'block'   # or 'monitor'
```

### Flask

```python
from flask import Flask
from shieldai_zen import FlaskZen

app = Flask(__name__)
FlaskZen(app, token="zen_your_token")
```

---

## What It Blocks

| Attack | Example | Action |
|---|---|---|
| SQL Injection | `' OR 1=1--` | 🛑 Blocked |
| XSS | `<script>alert(1)</script>` | 🛑 Blocked |
| Path Traversal | `../../etc/passwd` | 🛑 Blocked |
| Command Injection | `; bash -i >& /dev/tcp/...` | 🛑 Blocked |
| SSRF | `http://169.254.169.254/...` | 🛑 Blocked |

---

## Configuration

```python
app.add_middleware(ZenFirewallMiddleware,
    token="zen_your_token",      # from ShieldAI dashboard
    mode="block",                # "block" (default) | "monitor" (log only)
    threshold=60,                # risk score to block (0-100)
    app_name="my-api",           # shown in ShieldAI dashboard
)
```

### Environment Variables

```bash
SHIELD_ZEN_TOKEN=zen_xxxxxxxxxxxx
SHIELD_APP_NAME=my-api
```

---

## Get Your Token

1. Go to [shieldai.dev](https://shieldai.dev)
2. Navigate to **Protect → Zen Firewall → Add Protected App**
3. Select **Python** and copy your token

---

## License

MIT © ShieldAI Security
