tornadoapi-guard
April 5, 2026 ยท View on GitHub
tornadoapi-guard is a security library for Tornado that provides middleware to control IPs, log requests, detect penetration attempts and more. It integrates seamlessly with Tornado to offer robust protection against various security threats. Powered by guard-core.
Part of the Guard Security Ecosystem:
| Framework | Package | Language |
|---|---|---|
| FastAPI | fastapi-guard | Python |
| Flask | flaskapi-guard | Python |
| Django | djapi-guard | Python |
| Tornado | tornadoapi-guard (this) | Python |
| Express/NestJS/Fastify/Hono | guard-core-ts | TypeScript |
Features
- IP Whitelisting and Blacklisting: Control access based on IP addresses.
- User Agent Filtering: Block requests from specific user agents.
- Rate Limiting: Limit the number of requests from a single IP.
- Automatic IP Banning: Automatically ban IPs after a certain number of suspicious requests.
- Penetration Attempt Detection: Detect and log potential penetration attempts.
- HTTP Security Headers: Comprehensive security headers management (CSP, HSTS, X-Frame-Options, etc.)
- Custom Logging: Log security events to a custom file.
- Cloud Provider IP Blocking: Block requests from cloud provider IPs (AWS, GCP, Azure).
- IP Geolocation: Use a service like IPInfo.io API to determine the country of an IP address.
- Distributed State Management: (Optional) Redis integration for shared security state across instances
- Flexible Storage: Redis-enabled distributed storage or in-memory storage for single instance deployments
Installation
To install tornadoapi-guard, use pip:
pip install tornadoapi-guard
Status
Work in progress. The adapter layer is being built to bring guard-core's full security pipeline to Tornado applications.
Development
# Install dependencies
make install-dev
# Run tests locally
make local-test
# Run linters
make lint
# Fix formatting
make fix
# Run all checks
make check-all
Contributing
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Author
Renzo Franceschini - rennf93@users.noreply.github.com .