Security guardrails for AI-built web applications.
TorusGuard is a Markdown-first, portable AI-agent skill that helps developers audit and harden AI-built web applications. It provides structured rules, references, and remediation workflows across frontend database isolation, secrets management, input validation, authentication, rate limits, SSRF, webhooks, and production deployment safety.
AI code generators accelerate product development, but they can easily introduce critical security oversightsβsuch as client-side database queries, exposed API secrets, missing authorization checks, or unvalidated outbound requests. Security decisions still require structure, boundaries, and systematic verification. TorusGuard gives AI coding agents the context and guardrails needed to build and deploy securely.
If the browser receives it, users can inspect it.
DevTools, Inspect Element, and the Sources tab cannot be blocked. TorusGuard enforces that database credentials, sensitive business logic, and authorization decisions must always remain on trusted server-side code.
- Markdown-First & Agent-Portable: Works out-of-the-box in Cursor, Antigravity, Claude Code, Cline, Codex, Gemini CLI, and other agent environments without requiring npm dependencies or compilation.
- Framework-Aware Security Catalog: 60+ structured security rules across secrets, database access, input validation, authentication, rate limits, SSRF, CSRF, webhooks, GraphQL, WebSockets, and supply-chain dependencies.
- Multi-Ecosystem Support: Deep, framework-idiomatic security guidance for JavaScript/TypeScript (Node.js, Express, React, Vite, Next.js) and Python (Django, DRF, FastAPI, Flask, SQLAlchemy).
- Human-First Findings: Generates clear, readable audit reports featuring severity levels, plain-English risk explanations, and concrete before/after code snippets.
- Evidence-Confidence System: Distinguishes verified code vulnerabilities from architecture-dependent manual review items.
- Least-Invasive Hardening: Modifies only code directly tied to verified findings while preserving business logic and application routes.
TorusGuard v0.4.1 stabilizes Python platform security, refines stack detection, sharpens evidence-confidence handling, and includes regression fixtures:
- Stack Detection Refinements: Accurate detection across Django (
manage.py), DRF (pyproject.toml), FastAPI, Flask (requirements.txt), Flask+SQLAlchemy, Python libraries, and polyglot monorepos. - Evidence Classification: Clear criteria for distinguishing direct vulnerabilities from service-layer domain authorization.
- Regression Fixture Suite: 10 paired safe and vulnerable fixtures in
tests/fixtures/python/. - Framework Guides: Full guidance for Django, DRF, FastAPI, Flask, SQLAlchemy, and Python dependency management.
Read the complete release notes in docs/releases/v0.4.1.md.
- Django Guide β Settings, CSRF, ORM queries, ModelForms, object ownership.
- Django REST Framework Guide β Default permissions, ViewSets, serializers, throttles, pagination.
- FastAPI Guide β Pydantic v2 schemas, dependencies, outbound SSRF checks, HMAC webhooks.
- Flask Guide β Factory setup, session cookies, CSRFProtect, Werkzeug upload boundaries.
- SQLAlchemy Guide β Parameterized
text()bindings, query scoping, update allowlists. - Python Dependencies & CI/CD β Reproducible lockfiles,
pip-audit, GitHub Actions pinning. - Python Rule Mapping Matrix β Framework implementation matrix for universal rule IDs.
- React + Vite Guide β Frontend environment variables, build artifact leakage, source maps.
- Next.js Guide β App Router / Pages Router security, Server Components, API routes.
- Node.js + Express Guide β Middleware hardening, CORS, Helmet, session cookies, rate limiting.
- Supabase Guide β Row-Level Security (RLS), service role key isolation, database policies.
- Firebase Guide β Firestore Security Rules, client SDK boundaries, privileged admin tasks.
Install TorusGuard into your AI coding tool using the open skills CLI:
npx skills add https://github.com/githubmofo/TorusGuard --skill "torusguard"Once installed, interact with your AI assistant in chat using the /torusguard command:
- Initialize Project Security Baseline:
/torusguard init - Audit Codebase (Read-Only Scan):
/torusguard audit - Harden & Apply Fixes:
/torusguard harden - Pre-Flight Deployment Verification:
/torusguard verify
| Command | Purpose | Modifies Code? |
|---|---|---|
/torusguard init |
Generates a project SECURITY.md and readable threat model. |
β Docs only |
/torusguard audit |
Scans repository against TorusGuard rules and outputs a structured report. | β No |
/torusguard harden |
Applies least-invasive, safe fixes for confirmed findings from the audit report. | β Yes |
/torusguard check <area> |
Audits a single rule category (e.g., django, fastapi, auth, ssrf). |
β No |
/torusguard verify |
Runs a production pre-flight deployment verification checklist. | β No |
Supported Check Areas: secrets, database, input, auth, rate-limit, client, platform, ssrf, business-logic, csrf, webhook, graphql, websocket, supply-chain, cache, django, drf, fastapi, flask, sqlalchemy.
TorusGuard has been locally validated against educational fixtures and real-world architectures:
- OWASP NodeGoat: An intentionally vulnerable Node.js / Express / MongoDB training application.
- Django Reference: Validation of settings, IDOR, ModelForms, and caching.
- DRF API Reference: ViewSet scoping, serializer mass assignment, throttling, and pagination caps.
- FastAPI Reference: Pydantic schemas, outbound SSRF filtering, and HMAC webhook verification.
- Flask Reference: Secret keys, CSRF protection, and file upload boundaries.
- Cross-Platform Rule Parity: Architectural comparison across Node.js and Python ecosystems.
- Real-World Validation Records: Maintainer-authorized codebase evaluations across Django, FastAPI, Flask, and Monorepo architectures.
TorusGuard classifies every audit finding by confidence level:
Confirmed: Directly observed in source code or configuration.Likely: Strong static indicators; requires runtime or deployment environment confirmation.Manual Review: Architectural or business-context decisions that static analysis cannot reliably determine.Informational: Hardening advice and defensive best practices.
Read the complete validation summary in docs/validation/README.md.
To maintain technical honesty and clear boundaries:
- Not an automated vulnerability scanner: TorusGuard is a contextual guidance framework for developers and AI agents. It does not replace dynamic application security testing (DAST) or static binary analyzers.
- Not a penetration-testing replacement: It elevates baseline security hygiene but cannot replace authorized professional penetration testing.
- Not an "unhackable" guarantee: No tool can guarantee 100% security.
- Not a client-side DRM: Browser-delivered JavaScript cannot be hidden from DevTools; security must reside on the backend.
TorusGuard/
βββ skills/torusguard/ # Portable skill instructions and reference modules
βββ rules/ # 60+ documented security rules across 14 categories
βββ templates/ # Standardized templates (SECURITY, audit, pre-flight)
βββ guides/ # Stack-specific implementation guides (Node.js & Python)
βββ examples/ # Educational vulnerable & hardened reference applications
βββ docs/
β βββ releases/ # Release notes (v0.2.0, v0.3.0, v0.4.0, v0.4.1)
β βββ python-rule-mapping.md # Universal rule mapping across Python stacks
β βββ validation/ # Official validation reports & real-world records
β βββ roadmap.md # Project roadmap & milestones
β βββ demo.md # Sample audit walkthrough & finding format
βββ tests/ # Test fixtures and rule validation matrices
- v0.1.0 (Released): Initial core skill and reference modules.
- v0.2.0 (Released): Baseline 25-rule catalog, templates, guides, and reference apps.
- v0.3.0 (Released): Advanced Web and API Security (SSRF, Webhooks, GraphQL, WebSockets, Cache).
- v0.4.0 (Released): Python Platform Security (Django, DRF, FastAPI, Flask, SQLAlchemy, Dependencies).
- v0.4.1 (Released): Python Validation & Quality Patch (Stack detection, regression fixtures, evidence hardening).
- v0.5.0 (Next): Serverless & Edge Compute Security (Cloudflare Workers, Vercel Edge, AWS Lambda).
- v1.0.0 (Planned): Full rule freeze, automated catalog linter, and multi-framework expansion.
See docs/roadmap.md for full milestone details.
Contributions are welcome! You can help by proposing new security rules, improving existing guidance, reporting false positives, or adding framework implementation guides.
Please review CONTRIBUTING.md and our Code of Conduct before submitting an issue or pull request.
If you discover a security issue within the TorusGuard repository or its skill definitions, please review our Security Policy for private responsible disclosure instructions. Do not file public GitHub issues for security vulnerabilities.
TorusGuard is licensed under the MIT License.
Copyright (c) 2026 Jenish Lad.
