plato-input-sanitizer
Input validation and authentication middleware for PLATO fleet services.
Components
input_sanitizer — Defense-in-depth input validation
- Agent name sanitization (XSS, SQL injection, path traversal blocking)
- Room name validation (whitelist characters)
- Content sanitization (null bytes, length limits)
- Tile submission validation (required fields, answer min-length)
auth — Bearer token authentication with rate limiting
- Simple shared-secret Bearer token auth
- Per-agent rate limiting (configurable RPM for reads vs writes)
- Timing-safe token comparison
- Modes:
token(enforce),open(dev),permissive(log-only)
Install
pip install plato-input-sanitizer
Usage
from plato_input_sanitizer import sanitize_agent_name, sanitize_tile_submission
from plato_input_sanitizer.auth import AuthMiddleware
# Validate inputs
name = sanitize_agent_name("agent-42") # raises ValueError if bad
# Auth middleware
auth = AuthMiddleware.from_env() # reads PLATO_API_KEY
if not auth.validate(request.headers.get("Authorization", "")):
return 401, {"error": "Unauthorized"}
if not auth.check_rate_limit(agent_name, is_write=True):
return 429, {"error": "Rate limited"}
Security Audit Response
Created in response to external security audit findings:
- CRITICAL-5: Stored XSS via agent names →
sanitize_agent_name()with HTML escaping - HIGH-4: Path traversal in multiple services → injection pattern blocking
- HIGH-3: Rate limit bypass via agent rotation → per-agent rate limiting with timing enforcement
Metadata
Release files for plato-input-sanitizer 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| plato_input_sanitizer-0.1.0.tar.gz | 5.3 kB | Without provenance | Details for plato_input_sanitizer-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| plato_input_sanitizer-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for plato_input_sanitizer-0.1.0-py3-none-any.whl |
Total release size: 11.5 kB
Release files / plato_input_sanitizer-0.1.0.tar.gz
| Download URL | plato_input_sanitizer-0.1.0.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cd6b8690e1629eb5dbf4e44a3c9fc78e8cfe89b4b9d5e017e2fac8f77a0cd3f1
|
|
BLAKE2b-256 checksum How to use checksums |
7f53e41605dd6b74c78c2e88b15c94dc16b08c1fb43eb57eeba2a775bf6ed50e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|
Release files / plato_input_sanitizer-0.1.0-py3-none-any.whl
| Download URL | plato_input_sanitizer-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0fd3aaff27ee0006a974a07d41c01d1e37c06575dbe02a476a43e44a6df9f437
|
|
BLAKE2b-256 checksum How to use checksums |
692c474544ae115fd5d611d53b1588231afb0329bbaf2182e5f57d9840594f8d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|
Security for plato-input-sanitizer 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.