Skip to content

Latest commit

Β 

History

25 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

TorusGuard Banner

TorusGuard

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.


Why This Exists

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.

Core Principle: The Browser-Code Truth

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.


Key Features

  • 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.

Current Release: v0.4.1 (Python Validation & Quality Patch)

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.


Supported Platforms & Frameworks

🐍 Python (v0.4.1)

🌐 JavaScript & TypeScript

  • 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.

Quick Start

1. Installation

Install TorusGuard into your AI coding tool using the open skills CLI:

npx skills add https://github.com/githubmofo/TorusGuard --skill "torusguard"

2. Workflow

Once installed, interact with your AI assistant in chat using the /torusguard command:

  1. Initialize Project Security Baseline:
    /torusguard init
    
  2. Audit Codebase (Read-Only Scan):
    /torusguard audit
    
  3. Harden & Apply Fixes:
    /torusguard harden
    
  4. Pre-Flight Deployment Verification:
    /torusguard verify
    

Core Commands

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.


Validation Summary

TorusGuard has been locally validated against educational fixtures and real-world architectures:

  1. OWASP NodeGoat: An intentionally vulnerable Node.js / Express / MongoDB training application.
  2. Django Reference: Validation of settings, IDOR, ModelForms, and caching.
  3. DRF API Reference: ViewSet scoping, serializer mass assignment, throttling, and pagination caps.
  4. FastAPI Reference: Pydantic schemas, outbound SSRF filtering, and HMAC webhook verification.
  5. Flask Reference: Secret keys, CSRF protection, and file upload boundaries.
  6. Cross-Platform Rule Parity: Architectural comparison across Node.js and Python ecosystems.
  7. Real-World Validation Records: Maintainer-authorized codebase evaluations across Django, FastAPI, Flask, and Monorepo architectures.

Evidence-Confidence Classification

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.


What TorusGuard Is Not

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.

Project Structure Overview

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

Roadmap

  • 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.


Contributing

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.


Security

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.


License

TorusGuard is licensed under the MIT License.
Copyright (c) 2026 Jenish Lad.

About

TorusGuard is a portable AI-agent skill that helps developers build secure-by-default web applications. It audits and hardens secrets, frontend database exposure, input validation, authentication, authorization, rate limits, CORS, source maps, and production security configuration.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors