Security guardrails and structured verification workflow for AI-built web applications.
TorusGuard is a Markdown-first, portable AI-agent skill and security workflow engine. It helps developers and AI coding agents audit, verify, harden, and re-check modern web applications through structured rules, normalized evidence schemas, and human-friendly 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, guardrails, and deterministic workflow 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.
TorusGuard v0.5.0 introduces a formal state machine governing every candidate security finding:
βββββββββββββ ββββββββββββββ βββββββββββββ βββββββββββββββ βββββββββββββ βββββββββββββ
β 1. Detect β βββΊ β 2.Classify β βββΊ β 3. Verify β βββΊ β 4.Remediate β βββΊ β 5.Recheck β βββΊ β 6.Archive β
βββββββββββββ ββββββββββββββ βββββββββββββ βββββββββββββββ βββββββββββββ βββββββββββββ
- Detect: Scan repository source code, environment templates, and manifests.
- Classify: Assign a canonical Rule ID (
TG-*), taxonomy category, risk severity, and initial confidence. - Verify: Validate evidence sufficiency and reachable data flow. If evidence is ambiguous, force status to
Needs Review. - Remediate: Formulate least-invasive, framework-native code modifications with before/after diffs.
- Re-check: Re-audit modified code to verify that the vulnerability is resolved (
Verified Safe). - Archive: Preserve timestamped verification evidence in the project audit record.
- Markdown-First & Agent-Portable: Works out-of-the-box in Cursor, Antigravity, Claude Code, Cline, Codex, Gemini CLI, and other agent environments without requiring external compilation or runtime daemons.
- Formal Data & Evidence Schemas (
schemas/): Strict JSON schemas for findings, evidence typing (source,runtime,test,manual_review), and remediation objects. - Repeatable Validation Harness (
harness/): Standalone automated test harness validating schemas, 60-rule catalog integrity, and differential fixture behavior. - 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.
- Multi-Ecosystem Support: Deep, framework-idiomatic 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.
TorusGuard v0.5.4 introduces a streamlined, actionable reporting and triage architecture:
- 9-Section Report Architecture: Standardized flow from Executive Summary to Detailed Findings and Roadmap.
- Remediation Priority Triage: Findings classified by urgency (
Immediate P0,Near-Term P1,Backlog P2). - Context Separation: Strict separation of executive Business Impact from technical code mechanics.
- Sensitive Data Masking: Automated redaction of API keys (
sk_live_...), GitHub tokens, and passwords in evidence snippets. - Ticket-Ready Payloads: Pre-formatted Markdown blocks ready to copy-paste into GitHub Issues, Jira, and Linear.
- Validation Harness: 64 automated tests passing with 100% pass rate (
python harness/runner.py).
Read the complete release notes in docs/releases/v0.5.4.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"| Command | Lifecycle Phase | Purpose | Modifies Code? |
|---|---|---|---|
/torusguard init |
Baseline | Generates a project SECURITY.md, threat model, and baseline. |
β Docs only |
/torusguard audit |
Detect & Classify | Scans repository against TorusGuard rules and outputs a structured report. | β No |
/torusguard verify |
Verify | Validates evidence sufficiency and checks manual review criteria. | β No |
/torusguard harden |
Remediate | Applies least-invasive, safe fixes for confirmed findings. | β Yes |
/torusguard recheck |
Re-check | Re-evaluates post-fix code to assert resolution (Verified Safe). |
β No |
When an audit report is generated:
- Inspect Evidence Snippet: Confirm the cited file path and line numbers exist in your active codebase.
- Review Confidence Classification:
Confirmed: Proved with direct source code or configuration evidence.Needs Review: Requires verifying out-of-band context (e.g. domain service layer, upstream API gateway, cloud IAM).
- Execute Verification Command: Run the documented test command in the finding's
Verificationsection.
- Review Proposed Diffs: Run
/torusguard hardento generate framework-native, least-invasive code modifications. - Apply Changes: Update the affected code following the provided safe patterns.
- Run Differential Re-check: Execute
/torusguard recheckto verify that the finding transitions toVerified Safe.
TorusGuard maintains a repeatable automated validation harness:
python harness/runner.pyThe harness runs across:
- Schema Validation: Verifies all schemas in
schemas/. - Rule Catalog Integrity: Validates 60 unique
TG-*rule IDs with 0 duplicates. - Differential Fixtures: Tests vulnerable vs hardened pairs in
examples/python/. - Stack Detection Fixtures: Tests 7 repository layouts in
tests/fixtures/python/stack-detection/. - Regression Suite: Executes 10 paired Python regression fixtures in
tests/fixtures/python/. - Lifecycle Assertions: Validates state machine transitions.
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/
βββ schemas/ # Formal JSON schemas (finding, evidence, remediation, rule, lifecycle)
βββ core/ # Core workflow models, lifecycle state machine, and formatter
βββ harness/ # Repeatable automated validation harness runner
βββ skills/TorusGuard/ # Portable skill instructions and reference modules
βββ rules/ # 60+ documented security rules across 9 lifecycle categories
βββ templates/ # Standardized templates (SECURITY, audit, pre-flight)
βββ guides/ # Stack-specific implementation guides (Node.js & Python)
βββ examples/ # Educational vulnerable & hardened reference applications
βββ docs/
β βββ architecture/ # Architecture specifications (v0.5.0 workflow architecture)
β βββ workflow/ # Finding lifecycle and verification guides
β βββ releases/ # Release notes (v0.2.0, v0.3.0, v0.4.0, v0.4.1, v0.5.0)
β βββ python-rule-mapping.md # Universal rule mapping across Python stacks
β βββ validation/ # Official validation reports & real-world records
β βββ roadmap.md # Project roadmap & milestones
βββ tests/ # Test fixtures and regression test suites
Contributions are welcome! Please review CONTRIBUTING.md and our Code of Conduct before submitting an issue or pull request.
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.
