torusguard 2.0.0-alpha → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.torusguard/.manifest.json +50 -28
- package/.torusguard/rules/container/TG-CONT-001-root-user-execution.md +50 -0
- package/.torusguard/rules/container/TG-CONT-002-docker-socket-mount.md +47 -0
- package/.torusguard/rules/container/TG-CONT-003-privileged-container-mode.md +53 -0
- package/.torusguard/rules/container/TG-CONT-004-build-arg-secret-exposure.md +43 -0
- package/.torusguard/rules/git/TG-GIT-001-historical-secret-in-git-commit.md +44 -0
- package/.torusguard/rules/git/TG-GIT-002-plaintext-credentials-in-git-config.md +41 -0
- package/.torusguard/rules/git/TG-GIT-003-sensitive-tracked-file-gitignore-breach.md +40 -0
- package/.torusguard/rules/rag/TG-RAG-001-untrusted-rag-context-injection.md +72 -0
- package/.torusguard/rules/rag/TG-RAG-002-autonomous-llm-tool-unsandboxed-call.md +51 -0
- package/.torusguard/rules/rag/TG-RAG-003-unpartitioned-vector-tenant-lookup.md +51 -0
- package/.torusguard/rules/redos/TG-REDOS-001-catastrophic-exponential-backtracking.md +46 -0
- package/.torusguard/rules/redos/TG-REDOS-002-unbounded-nested-quantifier.md +43 -0
- package/.torusguard/rules_catalog.json +96 -0
- package/.torusguard/scripts/__pycache__/manifest_builder.cpython-314.pyc +0 -0
- package/.torusguard/scripts/manifest_builder.py +1 -1
- package/.torusguard/skills/torusguard/SKILL.md +69 -24
- package/.torusguard/skills/torusguard/bootstrap.py +57 -24
- package/.torusguard/skills/torusguard-ai-guard/SKILL.md +95 -0
- package/.torusguard/skills/torusguard-apply/SKILL.md +60 -34
- package/.torusguard/skills/torusguard-audit/SKILL.md +73 -24
- package/.torusguard/skills/torusguard-authorize/SKILL.md +48 -6
- package/.torusguard/skills/torusguard-container/SKILL.md +94 -0
- package/.torusguard/skills/torusguard-exploit-check/SKILL.md +50 -6
- package/.torusguard/skills/torusguard-full/SKILL.md +62 -19
- package/.torusguard/skills/torusguard-git-mine/SKILL.md +92 -0
- package/.torusguard/skills/torusguard-harden/SKILL.md +81 -50
- package/.torusguard/skills/torusguard-init/SKILL.md +61 -14
- package/.torusguard/skills/torusguard-ocr-scan/SKILL.md +94 -0
- package/.torusguard/skills/torusguard-recheck/SKILL.md +71 -18
- package/.torusguard/skills/torusguard-redos/SKILL.md +91 -0
- package/.torusguard/skills/torusguard-report/SKILL.md +50 -9
- package/.torusguard/skills/torusguard-status/SKILL.md +63 -10
- package/.torusguard/skills/torusguard-verify/SKILL.md +52 -10
- package/.torusguard/skills/torusguard-web-validate/SKILL.md +53 -8
- package/.torusguard/workflows/ai-guard.md +31 -0
- package/.torusguard/workflows/apply.md +32 -55
- package/.torusguard/workflows/audit.md +28 -46
- package/.torusguard/workflows/authorize.md +27 -50
- package/.torusguard/workflows/container.md +29 -0
- package/.torusguard/workflows/exploit-check.md +28 -50
- package/.torusguard/workflows/git-mine.md +25 -0
- package/.torusguard/workflows/harden.md +29 -48
- package/.torusguard/workflows/init.md +27 -50
- package/.torusguard/workflows/memory.md +18 -23
- package/.torusguard/workflows/ocr-scan.md +25 -0
- package/.torusguard/workflows/recheck.md +28 -46
- package/.torusguard/workflows/redos.md +27 -0
- package/.torusguard/workflows/report.md +33 -52
- package/.torusguard/workflows/status.md +31 -52
- package/.torusguard/workflows/verify.md +29 -49
- package/.torusguard/workflows/web-validate.md +22 -45
- package/README.md +84 -56
- package/package.json +1 -1
- package/skills/torusguard/SKILL.md +71 -24
- package/skills/torusguard/__pycache__/bootstrap.cpython-314.pyc +0 -0
- package/skills/torusguard/bootstrap.py +60 -71
- package/skills/torusguard/payload/.manifest.json +50 -28
- package/skills/torusguard/payload/rules/container/TG-CONT-001-root-user-execution.md +50 -0
- package/skills/torusguard/payload/rules/container/TG-CONT-002-docker-socket-mount.md +47 -0
- package/skills/torusguard/payload/rules/container/TG-CONT-003-privileged-container-mode.md +53 -0
- package/skills/torusguard/payload/rules/container/TG-CONT-004-build-arg-secret-exposure.md +43 -0
- package/skills/torusguard/payload/rules/git/TG-GIT-001-historical-secret-in-git-commit.md +44 -0
- package/skills/torusguard/payload/rules/git/TG-GIT-002-plaintext-credentials-in-git-config.md +41 -0
- package/skills/torusguard/payload/rules/git/TG-GIT-003-sensitive-tracked-file-gitignore-breach.md +40 -0
- package/skills/torusguard/payload/rules/rag/TG-RAG-001-untrusted-rag-context-injection.md +72 -0
- package/skills/torusguard/payload/rules/rag/TG-RAG-002-autonomous-llm-tool-unsandboxed-call.md +51 -0
- package/skills/torusguard/payload/rules/rag/TG-RAG-003-unpartitioned-vector-tenant-lookup.md +51 -0
- package/skills/torusguard/payload/rules/redos/TG-REDOS-001-catastrophic-exponential-backtracking.md +46 -0
- package/skills/torusguard/payload/rules/redos/TG-REDOS-002-unbounded-nested-quantifier.md +43 -0
- package/skills/torusguard/payload/rules_catalog.json +338 -518
- package/skills/torusguard/payload/scripts/__pycache__/term_ui.cpython-314.pyc +0 -0
- package/skills/torusguard/payload/scripts/manifest_builder.py +1 -1
- package/skills/torusguard/payload/skills/torusguard/SKILL.md +69 -24
- package/skills/torusguard/payload/skills/torusguard/bootstrap.py +57 -24
- package/skills/torusguard/payload/skills/torusguard/references/csharp-security.md +41 -41
- package/skills/torusguard/payload/skills/torusguard/references/go-security.md +41 -41
- package/skills/torusguard/payload/skills/torusguard/references/java-security.md +40 -40
- package/skills/torusguard/payload/skills/torusguard/references/polyglot-security-matrix.md +25 -25
- package/skills/torusguard/payload/skills/torusguard/references/rust-security.md +40 -40
- package/skills/torusguard/payload/skills/torusguard-ai-guard/SKILL.md +95 -0
- package/skills/torusguard/payload/skills/torusguard-apply/SKILL.md +60 -34
- package/skills/torusguard/payload/skills/torusguard-audit/SKILL.md +73 -24
- package/skills/torusguard/payload/skills/torusguard-authorize/SKILL.md +48 -6
- package/skills/torusguard/payload/skills/torusguard-container/SKILL.md +94 -0
- package/skills/torusguard/payload/skills/torusguard-exploit-check/SKILL.md +50 -6
- package/skills/torusguard/payload/skills/torusguard-full/SKILL.md +62 -19
- package/skills/torusguard/payload/skills/torusguard-git-mine/SKILL.md +92 -0
- package/skills/torusguard/payload/skills/torusguard-harden/SKILL.md +81 -50
- package/skills/torusguard/payload/skills/torusguard-init/SKILL.md +61 -14
- package/skills/torusguard/payload/skills/torusguard-ocr-scan/SKILL.md +94 -0
- package/skills/torusguard/payload/skills/torusguard-recheck/SKILL.md +71 -18
- package/skills/torusguard/payload/skills/torusguard-redos/SKILL.md +91 -0
- package/skills/torusguard/payload/skills/torusguard-report/SKILL.md +50 -9
- package/skills/torusguard/payload/skills/torusguard-status/SKILL.md +63 -10
- package/skills/torusguard/payload/skills/torusguard-verify/SKILL.md +52 -10
- package/skills/torusguard/payload/skills/torusguard-web-validate/SKILL.md +53 -8
- package/skills/torusguard/payload/workflows/ai-guard.md +31 -0
- package/skills/torusguard/payload/workflows/apply.md +31 -62
- package/skills/torusguard/payload/workflows/audit.md +27 -51
- package/skills/torusguard/payload/workflows/authorize.md +27 -50
- package/skills/torusguard/payload/workflows/container.md +29 -0
- package/skills/torusguard/payload/workflows/exploit-check.md +28 -50
- package/skills/torusguard/payload/workflows/git-mine.md +25 -0
- package/skills/torusguard/payload/workflows/harden.md +28 -52
- package/skills/torusguard/payload/workflows/init.md +27 -56
- package/skills/torusguard/payload/workflows/memory.md +18 -23
- package/skills/torusguard/payload/workflows/ocr-scan.md +25 -0
- package/skills/torusguard/payload/workflows/recheck.md +28 -46
- package/skills/torusguard/payload/workflows/redos.md +27 -0
- package/skills/torusguard/payload/workflows/report.md +39 -62
- package/skills/torusguard/payload/workflows/status.md +31 -55
- package/skills/torusguard/payload/workflows/verify.md +29 -49
- package/skills/torusguard/payload/workflows/web-validate.md +22 -45
- package/skills/torusguard/references/csharp-security.md +41 -0
- package/skills/torusguard/references/go-security.md +41 -0
- package/skills/torusguard/references/java-security.md +40 -0
- package/skills/torusguard/references/polyglot-security-matrix.md +25 -0
- package/skills/torusguard/references/rust-security.md +40 -0
- package/skills/torusguard-ai-guard/SKILL.md +95 -0
- package/skills/torusguard-apply/SKILL.md +60 -34
- package/skills/torusguard-audit/SKILL.md +73 -24
- package/skills/torusguard-authorize/SKILL.md +48 -6
- package/skills/torusguard-container/SKILL.md +94 -0
- package/skills/torusguard-exploit-check/SKILL.md +50 -6
- package/skills/torusguard-full/SKILL.md +62 -19
- package/skills/torusguard-git-mine/SKILL.md +92 -0
- package/skills/torusguard-harden/SKILL.md +81 -50
- package/skills/torusguard-init/SKILL.md +61 -14
- package/skills/torusguard-ocr-scan/SKILL.md +94 -0
- package/skills/torusguard-recheck/SKILL.md +71 -18
- package/skills/torusguard-redos/SKILL.md +91 -0
- package/skills/torusguard-report/SKILL.md +50 -9
- package/skills/torusguard-status/SKILL.md +63 -10
- package/skills/torusguard-verify/SKILL.md +52 -10
- package/skills/torusguard-web-validate/SKILL.md +53 -8
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: Read-only diagnostic overview of workspace security posture, active configuration, rules catalog, and run history.
|
|
3
|
-
tools: Read, Grep, Glob, Bash
|
|
4
|
-
version:
|
|
3
|
+
tools: Read, Grep, Glob, Bash, Write, run_command
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
agent: reviewer
|
|
6
6
|
lifecycle-phase: System / Diagnostics
|
|
7
7
|
required-skills:
|
|
8
8
|
- torusguard-status
|
|
9
9
|
scripts-binding:
|
|
10
|
-
-
|
|
11
|
-
-
|
|
10
|
+
- cmd/torusguard/main.go
|
|
11
|
+
- cmd/torusguard/mcp.go
|
|
12
|
+
- internal/workspace/workspace.go
|
|
12
13
|
---
|
|
13
14
|
|
|
14
15
|
# /torusguard status — Workspace Security Posture & Diagnostic Overview
|
|
@@ -18,30 +19,27 @@ $ARGUMENTS
|
|
|
18
19
|
---
|
|
19
20
|
|
|
20
21
|
## Objective
|
|
21
|
-
Read-only diagnostic overview of workspace security posture, active configuration, and run history.
|
|
22
|
+
Read-only diagnostic overview of workspace security posture, active configuration, and run history across 74 canonical security rules and 18 families.
|
|
22
23
|
|
|
23
24
|
---
|
|
24
25
|
|
|
25
|
-
##
|
|
26
|
+
## Tri-Mode Execution
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
5. **Read-Only Invariant:** Ensure command performs zero file modifications or disk mutations.
|
|
28
|
+
| Mode | Command / Tool | Execution Method |
|
|
29
|
+
| :--- | :--- | :--- |
|
|
30
|
+
| **Mode A: Terminal CLI** | `torusguard status [--json]` | Terminal execution of 75-column diagnostic cards. |
|
|
31
|
+
| **Mode B: AI Chat Slash** | `/torusguard status` | Conversational diagnostic inspection of active config and ledger. |
|
|
32
|
+
| **Mode C: Native MCP Tool** | `torusguard_status` | Agent tool call with `{"target": "."}` returning posture JSON/string. |
|
|
33
33
|
|
|
34
34
|
---
|
|
35
35
|
|
|
36
|
-
##
|
|
36
|
+
## Mandatory Pre-Flight Context Inspection
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
| Initializing workspace for the first time | Run `/torusguard init` |
|
|
44
|
-
| Executing full security scan | Run `/torusguard audit` |
|
|
38
|
+
Inspect workspace state and configuration records prior to status display:
|
|
39
|
+
1. **Config State (`.torusguard/config/torusguard.json`):** Confirm workspace initialization and read detected stack.
|
|
40
|
+
2. **Active Rules Directory (`.torusguard/rules/active/`):** Count active rule files (74 canonical rules).
|
|
41
|
+
3. **Living Report (`security_report.md`):** Read current open vs resolved findings.
|
|
42
|
+
4. **Read-Only Invariant:** Ensure command performs zero file modifications or disk mutations.
|
|
45
43
|
|
|
46
44
|
---
|
|
47
45
|
|
|
@@ -49,33 +47,16 @@ Inspect workspace state and configuration records prior to status display:
|
|
|
49
47
|
- Reads current health score and status breakdown directly from `security_report.md`.
|
|
50
48
|
- Displays 18 rule families and 74 rules in standardized 75-column terminal cards.
|
|
51
49
|
|
|
52
|
-
## Execution Steps
|
|
53
|
-
|
|
54
|
-
1. **Read Configuration:** Load `.torusguard/config/torusguard.json`; extract stack, version, and enabled rule count.
|
|
55
|
-
2. **Enumerate Active Rules:** Count rule files physically present in `.torusguard/rules/active/`.
|
|
56
|
-
3. **Inspect Run History:**
|
|
57
|
-
```bash
|
|
58
|
-
python .torusguard/scripts/run_manager.py list
|
|
59
|
-
```
|
|
60
|
-
4. **Evaluate Scope Expiry:** Parse `.torusguard/config/scope.json`; report if TTL is valid or expired.
|
|
61
|
-
5. **Print Status Overview:** Render complete workspace diagnostic overview card.
|
|
62
|
-
|
|
63
50
|
---
|
|
64
51
|
|
|
65
|
-
##
|
|
66
|
-
|
|
67
|
-
- **Uninitialized Workspace:** If config is missing, prompt user to execute `/torusguard init`.
|
|
68
|
-
- **Zero Runs Found:** Display clean status card noting no historical audit runs exist yet.
|
|
69
|
-
- **Corrupt Config File:** Report parsing error and recommend re-running `/torusguard init`.
|
|
70
|
-
- **Halt Trigger:** Abort command if read access to `.torusguard/` is denied.
|
|
71
|
-
|
|
72
|
-
---
|
|
73
|
-
|
|
74
|
-
## Hallucination Guard
|
|
52
|
+
## Execution Steps
|
|
75
53
|
|
|
76
|
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
54
|
+
1. **Trigger Status Check:**
|
|
55
|
+
- **Mode A (CLI):** Run `torusguard status`.
|
|
56
|
+
- **Mode B (Chat):** Read `torusguard.json` and `security_report.md`.
|
|
57
|
+
- **Mode C (MCP):** Call `torusguard_status`.
|
|
58
|
+
2. **Evaluate Posture:** Report detected stack, active invariants, and living findings ledger.
|
|
59
|
+
3. **Recommend Next Actions:** Direct user to audit or remediation as needed.
|
|
79
60
|
|
|
80
61
|
---
|
|
81
62
|
|
|
@@ -83,13 +64,11 @@ Inspect workspace state and configuration records prior to status display:
|
|
|
83
64
|
|
|
84
65
|
```markdown
|
|
85
66
|
### 🛡️ TorusGuard Workspace Status
|
|
86
|
-
- **Version:**
|
|
87
|
-
- **Framework Detected:** [Stack
|
|
88
|
-
- **Active Rules:**
|
|
89
|
-
- **
|
|
90
|
-
- **
|
|
91
|
-
- **Scope Status:** [Authorized (TTL Active) / Expired / Unconfigured]
|
|
92
|
-
- **Health Posture:** [GOOD / ACTION NEEDED]
|
|
67
|
+
- **Version:** v2.0.0
|
|
68
|
+
- **Framework Detected:** [Stack]
|
|
69
|
+
- **Active Rules:** 74 canonical rules active across 18 families
|
|
70
|
+
- **Living Report:** `security_report.md`
|
|
71
|
+
- **Health Posture:** [OPTIMAL DEFENSE / ACTION NEEDED]
|
|
93
72
|
```
|
|
94
73
|
|
|
95
74
|
---
|
|
@@ -97,4 +76,4 @@ Inspect workspace state and configuration records prior to status display:
|
|
|
97
76
|
## Next Steps
|
|
98
77
|
|
|
99
78
|
1. Run `/torusguard audit` to scan codebase for security vulnerabilities.
|
|
100
|
-
2. Run `/torusguard
|
|
79
|
+
2. Run `/torusguard report --html` to view interactive dashboard.
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: Evidence sufficiency verification, live disk line match audit, and finding score refinement.
|
|
3
|
-
tools: Read, Grep, Glob, Bash, Write
|
|
4
|
-
version:
|
|
3
|
+
tools: Read, Grep, Glob, Bash, Write, run_command
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
agent: validator
|
|
6
6
|
lifecycle-phase: Phase 3a (Evidence Verification)
|
|
7
7
|
required-skills:
|
|
8
8
|
- torusguard-verify
|
|
9
9
|
scripts-binding:
|
|
10
|
-
-
|
|
11
|
-
-
|
|
10
|
+
- internal/validate/validate.go
|
|
11
|
+
- cmd/torusguard/main.go
|
|
12
|
+
- cmd/torusguard/mcp.go
|
|
12
13
|
---
|
|
13
14
|
|
|
14
15
|
# /torusguard verify — Evidence Verification & Score Refinement
|
|
@@ -22,26 +23,22 @@ Evidence sufficiency verification, live disk line match audit, and finding score
|
|
|
22
23
|
|
|
23
24
|
---
|
|
24
25
|
|
|
25
|
-
##
|
|
26
|
+
## Tri-Mode Execution
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
5. **Role Boundary:** Enforce validator role; do not apply code modifications during verification.
|
|
28
|
+
| Mode | Command / Tool | Execution Method |
|
|
29
|
+
| :--- | :--- | :--- |
|
|
30
|
+
| **Mode A: Terminal CLI** | `torusguard verify` | Terminal audit of living security report and evidence presence. |
|
|
31
|
+
| **Mode B: AI Chat Slash** | `/torusguard verify` | Live code line inspection, taint flow audit, and false-positive filtering. |
|
|
32
|
+
| **Mode C: Native MCP Tool** | `torusguard_verify` | Agent tool call with `{"target": "."}` returning line audit proofs. |
|
|
33
33
|
|
|
34
34
|
---
|
|
35
35
|
|
|
36
|
-
##
|
|
36
|
+
## Mandatory Pre-Flight Context Inspection
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
| No audit run executed yet | Run `/torusguard audit` first |
|
|
43
|
-
| Running live network requests against endpoints | Run `/torusguard web-validate` |
|
|
44
|
-
| Generating patch after verification | Run `/torusguard harden` |
|
|
38
|
+
Inspect finding records and evidence integrity before verification:
|
|
39
|
+
1. **Living Report (`security_report.md`):** Confirm report exists at workspace root.
|
|
40
|
+
2. **Live File Drift:** Assert cited source files have not been edited or relocated on disk.
|
|
41
|
+
3. **Role Boundary:** Enforce validator role; do not apply code modifications during verification.
|
|
45
42
|
|
|
46
43
|
---
|
|
47
44
|
|
|
@@ -49,34 +46,18 @@ Inspect finding records and evidence integrity before verification:
|
|
|
49
46
|
- Confirmed evidence sufficiency transitions findings in `security_report.md` to `VERIFIED 🟠`.
|
|
50
47
|
- False positives transition to `FALSE POSITIVE ⚪`.
|
|
51
48
|
|
|
49
|
+
---
|
|
50
|
+
|
|
52
51
|
## Execution Steps
|
|
53
52
|
|
|
54
|
-
1. **
|
|
53
|
+
1. **Trigger Verification:**
|
|
54
|
+
- **Mode A (CLI):** Run `torusguard verify`.
|
|
55
|
+
- **Mode B (Chat):** Read cited lines via `view_file` and verify source-to-sink flow.
|
|
56
|
+
- **Mode C (MCP):** Call `torusguard_verify`.
|
|
55
57
|
2. **Live Disk Line Match:** Read current code at cited line ranges; verify AST snippet matches.
|
|
56
58
|
3. **Audit Evidence Sufficiency:** Assess whether taint path is unbroken and caller context is exposed.
|
|
57
|
-
4. **
|
|
58
|
-
|
|
59
|
-
python .torusguard/scripts/finding_scorer.py --run <run_dir> --verify
|
|
60
|
-
```
|
|
61
|
-
5. **Classify Status:** Assign verified state (`Confirmed`, `Plausible`, or `False Positive / Disputed`).
|
|
62
|
-
6. **Emit Verification Ledger:** Write `verified-evidence.md` into the active run folder.
|
|
63
|
-
|
|
64
|
-
---
|
|
65
|
-
|
|
66
|
-
## Failure Recovery
|
|
67
|
-
|
|
68
|
-
- **Missing Run Folder:** Run `/torusguard audit` first to produce a valid run baseline.
|
|
69
|
-
- **Line Drift Detected:** Flag line mismatch; scan nearby lines (±25) for relocated AST sink.
|
|
70
|
-
- **Malformed Finding JSON:** Repair JSON structure using finding schema before scoring.
|
|
71
|
-
- **Halt Trigger:** Abort if cited files are completely deleted from disk.
|
|
72
|
-
|
|
73
|
-
---
|
|
74
|
-
|
|
75
|
-
## Hallucination Guard
|
|
76
|
-
|
|
77
|
-
- ❌ Never confirm a finding if the cited sink has already been sanitized by middleware.
|
|
78
|
-
- ❌ Never bump confidence score without documenting unbroken taint source-to-sink flow.
|
|
79
|
-
- ✅ Always anchor line matches to live disk reads using `view_file`.
|
|
59
|
+
4. **Classify Status:** Assign verified state (`Confirmed`, `Plausible`, or `False Positive`).
|
|
60
|
+
5. **Update Living Ledger:** Update statuses in `security_report.md`.
|
|
80
61
|
|
|
81
62
|
---
|
|
82
63
|
|
|
@@ -84,17 +65,16 @@ Inspect finding records and evidence integrity before verification:
|
|
|
84
65
|
|
|
85
66
|
```markdown
|
|
86
67
|
### 🧪 TorusGuard Evidence Verification
|
|
87
|
-
- **
|
|
68
|
+
- **Report File:** `security_report.md`
|
|
88
69
|
- **Findings Evaluated:** [Count] findings
|
|
89
70
|
- **Confirmed Real:** [Count] verified flaws
|
|
90
|
-
- **
|
|
91
|
-
- **
|
|
92
|
-
- **Ledger:** `.torusguard/runs/<run_id>/verified-evidence.md`
|
|
71
|
+
- **False Positives Filtered:** [Count]
|
|
72
|
+
- **Status:** Evidence verified on disk
|
|
93
73
|
```
|
|
94
74
|
|
|
95
75
|
---
|
|
96
76
|
|
|
97
77
|
## Next Steps
|
|
98
78
|
|
|
99
|
-
1. Run `/torusguard
|
|
100
|
-
2. Run `/torusguard
|
|
79
|
+
1. Run `/torusguard harden` to build surgical patch bundles for verified flaws.
|
|
80
|
+
2. Run `/torusguard web-validate` if live endpoint probing is required.
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: Authorized HTTP probing, token redaction, transparent audit header injection, and replay trace capture.
|
|
3
|
-
tools: Read, Grep, Glob, Bash, Write
|
|
4
|
-
version:
|
|
3
|
+
tools: Read, Grep, Glob, Bash, Write, run_command
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
agent: validator
|
|
6
6
|
lifecycle-phase: Phase 3b (Runtime Web Validation)
|
|
7
7
|
required-skills:
|
|
8
8
|
- torusguard-web-validate
|
|
9
9
|
scripts-binding:
|
|
10
|
-
-
|
|
11
|
-
-
|
|
10
|
+
- internal/validate/validate.go
|
|
11
|
+
- cmd/torusguard/main.go
|
|
12
12
|
---
|
|
13
13
|
|
|
14
14
|
# /torusguard web-validate — Bounded HTTP Probing & Session Capture
|
|
@@ -18,7 +18,17 @@ $ARGUMENTS
|
|
|
18
18
|
---
|
|
19
19
|
|
|
20
20
|
## Objective
|
|
21
|
-
Authorized HTTP probing, token redaction, transparent audit header injection, and replay capture.
|
|
21
|
+
Authorized HTTP probing, token redaction, transparent audit header injection, and replay capture against local/staging web applications.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Tri-Mode Execution
|
|
26
|
+
|
|
27
|
+
| Mode | Command / Tool | Execution Method |
|
|
28
|
+
| :--- | :--- | :--- |
|
|
29
|
+
| **Mode A: Terminal CLI** | `torusguard web-validate [--url <url>]` | Terminal execution of bounded HTTP validator. |
|
|
30
|
+
| **Mode B: AI Chat Slash** | `/torusguard web-validate` | Interactive verification of endpoints and security headers. |
|
|
31
|
+
| **Mode C: Native MCP Tool** | Scope Guarded Probing | Safe runtime probing guarded by `scope.json` and SSRF boundaries. |
|
|
22
32
|
|
|
23
33
|
---
|
|
24
34
|
|
|
@@ -26,53 +36,21 @@ Authorized HTTP probing, token redaction, transparent audit header injection, an
|
|
|
26
36
|
|
|
27
37
|
Inspect authorization parameters and safety limits before sending HTTP requests:
|
|
28
38
|
1. **Active Scope (`.torusguard/config/scope.json`):** Assert target host and path are authorized with valid TTL.
|
|
29
|
-
2. **
|
|
39
|
+
2. **SSRF Boundary Enforcement:** Assert target does not resolve to private cloud metadata (`169.254.169.254`).
|
|
30
40
|
3. **Sensitive Route Guard:** Ensure destructive endpoints (`DELETE`, account drops) are never called automatically.
|
|
31
41
|
4. **Token Redaction Pipeline:** Ensure bearer tokens and session cookies are masked (`Bearer [REDACTED]`).
|
|
32
42
|
5. **Request Budget:** Enforce maximum cap of 50 requests per validation session.
|
|
33
43
|
|
|
34
44
|
---
|
|
35
45
|
|
|
36
|
-
## When to Use /torusguard web-validate
|
|
37
|
-
|
|
38
|
-
| Trigger Scenario | Recommended Action |
|
|
39
|
-
| :--- | :--- |
|
|
40
|
-
| Testing live route accessibility and security headers | Run `/torusguard web-validate` |
|
|
41
|
-
| Verifying cookie security flags (`HttpOnly`, `Secure`, `SameSite`) | Run `/torusguard web-validate` |
|
|
42
|
-
| Checking CORS headers and authentication barriers | Run `/torusguard web-validate` |
|
|
43
|
-
| Pure static source code analysis | Run `/torusguard audit` |
|
|
44
|
-
| Confirming exploitable attack vectors | Run `/torusguard exploit-check` |
|
|
45
|
-
|
|
46
|
-
---
|
|
47
|
-
|
|
48
46
|
## Execution Steps
|
|
49
47
|
|
|
50
|
-
1. **
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
4. **Redact Sensitive Headers:** Sanitize auth tokens and credentials in request and response objects.
|
|
57
|
-
5. **Write Replay Artifacts:**
|
|
58
|
-
Record sanitized trace in `.torusguard/runs/<run_id>/requests.json` and emit `web-validation.md`.
|
|
59
|
-
|
|
60
|
-
---
|
|
61
|
-
|
|
62
|
-
## Failure Recovery
|
|
63
|
-
|
|
64
|
-
- **Target Offline:** Verify local dev server is active and accessible on designated host port.
|
|
65
|
-
- **Safety Gate Rejection (Manual Only):** Halt probe immediately; report endpoint requires human manual test.
|
|
66
|
-
- **Rate Limit / 429:** Back off exponentially (1s, 2s, 4s); stop session if 429 persists.
|
|
67
|
-
- **Halt Trigger:** Abort if target domain deviates from authorized allowlist in `scope.json`.
|
|
68
|
-
|
|
69
|
-
---
|
|
70
|
-
|
|
71
|
-
## Hallucination Guard
|
|
72
|
-
|
|
73
|
-
- ❌ Never dispatch HTTP requests outside domains explicitly listed in `.torusguard/config/scope.json`.
|
|
74
|
-
- ❌ Never write raw Authorization headers or plaintext secrets to disk.
|
|
75
|
-
- ✅ Always include transparent audit headers (`X-TorusGuard-AuthID`).
|
|
48
|
+
1. **Trigger Web Validation:**
|
|
49
|
+
- **Mode A (CLI):** Run `torusguard web-validate --url http://localhost:3000`.
|
|
50
|
+
- **Mode B (Chat):** Send non-destructive probe and inspect response headers.
|
|
51
|
+
2. **Audit Security Headers:** Check CSP, HSTS, X-Content-Type-Options, and CORS headers.
|
|
52
|
+
3. **Audit Cookie Flags:** Verify `HttpOnly`, `Secure`, and `SameSite` on session cookies.
|
|
53
|
+
4. **Sanitize Traces:** Redact all secrets and save sanitized replay trace.
|
|
76
54
|
|
|
77
55
|
---
|
|
78
56
|
|
|
@@ -84,7 +62,6 @@ Inspect authorization parameters and safety limits before sending HTTP requests:
|
|
|
84
62
|
- **Endpoints Probed:** [Count] routes tested
|
|
85
63
|
- **Security Headers:** [CSP / HSTS / CORS status]
|
|
86
64
|
- **Cookie Security:** [HttpOnly / Secure / SameSite status]
|
|
87
|
-
- **Replay Trace:** `.torusguard/runs/<run_id>/replay.json`
|
|
88
65
|
- **Status:** COMPLETED — non-destructive probe finished
|
|
89
66
|
```
|
|
90
67
|
|
package/README.md
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
<p align="center">
|
|
13
13
|
<a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License: MIT"></a>
|
|
14
|
-
<a href="https://github.com/githubmofo/TorusGuard/releases"><img src="https://img.shields.io/badge/version-
|
|
15
|
-
<a href="https://www.npmjs.com/package/torusguard"><img src="https://img.shields.io/badge/npm-v2.
|
|
14
|
+
<a href="https://github.com/githubmofo/TorusGuard/releases"><img src="https://img.shields.io/badge/version-v2.1.0-orange.svg" alt="Version"></a>
|
|
15
|
+
<a href="https://www.npmjs.com/package/torusguard"><img src="https://img.shields.io/badge/npm-v2.1.0-CB3837?logo=npm&logoColor=white" alt="npm: v2.1.0"></a>
|
|
16
16
|
<img src="https://img.shields.io/badge/Privacy-Local_First-success" alt="Privacy: Local First">
|
|
17
17
|
<img src="https://img.shields.io/badge/Dependencies-Zero-brightgreen" alt="Dependencies: Zero">
|
|
18
18
|
<img src="https://img.shields.io/badge/SARIF-v2.1.0-6C3483" alt="SARIF">
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
<img src="https://img.shields.io/badge/Polyglot%20Tests-36%2F36%20Repos%20Passed-brightgreen?logo=checkmarx&logoColor=white" alt="Polyglot Tests: 36/36 Repos Passed">
|
|
25
25
|
<img src="https://img.shields.io/badge/Tri--Mode%20E2E-16%2F16%20Verified-blue?logo=checkmarx&logoColor=white" alt="Tri-Mode E2E: 16/16 Verified">
|
|
26
26
|
<img src="https://img.shields.io/badge/Vision%20OCR-Tested%20%26%20Verified-blueviolet?logo=tesseract&logoColor=white" alt="Vision OCR: Tested & Verified">
|
|
27
|
-
<img src="https://img.shields.io/badge/Rules%20Verified-
|
|
27
|
+
<img src="https://img.shields.io/badge/Rules%20Verified-86%2F86%20Rules-success" alt="Rules: 86/86 Verified">
|
|
28
28
|
</p>
|
|
29
29
|
|
|
30
30
|
<p align="center">
|
|
@@ -42,13 +42,13 @@
|
|
|
42
42
|
|
|
43
43
|
- [What Is TorusGuard?](#what-is-torusguard)
|
|
44
44
|
- [Features](#-features)
|
|
45
|
-
- [Autonomous Architecture](#-autonomous-architecture)
|
|
45
|
+
- [Autonomous Architecture & Workflow](#-autonomous-architecture--workflow)
|
|
46
46
|
- [Prerequisites](#-prerequisites)
|
|
47
47
|
- [Installation](#-installation)
|
|
48
48
|
- [Usage](#-usage)
|
|
49
49
|
- [Commands](#-commands)
|
|
50
50
|
- [Project Structure](#-project-structure)
|
|
51
|
-
- [Security
|
|
51
|
+
- [Security Invariants & Rule Governance](#-security-invariants--rule-governance)
|
|
52
52
|
- [AI Agent Integration](#-ai-agent-integration)
|
|
53
53
|
- [Verified Test Suite & Benchmarks](#-verified-test-suite--mass-benchmarks)
|
|
54
54
|
- [Non-Negotiable Invariants](#-non-negotiable-invariants)
|
|
@@ -60,10 +60,11 @@
|
|
|
60
60
|
|
|
61
61
|
## What Is TorusGuard?
|
|
62
62
|
|
|
63
|
-
TorusGuard is a **zero-dependency, single-binary security engine** that scans, hardens, and validates AI-generated codebases. It enforces
|
|
63
|
+
TorusGuard is a **zero-dependency, single-binary security engine** that scans, hardens, and validates AI-generated codebases. It enforces 86 security rules across 22 architectural families and works across three unified operational modes (**Tri-Mode Parity**):
|
|
64
64
|
|
|
65
|
-
- **CLI
|
|
66
|
-
- **AI
|
|
65
|
+
- **Mode A: Terminal CLI (Go Binary)** — A deterministic scanner and enforcer that runs in your terminal or CI/CD pipeline (`torusguard <command>`).
|
|
66
|
+
- **Mode B: AI Chat Slash Commands** — Integrates natively with Antigravity, Cursor, Claude Code, Windsurf, VS Code, and other AI coding assistants via slash commands (`/torusguard <command>`).
|
|
67
|
+
- **Mode C: Native MCP Tools** — Stdio Model Context Protocol (JSON-RPC 2.0) interface exposing autonomous security tools and living resources directly to AI agents.
|
|
67
68
|
|
|
68
69
|
TorusGuard ensures that the code your AI assistant writes is secure *before* it reaches production.
|
|
69
70
|
|
|
@@ -71,8 +72,11 @@ TorusGuard ensures that the code your AI assistant writes is secure *before* it
|
|
|
71
72
|
|
|
72
73
|
## ✨ Features
|
|
73
74
|
|
|
74
|
-
- **
|
|
75
|
+
- **86 Security Rules** across 22 families (Secrets, Auth, SQL Injection, SSRF, CSRF, GraphQL, Supply Chain, Containers, Git History, ReDoS, AI & RAG, and more)
|
|
76
|
+
- **First-Principles Security Suite** — Built-in native scanners for Dockerfile/Compose privilege bounds, Git commit log secret mining, exponential regex backtracking, and cross-tenant vector isolation
|
|
75
77
|
- **Heuristic AST Scanner** — Polyglot static analysis for Go, JavaScript, TypeScript, and Python
|
|
78
|
+
- **Line-Level Reflection Module** — Semantic patch synthesis (`find_snippet` / `replace_snippet`) that accurately replaces exact code blocks without brittle line-number offsets
|
|
79
|
+
- **1/9th Token Bounded Context Extraction** — AST context extraction (±3 lines) via `scanner.ExtractContext` to keep review prompts hyper-efficient and prevent context saturation
|
|
76
80
|
- **Ponytail Protocol** — Surgical patch bounds (≤35 additions, ≤25 deletions) to prevent full-file rewrites
|
|
77
81
|
- **Pre-Apply Snapshots** — Automatic `.bak` rollback snapshots before every code modification
|
|
78
82
|
- **SARIF v2.1.0 Export** — Standards-compliant output for GitHub Advanced Security, VS Code, and other SARIF consumers
|
|
@@ -104,37 +108,64 @@ TorusGuard’s static scanner and enforcement binary have been rigorously tested
|
|
|
104
108
|
|
|
105
109
|
---
|
|
106
110
|
|
|
107
|
-
## 🏗️ Autonomous Architecture
|
|
111
|
+
## 🏗️ Autonomous Architecture & Workflow
|
|
108
112
|
|
|
109
113
|
TorusGuard uses a **tri-track architecture** where intelligence, deterministic enforcement, and agent tool execution are cleanly separated across three unified operational modes:
|
|
110
114
|
|
|
111
115
|
```mermaid
|
|
112
116
|
flowchart TD
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
User --> ModeC[Mode C: Native MCP Protocol<br/><code>torusguard_audit / ocr_scan</code><br/>Stdio JSON-RPC 2.0 Agent Tools]
|
|
118
|
-
|
|
119
|
-
ModeA --> Router[Command Router & Dispatcher<br/>cmd/torusguard]
|
|
120
|
-
ModeB --> Router
|
|
121
|
-
ModeC --> Router
|
|
122
|
-
|
|
123
|
-
Router --> Engine
|
|
124
|
-
|
|
125
|
-
subgraph Engine[TorusGuard Core Engine]
|
|
126
|
-
Scanner[Polyglot AST & Heuristic Scanner<br/>74 Rules across 18 Families]
|
|
127
|
-
OCR[Multi-Modal Vision OCR Engine<br/>Tesseract Optical Analysis ≤10MB]
|
|
128
|
-
Harden[Harden Engine<br/>Ponytail Protocol ≤35 add, ≤25 del]
|
|
129
|
-
Apply[Snapshot & Apply Engine<br/>Byte-for-byte Rollback Backups]
|
|
130
|
-
Validate[Runtime Web Validator<br/>SSRF Defense & Audit Probing]
|
|
131
|
-
Recheck[Differential Recheck Engine<br/>Fix Closure Verification]
|
|
117
|
+
subgraph Ingress["Unified Tri-Mode Ingress"]
|
|
118
|
+
ModeA["<b>Mode A: Terminal CLI</b><br/><code>torusguard <cmd></code><br/>Deterministic Single Binary"]
|
|
119
|
+
ModeB["<b>Mode B: AI Chat Slash Commands</b><br/><code>/torusguard <cmd></code><br/>Cursor • Claude • Windsurf • Antigravity"]
|
|
120
|
+
ModeC["<b>Mode C: Native MCP Tools</b><br/><code>torusguard_*</code> (10 Tools • 2 Resources)<br/>Stdio JSON-RPC 2.0 Agent Server"]
|
|
132
121
|
end
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
122
|
+
|
|
123
|
+
Ingress --> Router["<b>Command Router & Dispatcher</b><br/>cmd/torusguard (21 Commands)"]
|
|
124
|
+
|
|
125
|
+
subgraph Core["TorusGuard Core Security Engine (Go Single Binary)"]
|
|
126
|
+
direction TB
|
|
127
|
+
subgraph Scanners["First-Principles & Multi-Modal Scanner Suite"]
|
|
128
|
+
AST["<b>Polyglot AST & Heuristic Scanner</b><br/>Go • TS/JS • Python • SQL • Auth • SSRF • CSRF"]
|
|
129
|
+
OCR["<b>Multi-Modal Vision OCR Engine</b><br/>Tesseract v5.4.0 • Leaked Keys in PNG/JPG ≤10MB"]
|
|
130
|
+
Container["<b>Container & Dockerfile Auditor</b><br/>Root Execution • Docker Sockets • Build Secrets"]
|
|
131
|
+
GitMine["<b>Git History Secret Miner</b><br/>Past Commits • Diff Logs • Remote Credentials"]
|
|
132
|
+
ReDoS["<b>ReDoS Complexity Analyzer</b><br/>Polynomial & Exponential Backtracking Loops"]
|
|
133
|
+
AIGuard["<b>AI Agent & RAG Vector Guard</b><br/>Prompt Injection • Tenant Vector Contamination"]
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
subgraph Governance["Governance & Remediation Pipeline"]
|
|
137
|
+
Harden["<b>Harden & Line Reflection</b><br/>Ponytail Bounds: ≤35 Add • ≤25 Del"]
|
|
138
|
+
Snapshot["<b>Pre-Apply Snapshot Engine</b><br/>Byte-for-Byte Rollback Backups in .torusguard/snapshots/"]
|
|
139
|
+
HumanGate{"<b>Human Gate Authorization</b><br/>Explicit --yes Confirmation Required"}
|
|
140
|
+
Recheck["<b>Differential Recheck Engine</b><br/>Zero-Regression Fix Closure"]
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
Router --> Scanners
|
|
145
|
+
Scanners --> Ledger[("<b>Living Security Ledger</b><br/><code>security_report.md</code><br/>Single Source of Truth")]
|
|
146
|
+
Ledger --> Harden
|
|
147
|
+
Harden --> Snapshot
|
|
148
|
+
Snapshot --> HumanGate
|
|
149
|
+
HumanGate -- Approved --> Recheck
|
|
150
|
+
Recheck --> Outputs["<b>Enterprise Outputs</b><br/>OASIS SARIF v2.1.0 • Dark-Mode HTML Report • Golden Fix Distillation"]
|
|
151
|
+
|
|
152
|
+
classDef ingressStyle fill:#1e293b,stroke:#38bdf8,stroke-width:2px,color:#f8fafc;
|
|
153
|
+
classDef scannerStyle fill:#0f172a,stroke:#818cf8,stroke-width:2px,color:#f8fafc;
|
|
154
|
+
classDef govStyle fill:#0f172a,stroke:#34d399,stroke-width:2px,color:#f8fafc;
|
|
155
|
+
classDef ledgerStyle fill:#312e81,stroke:#a78bfa,stroke-width:2px,color:#f8fafc;
|
|
156
|
+
classDef outStyle fill:#064e3b,stroke:#10b981,stroke-width:2px,color:#f8fafc;
|
|
157
|
+
|
|
158
|
+
class ModeA,ModeB,ModeC ingressStyle;
|
|
159
|
+
class AST,OCR,Container,GitMine,ReDoS,AIGuard scannerStyle;
|
|
160
|
+
class Harden,Snapshot,HumanGate,Recheck govStyle;
|
|
161
|
+
class Ledger ledgerStyle;
|
|
162
|
+
class Outputs outStyle;
|
|
136
163
|
```
|
|
137
164
|
|
|
165
|
+
> 🌐 **Interactive Architecture Visualizations:**
|
|
166
|
+
> - [**System Architecture Diagram** (HTML)](docs/architecture/torusguard-architecture.html) — Dynamic zoomable/pannable pipeline with dark/light themes, live view switching (Tri-Mode Ingress, AST Engine, Multi-Modal Vision OCR, Ponytail Bounds, Fail-Closed Recovery), and SVG/PNG export.
|
|
167
|
+
> - [**Governed Remediation Workflow** (HTML)](docs/architecture/torusguard-governance.workflow.html) — Step-by-step visual trace of the 7-stage remediation loop, safety gates, and automatic rollback path.
|
|
168
|
+
|
|
138
169
|
**Key design decisions:**
|
|
139
170
|
- **Tri-Mode Parity:** The CLI (Mode A), Chat Slash Commands (Mode B), and Native MCP Tools (Mode C) share the exact same underlying governance and validation rules.
|
|
140
171
|
- **Multi-Modal Vision OCR:** Images, architecture diagrams, and screenshots are automatically scanned for leaked secrets using Tesseract OCR, bounded by strict 10MB memory safety limits.
|
|
@@ -169,7 +200,7 @@ npx torusguard init
|
|
|
169
200
|
```
|
|
170
201
|
|
|
171
202
|
<a href="https://www.npmjs.com/package/torusguard">
|
|
172
|
-
<img src="https://img.shields.io/badge/npm-v2.
|
|
203
|
+
<img src="https://img.shields.io/badge/npm-v2.1.0-CB3837?logo=npm&logoColor=white" alt="npm package">
|
|
173
204
|
</a>
|
|
174
205
|
|
|
175
206
|
### Option 2: Build from Source (Recommended for Contributors)
|
|
@@ -257,6 +288,10 @@ torusguard exploit-check
|
|
|
257
288
|
| `authorize` | Generate cryptographic auth tokens for runtime probing |
|
|
258
289
|
| `web-validate` | Authorized HTTP probing with `X-TorusGuard-Audit` headers |
|
|
259
290
|
| `ocr-scan` | Run Tesseract OCR secret scan on images/diagrams (<10MB) |
|
|
291
|
+
| `container` | Audit Dockerfile, compose, and container configurations |
|
|
292
|
+
| `git-mine` | Mine git commit history for leaked secrets & creds |
|
|
293
|
+
| `redos` | Analyze regex patterns for catastrophic backtracking |
|
|
294
|
+
| `ai-guard` | Scan AI/LLM code for prompt injection & RAG flaws |
|
|
260
295
|
| `mcp` | Run native Model Context Protocol (MCP) server over stdio |
|
|
261
296
|
| `update` | Self-update the TorusGuard engine |
|
|
262
297
|
| `help` | Show interactive command guide |
|
|
@@ -272,7 +307,9 @@ TorusGuard/
|
|
|
272
307
|
│ └── mcp.go # Model Context Protocol (MCP) JSON-RPC 2.0 stdio server
|
|
273
308
|
├── internal/
|
|
274
309
|
│ ├── apply/ # Patch application + pre-apply snapshot engine
|
|
275
|
-
│ ├── harden/ # Ponytail Protocol bounds enforcement
|
|
310
|
+
│ ├── harden/ # Ponytail Protocol bounds enforcement & line-level reflection
|
|
311
|
+
│ │ ├── patch.go # Ponytail Protocol bounds verification
|
|
312
|
+
│ │ └── reflection.go # Line-level reflection & semantic replacement
|
|
276
313
|
│ ├── memory/ # Golden Fix recipe persistence
|
|
277
314
|
│ ├── recheck/ # Differential re-scan engine
|
|
278
315
|
│ ├── report/ # SARIF v2.1.0 + dark-mode HTML generators
|
|
@@ -296,28 +333,13 @@ TorusGuard/
|
|
|
296
333
|
|
|
297
334
|
---
|
|
298
335
|
|
|
299
|
-
## 🔒 Security
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
| `TG-INPUT` | Input Sanitization & Traversal | 6 | Strict path sanitization, safe DOM assignments |
|
|
307
|
-
| `TG-RATE` | Rate Limiting & Resources | 3 | Rate-limiting on auth endpoints, payload size bounds |
|
|
308
|
-
| `TG-AGENT` | AI Agent & LLM Injection | 4 | Structural prompt isolation, tool call schema validation |
|
|
309
|
-
| `TG-SSRF` | Server-Side Request Forgery | 4 | Hostname whitelisting, private IP range blocking |
|
|
310
|
-
| `TG-WEBHOOK` | Inbound Webhook Verification | 4 | HMAC-SHA256 signature verification, replay prevention |
|
|
311
|
-
| `TG-WS` | WebSocket & Real-Time | 4 | Origin verification, handshake auth, frame size limits |
|
|
312
|
-
| `TG-CSRF` | Cross-Site Request Forgery | 2 | SameSite cookies, anti-CSRF token verification |
|
|
313
|
-
| `TG-GQL` | GraphQL Safety | 4 | Query depth limiting, introspection suppression |
|
|
314
|
-
| `TG-SUPPLY` | Supply Chain & Dependencies | 6 | Lockfile integrity, known CVE audits |
|
|
315
|
-
| `TG-BIZ` | Business Logic & Workflows | 4 | Negative amount validation, transaction locks |
|
|
316
|
-
| `TG-CACHE` | Cache Poisoning & Timing | 3 | Cache-control headers, unkeyed header sanitization |
|
|
317
|
-
| `TG-CLIENT` | Client Bundle & Frontend | 2 | Zero private env vars in client bundles |
|
|
318
|
-
| `TG-PLATFORM` | Server Hardening & Headers | 4 | Helmet headers, debug suppression, cookie secure flags |
|
|
319
|
-
| `TG-DIFF` | Polyglot Bypass & Churn | 3 | Block `# nosec`, `InsecureSkipVerify`, churn bounds |
|
|
320
|
-
| `TG-EDGE` | Edge Computing & Serverless | 2 | Subrequest fan-out limits, execution timeouts |
|
|
336
|
+
## 🔒 Security Invariants & Rule Governance
|
|
337
|
+
|
|
338
|
+
TorusGuard enforces **86 security invariants across 22 architectural families** covering Secrets, Authentication, Multi-Tenant Database Isolation, Input Sanitization, Rate Limiting, AI Agent Prompt Injection, SSRF, Webhooks, WebSockets, CSRF, GraphQL, Supply Chain, Business Logic, Cache Poisoning, Client Bundles, Platform Headers, Polyglot Bypasses, Edge Timeouts, Container & Docker Safety, Git History Secret Mining, Regular Expression Backtracking (ReDoS), and Vector Database RAG Isolation.
|
|
339
|
+
|
|
340
|
+
> 📘 **Full Rules Catalog & Invariants:**
|
|
341
|
+
> The complete rulebook with formal invariant definitions, severity scores, and testing signatures is maintained in [`AGENTS.md`](AGENTS.md) and the [`rules/`](rules/) directory.
|
|
342
|
+
> You can also explore verified Golden Fix patterns anytime via `torusguard recipes` or stream the live catalog over MCP via `torusguard://rules_catalog`.
|
|
321
343
|
|
|
322
344
|
---
|
|
323
345
|
|
|
@@ -356,10 +378,16 @@ When configured with `.agents/mcp_config.json` or `mcp_config.json`, AI coding a
|
|
|
356
378
|
|
|
357
379
|
- `torusguard_audit`: Deep static AST scan + Vision OCR; writes `security_report.md`
|
|
358
380
|
- `torusguard_ocr_scan`: Dedicated image credential analysis via Tesseract (5-10MB bounds)
|
|
381
|
+
- `torusguard_container`: Audits container files for root execution, docker socket exposure, and privileged mode
|
|
382
|
+
- `torusguard_git_mine`: Mines git commit history and config for leaked credentials and tokens
|
|
383
|
+
- `torusguard_redos`: Analyzes regex patterns for catastrophic exponential backtracking
|
|
384
|
+
- `torusguard_ai_guard`: Audits AI agent prompt templates, tool registries, and vector database queries
|
|
385
|
+
- `torusguard_verify`: Asserts evidence sufficiency & line-shift invariant fingerprint matches
|
|
359
386
|
- `torusguard_harden`: Validates remediation diff against Ponytail Protocol bounds
|
|
360
387
|
- `torusguard_recheck`: Differential re-scan confirming fix closure
|
|
361
388
|
- `torusguard_status`: Workspace posture and tech stack inspection
|
|
362
389
|
- `torusguard://security_report`: MCP Resource reading the living security report
|
|
390
|
+
- `torusguard://rules_catalog`: MCP Resource exploring verified rules catalog & Golden Fix patterns
|
|
363
391
|
|
|
364
392
|
---
|
|
365
393
|
|
package/package.json
CHANGED