torusguard 1.4.0 → 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.
Files changed (160) hide show
  1. package/.torusguard/.manifest.json +50 -28
  2. package/.torusguard/auth.json +5 -0
  3. package/.torusguard/rules/container/TG-CONT-001-root-user-execution.md +50 -0
  4. package/.torusguard/rules/container/TG-CONT-002-docker-socket-mount.md +47 -0
  5. package/.torusguard/rules/container/TG-CONT-003-privileged-container-mode.md +53 -0
  6. package/.torusguard/rules/container/TG-CONT-004-build-arg-secret-exposure.md +43 -0
  7. package/.torusguard/rules/git/TG-GIT-001-historical-secret-in-git-commit.md +44 -0
  8. package/.torusguard/rules/git/TG-GIT-002-plaintext-credentials-in-git-config.md +41 -0
  9. package/.torusguard/rules/git/TG-GIT-003-sensitive-tracked-file-gitignore-breach.md +40 -0
  10. package/.torusguard/rules/rag/TG-RAG-001-untrusted-rag-context-injection.md +72 -0
  11. package/.torusguard/rules/rag/TG-RAG-002-autonomous-llm-tool-unsandboxed-call.md +51 -0
  12. package/.torusguard/rules/rag/TG-RAG-003-unpartitioned-vector-tenant-lookup.md +51 -0
  13. package/.torusguard/rules/redos/TG-REDOS-001-catastrophic-exponential-backtracking.md +46 -0
  14. package/.torusguard/rules/redos/TG-REDOS-002-unbounded-nested-quantifier.md +43 -0
  15. package/.torusguard/rules_catalog.json +338 -518
  16. package/.torusguard/scripts/__pycache__/apply_runner.cpython-314.pyc +0 -0
  17. package/.torusguard/scripts/__pycache__/audit_runner.cpython-314.pyc +0 -0
  18. package/.torusguard/scripts/__pycache__/harden_runner.cpython-314.pyc +0 -0
  19. package/.torusguard/scripts/__pycache__/html_reporter.cpython-314.pyc +0 -0
  20. package/.torusguard/scripts/__pycache__/manifest_builder.cpython-314.pyc +0 -0
  21. package/.torusguard/scripts/__pycache__/recipes_runner.cpython-314.pyc +0 -0
  22. package/.torusguard/scripts/__pycache__/report_sync.cpython-314.pyc +0 -0
  23. package/.torusguard/scripts/manifest_builder.py +1 -1
  24. package/.torusguard/skills/torusguard/SKILL.md +69 -24
  25. package/.torusguard/skills/torusguard/bootstrap.py +57 -24
  26. package/.torusguard/skills/torusguard-ai-guard/SKILL.md +95 -0
  27. package/.torusguard/skills/torusguard-apply/SKILL.md +60 -34
  28. package/.torusguard/skills/torusguard-audit/SKILL.md +73 -24
  29. package/.torusguard/skills/torusguard-authorize/SKILL.md +48 -6
  30. package/.torusguard/skills/torusguard-container/SKILL.md +94 -0
  31. package/.torusguard/skills/torusguard-exploit-check/SKILL.md +50 -6
  32. package/.torusguard/skills/torusguard-full/SKILL.md +62 -19
  33. package/.torusguard/skills/torusguard-git-mine/SKILL.md +92 -0
  34. package/.torusguard/skills/torusguard-harden/SKILL.md +81 -50
  35. package/.torusguard/skills/torusguard-init/SKILL.md +61 -14
  36. package/.torusguard/skills/torusguard-ocr-scan/SKILL.md +94 -0
  37. package/.torusguard/skills/torusguard-recheck/SKILL.md +71 -18
  38. package/.torusguard/skills/torusguard-redos/SKILL.md +91 -0
  39. package/.torusguard/skills/torusguard-report/SKILL.md +50 -9
  40. package/.torusguard/skills/torusguard-status/SKILL.md +63 -10
  41. package/.torusguard/skills/torusguard-verify/SKILL.md +52 -10
  42. package/.torusguard/skills/torusguard-web-validate/SKILL.md +53 -8
  43. package/.torusguard/snapshots/20260921-182638/go.mod.bak +11 -0
  44. package/.torusguard/snapshots/20260921-185213/file.go.bak +5 -0
  45. package/.torusguard/workflows/ai-guard.md +31 -0
  46. package/.torusguard/workflows/apply.md +32 -55
  47. package/.torusguard/workflows/audit.md +28 -46
  48. package/.torusguard/workflows/authorize.md +27 -50
  49. package/.torusguard/workflows/container.md +29 -0
  50. package/.torusguard/workflows/exploit-check.md +28 -50
  51. package/.torusguard/workflows/git-mine.md +25 -0
  52. package/.torusguard/workflows/harden.md +29 -48
  53. package/.torusguard/workflows/init.md +27 -50
  54. package/.torusguard/workflows/memory.md +18 -23
  55. package/.torusguard/workflows/ocr-scan.md +25 -0
  56. package/.torusguard/workflows/recheck.md +28 -46
  57. package/.torusguard/workflows/redos.md +27 -0
  58. package/.torusguard/workflows/report.md +33 -52
  59. package/.torusguard/workflows/status.md +31 -52
  60. package/.torusguard/workflows/verify.md +29 -49
  61. package/.torusguard/workflows/web-validate.md +22 -45
  62. package/README.md +336 -386
  63. package/package.json +1 -1
  64. package/skills/torusguard/SKILL.md +71 -24
  65. package/skills/torusguard/__pycache__/bootstrap.cpython-314.pyc +0 -0
  66. package/skills/torusguard/bootstrap.py +60 -71
  67. package/skills/torusguard/payload/.manifest.json +50 -28
  68. package/skills/torusguard/payload/TORUSGUARD.md +145 -145
  69. package/skills/torusguard/payload/agents/auditor.md +41 -41
  70. package/skills/torusguard/payload/agents/profiler.md +49 -49
  71. package/skills/torusguard/payload/agents/remediator.md +41 -41
  72. package/skills/torusguard/payload/agents/reviewer.md +39 -39
  73. package/skills/torusguard/payload/agents/validator.md +46 -46
  74. package/skills/torusguard/payload/config/scope.json +24 -24
  75. package/skills/torusguard/payload/references/csharp-security.md +41 -41
  76. package/skills/torusguard/payload/references/go-security.md +41 -41
  77. package/skills/torusguard/payload/references/java-security.md +40 -40
  78. package/skills/torusguard/payload/references/polyglot-security-matrix.md +25 -25
  79. package/skills/torusguard/payload/references/rust-security.md +40 -40
  80. package/skills/torusguard/payload/rules/container/TG-CONT-001-root-user-execution.md +50 -0
  81. package/skills/torusguard/payload/rules/container/TG-CONT-002-docker-socket-mount.md +47 -0
  82. package/skills/torusguard/payload/rules/container/TG-CONT-003-privileged-container-mode.md +53 -0
  83. package/skills/torusguard/payload/rules/container/TG-CONT-004-build-arg-secret-exposure.md +43 -0
  84. package/skills/torusguard/payload/rules/custom/.gitkeep +1 -1
  85. package/skills/torusguard/payload/rules/custom/README.md +30 -30
  86. package/skills/torusguard/payload/rules/git/TG-GIT-001-historical-secret-in-git-commit.md +44 -0
  87. package/skills/torusguard/payload/rules/git/TG-GIT-002-plaintext-credentials-in-git-config.md +41 -0
  88. package/skills/torusguard/payload/rules/git/TG-GIT-003-sensitive-tracked-file-gitignore-breach.md +40 -0
  89. package/skills/torusguard/payload/rules/rag/TG-RAG-001-untrusted-rag-context-injection.md +72 -0
  90. package/skills/torusguard/payload/rules/rag/TG-RAG-002-autonomous-llm-tool-unsandboxed-call.md +51 -0
  91. package/skills/torusguard/payload/rules/rag/TG-RAG-003-unpartitioned-vector-tenant-lookup.md +51 -0
  92. package/skills/torusguard/payload/rules/redos/TG-REDOS-001-catastrophic-exponential-backtracking.md +46 -0
  93. package/skills/torusguard/payload/rules/redos/TG-REDOS-002-unbounded-nested-quantifier.md +43 -0
  94. package/skills/torusguard/payload/rules_catalog.json +338 -518
  95. package/skills/torusguard/payload/scripts/__pycache__/term_ui.cpython-314.pyc +0 -0
  96. package/skills/torusguard/payload/scripts/manifest_builder.py +1 -1
  97. package/skills/torusguard/payload/scripts/rules_sync.py +321 -321
  98. package/skills/torusguard/payload/scripts/safety_gate.py +64 -64
  99. package/skills/torusguard/payload/skills/torusguard/SKILL.md +69 -24
  100. package/skills/torusguard/payload/skills/torusguard/bootstrap.py +57 -24
  101. package/skills/torusguard/payload/skills/torusguard-ai-guard/SKILL.md +95 -0
  102. package/skills/torusguard/payload/skills/torusguard-apply/SKILL.md +60 -34
  103. package/skills/torusguard/payload/skills/torusguard-audit/SKILL.md +73 -24
  104. package/skills/torusguard/payload/skills/torusguard-authorize/SKILL.md +48 -6
  105. package/skills/torusguard/payload/skills/torusguard-container/SKILL.md +94 -0
  106. package/skills/torusguard/payload/skills/torusguard-exploit-check/SKILL.md +50 -6
  107. package/skills/torusguard/payload/skills/torusguard-full/SKILL.md +62 -19
  108. package/skills/torusguard/payload/skills/torusguard-git-mine/SKILL.md +92 -0
  109. package/skills/torusguard/payload/skills/torusguard-harden/SKILL.md +81 -50
  110. package/skills/torusguard/payload/skills/torusguard-init/SKILL.md +61 -14
  111. package/skills/torusguard/payload/skills/torusguard-ocr-scan/SKILL.md +94 -0
  112. package/skills/torusguard/payload/skills/torusguard-recheck/SKILL.md +71 -18
  113. package/skills/torusguard/payload/skills/torusguard-redos/SKILL.md +91 -0
  114. package/skills/torusguard/payload/skills/torusguard-report/SKILL.md +50 -9
  115. package/skills/torusguard/payload/skills/torusguard-status/SKILL.md +63 -10
  116. package/skills/torusguard/payload/skills/torusguard-verify/SKILL.md +52 -10
  117. package/skills/torusguard/payload/skills/torusguard-web-validate/SKILL.md +53 -8
  118. package/skills/torusguard/payload/templates/audit-report.template.md +54 -54
  119. package/skills/torusguard/payload/templates/authorization.template.md +34 -34
  120. package/skills/torusguard/payload/templates/finding-card.template.md +32 -32
  121. package/skills/torusguard/payload/templates/remediation-bundle.template.md +35 -35
  122. package/skills/torusguard/payload/workflows/ai-guard.md +31 -0
  123. package/skills/torusguard/payload/workflows/apply.md +31 -62
  124. package/skills/torusguard/payload/workflows/audit.md +27 -51
  125. package/skills/torusguard/payload/workflows/authorize.md +27 -50
  126. package/skills/torusguard/payload/workflows/container.md +29 -0
  127. package/skills/torusguard/payload/workflows/exploit-check.md +28 -50
  128. package/skills/torusguard/payload/workflows/git-mine.md +25 -0
  129. package/skills/torusguard/payload/workflows/harden.md +28 -52
  130. package/skills/torusguard/payload/workflows/init.md +27 -56
  131. package/skills/torusguard/payload/workflows/memory.md +18 -23
  132. package/skills/torusguard/payload/workflows/ocr-scan.md +25 -0
  133. package/skills/torusguard/payload/workflows/recheck.md +28 -46
  134. package/skills/torusguard/payload/workflows/redos.md +27 -0
  135. package/skills/torusguard/payload/workflows/report.md +39 -62
  136. package/skills/torusguard/payload/workflows/status.md +31 -55
  137. package/skills/torusguard/payload/workflows/verify.md +29 -49
  138. package/skills/torusguard/payload/workflows/web-validate.md +22 -45
  139. package/skills/torusguard/references/csharp-security.md +41 -0
  140. package/skills/torusguard/references/go-security.md +41 -0
  141. package/skills/torusguard/references/java-security.md +40 -0
  142. package/skills/torusguard/references/polyglot-security-matrix.md +25 -0
  143. package/skills/torusguard/references/rust-security.md +40 -0
  144. package/skills/torusguard-ai-guard/SKILL.md +95 -0
  145. package/skills/torusguard-apply/SKILL.md +60 -34
  146. package/skills/torusguard-audit/SKILL.md +73 -24
  147. package/skills/torusguard-authorize/SKILL.md +48 -6
  148. package/skills/torusguard-container/SKILL.md +94 -0
  149. package/skills/torusguard-exploit-check/SKILL.md +50 -6
  150. package/skills/torusguard-full/SKILL.md +62 -19
  151. package/skills/torusguard-git-mine/SKILL.md +92 -0
  152. package/skills/torusguard-harden/SKILL.md +81 -50
  153. package/skills/torusguard-init/SKILL.md +61 -14
  154. package/skills/torusguard-ocr-scan/SKILL.md +94 -0
  155. package/skills/torusguard-recheck/SKILL.md +71 -18
  156. package/skills/torusguard-redos/SKILL.md +91 -0
  157. package/skills/torusguard-report/SKILL.md +50 -9
  158. package/skills/torusguard-status/SKILL.md +63 -10
  159. package/skills/torusguard-verify/SKILL.md +52 -10
  160. package/skills/torusguard-web-validate/SKILL.md +53 -8
@@ -1,14 +1,14 @@
1
1
  ---
2
2
  description: Legal scope definition, target ownership proof verification, and safety boundary enforcement for runtime validation.
3
- tools: Read, Grep, Glob, Bash, Write
4
- version: 1.3.6
3
+ tools: Read, Grep, Glob, Bash, Write, run_command
4
+ version: 2.0.0
5
5
  agent: reviewer
6
6
  lifecycle-phase: Phase 1 (Authorization Gate)
7
7
  required-skills:
8
8
  - torusguard-authorize
9
9
  scripts-binding:
10
- - .torusguard/scripts/report_sync.py
11
- - .torusguard/scripts/safety_gate.py
10
+ - internal/validate/validate.go
11
+ - cmd/torusguard/main.go
12
12
  ---
13
13
 
14
14
  # /torusguard authorize — Legal Scope & Safety Gate
@@ -18,7 +18,17 @@ $ARGUMENTS
18
18
  ---
19
19
 
20
20
  ## Objective
21
- Legal scope definition, target ownership proof verification, and safety boundary enforcement.
21
+ Legal scope definition, target ownership proof verification, and safety boundary enforcement for runtime validation.
22
+
23
+ ---
24
+
25
+ ## Tri-Mode Execution
26
+
27
+ | Mode | Command / Tool | Execution Method |
28
+ | :--- | :--- | :--- |
29
+ | **Mode A: Terminal CLI** | `torusguard authorize` | Interactive boundary setup and cryptographic token generation. |
30
+ | **Mode B: AI Chat Slash** | `/torusguard authorize` | Conversational parameter collection and scope validation. |
31
+ | **Mode C: Native MCP Tool** | Safety Gate Guard | Administrative gatekeeper ensuring strict safety boundaries before probes. |
22
32
 
23
33
  ---
24
34
 
@@ -27,52 +37,20 @@ Legal scope definition, target ownership proof verification, and safety boundary
27
37
  Inspect authorization parameters and environment safety before executing:
28
38
  1. **Config Record (`.torusguard/config/torusguard.json`):** Assert repository is initialized.
29
39
  2. **Current Scope (`.torusguard/config/scope.json`):** Inspect active allowed targets, paths, and TTL expiry.
30
- 3. **Environment Classification:** Assert target is local or staging (`localhost`, `127.0.0.1`, `*.local`, `*.staging.*`). Production targets require explicit approval.
40
+ 3. **Environment Classification:** Assert target is local or staging (`localhost`, `127.0.0.1`, `*.staging.*`).
31
41
  4. **Destructive Guard:** Ensure state-changing operations (`DELETE`, bulk drops) remain blocked by default.
32
- 5. **Ownership Proof:** Verify target ownership token or local process binding.
33
- 6. **TTL Window:** Ensure authorization window does not exceed 24 hours.
34
-
35
- ---
36
-
37
- ## When to Use /torusguard authorize
38
-
39
- | Trigger Scenario | Recommended Action |
40
- | :--- | :--- |
41
- | Preparing for live HTTP probes or API validation | Run `/torusguard authorize` |
42
- | Updating allowed hosts, path prefixes, or rate limits | Run `/torusguard authorize` |
43
- | Static-only security audit | Skip authorize; run `/torusguard audit` |
44
- | Checking active legal scope status | Run `/torusguard status` |
45
- | Expired authorization window | Re-run `/torusguard authorize` |
42
+ 5. **TTL Window:** Ensure authorization window does not exceed 24 hours.
46
43
 
47
44
  ---
48
45
 
49
46
  ## Execution Steps
50
47
 
51
- 1. **Capture Scope Parameters:** Collect target URL, allowed paths, forbidden prefixes, and max request budget.
52
- 2. **Validate Host Ownership:** Verify target is local or matches authorized test domains.
53
- 3. **Invoke Safety Gate:**
54
- ```bash
55
- python .torusguard/scripts/safety_gate.py check --url <target_url>
56
- ```
57
- 4. **Write Scope File (`.torusguard/config/scope.json`):** Save authorized targets, valid TTL timestamp, and request rate caps.
58
- 5. **Confirm Scope Binding:** Verify `.torusguard/config/scope.json` parses as valid JSON against schema.
59
-
60
- ---
61
-
62
- ## Failure Recovery
63
-
64
- - **Unreachable Host:** Verify local server is running on the specified port.
65
- - **Production Target Warning:** If target resolves to an external production host, halt and request operator override.
66
- - **Malformed JSON:** Re-initialize `scope.json` from `.torusguard/schemas/auth-boundary.schema.json`.
67
- - **Halt Trigger:** Abort immediately if user provides wildcard target (`*`) or third-party domain.
68
-
69
- ---
70
-
71
- ## Hallucination Guard
72
-
73
- - ❌ Never proceed with runtime probing without an explicit, valid `.torusguard/config/scope.json`.
74
- - ❌ Never authorize destructive HTTP methods (`DELETE`, `DROP`) under default non-destructive policy.
75
- - ✅ Always validate targets through `.torusguard/scripts/safety_gate.py`.
48
+ 1. **Trigger Authorization:**
49
+ - **Mode A (CLI):** Run `torusguard authorize`.
50
+ - **Mode B (Chat):** Collect target host URL and allowed prefixes.
51
+ 2. **Generate Token:** Persist cryptographic authorization token into `.torusguard/auth.json`.
52
+ 3. **Write Scope Record:** Persist authorized targets and expiration TTL into `.torusguard/config/scope.json`.
53
+ 4. **Confirm Readiness:** Prepare environment for `/torusguard web-validate`.
76
54
 
77
55
  ---
78
56
 
@@ -81,9 +59,8 @@ Inspect authorization parameters and environment safety before executing:
81
59
  ```markdown
82
60
  ### 🔒 TorusGuard Authorization Gate
83
61
  - **Target URL:** [Target Host or URL]
84
- - **Environment:** [Localhost / Staging / Container]
85
- - **Allowed Paths:** [Path prefixes or all authorized]
86
- - **Rate Limit:** [Max requests / concurrency limit]
62
+ - **Environment:** [Localhost / Staging]
63
+ - **Session TTL:** 24 Hours
87
64
  - **Scope File:** `.torusguard/config/scope.json`
88
65
  - **Status:** AUTHORIZED — ready for `/torusguard web-validate`
89
66
  ```
@@ -92,5 +69,5 @@ Inspect authorization parameters and environment safety before executing:
92
69
 
93
70
  ## Next Steps
94
71
 
95
- 1. Run `/torusguard audit` to scan codebase for AST security vulnerabilities.
96
- 2. Run `/torusguard web-validate` to begin safe, authorized endpoint validation.
72
+ 1. Run `/torusguard web-validate` to begin safe, authorized endpoint validation.
73
+ 2. Run `/torusguard audit` to scan codebase for AST vulnerabilities.
@@ -0,0 +1,29 @@
1
+ # /torusguard-container — Container & Docker Security Audit
2
+
3
+ $ARGUMENTS
4
+
5
+ ---
6
+
7
+ ## Objective
8
+ Detect and remediate container privilege escalation, root execution, docker socket exposure, and build-time secret injection across `Dockerfile`, `Containerfile`, and `docker-compose.yml` configurations.
9
+
10
+ ---
11
+
12
+ ## Tri-Mode Parity
13
+ - **Mode A (Terminal CLI):** `torusguard container [target]`
14
+ - **Mode B (AI Chat Slash Command):** `/torusguard container [target]`
15
+ - **Mode C (Native MCP Tool):** `torusguard_container`
16
+
17
+ ---
18
+
19
+ ## Execution Steps
20
+
21
+ 1. **Discover Container Configurations:** Discover all Dockerfiles and compose YAML files in the workspace.
22
+ 2. **Execute Static Heuristic Audit:** Run `ScanContainerFiles` or `torusguard_container` against discovered files.
23
+ 3. **Assert Security Invariants:**
24
+ - Enforce non-root user declarations (`TG-CONT-001`).
25
+ - Block Docker daemon socket mounts (`/var/run/docker.sock`) (`TG-CONT-002`).
26
+ - Disallow `privileged: true` and unconfined seccomp profiles (`TG-CONT-003`).
27
+ - Ban build-time secrets in `ARG` or `ENV` directives (`TG-CONT-004`).
28
+ 4. **Formulate Surgical Patches:** Propose minimal diffs adding non-root users (`USER appuser`) and secret mounts within Ponytail bounds (≤35 additions, ≤25 deletions).
29
+ 5. **Synchronize Report:** Log all container findings in `security_report.md`.
@@ -1,15 +1,14 @@
1
1
  ---
2
2
  description: Safe, bounded, single-step exploitability confirmation across 5 standard verification statuses.
3
- tools: Read, Grep, Glob, Bash, Write
4
- version: 1.3.6
3
+ tools: Read, Grep, Glob, Bash, Write, run_command
4
+ version: 2.0.0
5
5
  agent: validator
6
6
  lifecycle-phase: Phase 3c (Exploitability Check)
7
7
  required-skills:
8
8
  - torusguard-exploit-check
9
9
  scripts-binding:
10
- - .torusguard/scripts/report_sync.py
11
- - .torusguard/scripts/safety_gate.py
12
- - .torusguard/scripts/finding_scorer.py
10
+ - internal/validate/validate.go
11
+ - cmd/torusguard/main.go
13
12
  ---
14
13
 
15
14
  # /torusguard exploit-check — Bounded Exploitability Confirmation
@@ -19,62 +18,43 @@ $ARGUMENTS
19
18
  ---
20
19
 
21
20
  ## Objective
22
- Safe, bounded, single-step exploitability confirmation across 5 standard verification statuses.
21
+ Safe, bounded, single-step exploitability confirmation using inert canary tokens without data loss or weaponized execution.
23
22
 
24
23
  ---
25
24
 
26
- ## Mandatory Pre-Flight Context Inspection
25
+ ## Tri-Mode Execution
27
26
 
28
- Inspect authorization parameters and probe safety constraints:
29
- 1. **Scope Check (`scope.json`):** Assert endpoint is authorized.
30
- 2. **Approved Probes:** Use benign canaries (SQLi math, HTML marker, unauth read).
31
- 3. **Destructive Ban:** Strictly prohibit drops, DOS, or weaponized payloads.
32
- 4. **Safety Gate:** Verify probe with `safety_gate.py` prior to dispatch.
33
- 5. **Bound:** Limit to single non-destructive HTTP request per finding.
34
- 6. **Audit Trail:** Inject `X-TorusGuard-AuthID` header on all outbound requests.
27
+ | Mode | Command / Tool | Execution Method |
28
+ | :--- | :--- | :--- |
29
+ | **Mode A: Terminal CLI** | `torusguard exploit-check [--url <url>] [--finding <id>]` | Terminal execution of sentinel canary prober. |
30
+ | **Mode B: AI Chat Slash** | `/torusguard exploit-check` | Conversational exploitability triage and status classification. |
31
+ | **Mode C: Native MCP Tool** | Bounded Probe Engine | Safe probe execution guarded by inert tokens and safety gate. |
35
32
 
36
33
  ---
37
34
 
38
- ## When to Use /torusguard exploit-check
35
+ ## Mandatory Pre-Flight Context Inspection
39
36
 
40
- | Trigger Scenario | Recommended Action |
41
- | :--- | :--- |
42
- | Confirming whether a flaw is practically exploitable | Run `/torusguard exploit-check` |
43
- | Upgrading Medium confidence finding to Confirmed | Run `/torusguard exploit-check` |
44
- | Verifying IDOR or tenant isolation boundaries | Run `/torusguard exploit-check` |
45
- | Routine endpoint header inspection | Run `/torusguard web-validate` |
46
- | Applying approved remediation patch | Run `/torusguard apply` |
37
+ Inspect authorization parameters and probe safety constraints:
38
+ 1. **Scope Check (`scope.json`):** Assert endpoint is authorized.
39
+ 2. **Approved Probes:** Use benign canaries (SQLi math identity `' OR 1=1--`, HTML marker `<tg-canary-tag>`).
40
+ 3. **Destructive Ban:** Strictly prohibit drops, DOS, or weaponized payloads.
41
+ 4. **Bound:** Limit to single non-destructive HTTP request per finding.
42
+ 5. **Audit Trail:** Inject `X-TorusGuard-AuthID` header on all outbound requests.
47
43
 
48
44
  ---
49
45
 
50
46
  ## Execution Steps
51
47
 
52
- 1. **Verify Authorization Scope:** Confirm target host and route in `scope.json`.
53
- 2. **Select Safe Canary:** Choose inert mathematical sentinel or unauth GET.
54
- 3. **Validate With Safety Gate:**
55
- ```bash
56
- python .torusguard/scripts/safety_gate.py check --url <target_url> --payload <canary>
57
- ```
58
- 4. **Dispatch Bounded Single Probe:** Send request with header `X-TorusGuard-AuthID`.
59
- 5. **Classify Status:** Evaluate response against 5 outcomes: `Confirmed`, `Needs Review`, `Not Reproducible`, `Blocked by Controls`, `Out of Scope`.
60
- 6. **Emit Artifacts:** Write `exploit-check.md` and update `findings.json`.
61
-
62
- ---
63
-
64
- ## Failure Recovery
65
-
66
- - **Connection Refused:** Verify target server is running locally on port.
67
- - **Safety Gate Block:** If `Manual Only`, halt automated probe and request human review.
68
- - **Ambiguous Response:** Mark finding as `Needs Review`; never assume exploit without proof.
69
- - **Halt Trigger:** Abort if probe causes server 500 error or unexpected crash.
70
-
71
- ---
72
-
73
- ## Hallucination Guard
74
-
75
- - ❌ Never classify a vulnerability as `Confirmed` without direct sentinel reflection.
76
- - ❌ Never execute brute force attacks or automated password spraying.
77
- - ✅ Always provide reproducible curl commands with redacted credentials.
48
+ 1. **Trigger Exploit Check:**
49
+ - **Mode A (CLI):** Run `torusguard exploit-check --url http://localhost:3000 --finding TG-SEC-001`.
50
+ - **Mode B (Chat):** Review response to inert canary probe.
51
+ 2. **Classify Status:** Evaluate response against 5 canonical outcomes:
52
+ - `Confirmed`: Canary reflected or secondary tenant data leaked.
53
+ - `Not Reproducible`: Endpoint responded with 401/403 or sanitized input.
54
+ - `Needs Review`: Ambiguous status code or incomplete response.
55
+ - `Blocked by Controls`: WAF or rate limiter stopped probe.
56
+ - `Out of Scope`: Target endpoint is not authorized.
57
+ 3. **Update Living Report:** Record outcome in `security_report.md`.
78
58
 
79
59
  ---
80
60
 
@@ -84,10 +64,8 @@ Inspect authorization parameters and probe safety constraints:
84
64
  ### 🎯 TorusGuard Exploitability Confirmation
85
65
  - **Target Route:** `[METHOD] /path`
86
66
  - **Finding ID:** `TG-XXX-HASH`
87
- - **Canary Used:** [Inert Math Sentinel / Unauth Read]
88
67
  - **Status:** [Confirmed / Not Reproducible / Blocked]
89
68
  - **Evidence:** [Response snippet demonstrating leak or block]
90
- - **Replay Curl:** `curl -X [METHOD] http://localhost:PORT/path ...`
91
69
  ```
92
70
 
93
71
  ---
@@ -0,0 +1,25 @@
1
+ # /torusguard-git-mine — Git Repository & History Secret Mining
2
+
3
+ $ARGUMENTS
4
+
5
+ ---
6
+
7
+ ## Objective
8
+ Inspect local Git metadata, `.git/config` remotes, and historical commit logs to uncover leaked API tokens, private certificates, and sensitive credentials committed in previous revisions.
9
+
10
+ ---
11
+
12
+ ## Tri-Mode Parity
13
+ - **Mode A (Terminal CLI):** `torusguard git-mine [target]`
14
+ - **Mode B (AI Chat Slash Command):** `/torusguard git-mine [target]`
15
+ - **Mode C (Native MCP Tool):** `torusguard_git_mine`
16
+
17
+ ---
18
+
19
+ ## Execution Steps
20
+
21
+ 1. **Verify Git Environment:** Verify target directory is a valid Git repository containing `.git/`.
22
+ 2. **Audit Remote Configurations:** Check `.git/config` for embedded basic auth credentials in remote origin URLs (`TG-GIT-002`).
23
+ 3. **Mine Commit Log Diffs:** Inspect the last 50 commits (`git log -p`) for added tokens, keys, and credentials (`TG-GIT-001`).
24
+ 4. **Audit Tracked Sensitive Files:** Ensure `.env`, private keys, and certificates are not tracked in git tree history (`TG-GIT-003`).
25
+ 5. **Report & Revoke:** Provide immediate provider revocation steps and commit log cleanup guidance in `security_report.md`.
@@ -1,16 +1,16 @@
1
1
  ---
2
2
  description: Governed remediation formulation under strict Ponytail Protocol bounds (<= 35 additions, <= 25 deletions) and bundle packaging.
3
- tools: Read, Grep, Glob, Bash, Write
4
- version: 1.4.0
3
+ tools: Read, Grep, Glob, Bash, Write, run_command
4
+ version: 2.0.0
5
5
  agent: remediator
6
6
  lifecycle-phase: Phase 4 (Remediation Formulation)
7
7
  required-skills:
8
8
  - torusguard-harden
9
9
  scripts-binding:
10
- - .torusguard/scripts/harden_runner.py
11
- - .torusguard/scripts/report_sync.py
12
- - .torusguard/scripts/run_manager.py
13
- - .torusguard/scripts/diff_guard.py
10
+ - internal/harden/patch.go
11
+ - internal/harden/reflection.go
12
+ - cmd/torusguard/main.go
13
+ - cmd/torusguard/mcp.go
14
14
  ---
15
15
 
16
16
  # /torusguard harden — Governed Remediation & Bundle Packaging
@@ -20,36 +20,29 @@ $ARGUMENTS
20
20
  ---
21
21
 
22
22
  ## Objective
23
- Governed remediation formulation under strict Ponytail Protocol bounds (<=35 add, <=25 del).
23
+ Formulate minimal, surgical code fixes bound by the Ponytail Protocol ($\le 35$ additions, $\le 25$ deletions), packaging unified diffs or semantic reflection patches into auditable remediation bundles ready for review.
24
24
 
25
- Supported CLI flags:
26
- - `npx torusguard harden [--target <dir>]` : Specify project root directory
27
- - `npx torusguard harden --dry-run` : Preview candidate patches without modifying disk files
28
- - `npx torusguard harden --severity <critical|high|medium|low>` : Filter findings by minimum severity floor
25
+ ---
26
+
27
+ ## Tri-Mode Execution
28
+
29
+ | Mode | Command / Tool | Execution Method |
30
+ | :--- | :--- | :--- |
31
+ | **Mode A: Terminal CLI** | `torusguard harden <candidate.patch \| patch.json>` | Shell validation of patch against Ponytail bounds. |
32
+ | **Mode B: AI Chat Slash** | `/torusguard harden` | Formulate semantic patch with Line-Level Reflection. |
33
+ | **Mode C: Native MCP Tool** | `torusguard_harden` | Automated validation of patch file or `find_snippet` / `replace_snippet`. |
29
34
 
30
35
  ---
31
36
 
32
37
  ## Mandatory Pre-Flight Context Inspection
33
38
 
34
39
  Inspect finding targets and patch constraints before generating diffs:
35
- 1. **Target Finding (`findings.md`):** Identify prioritized verified findings.
40
+ 1. **Target Finding (`security_report.md`):** Identify prioritized verified findings.
36
41
  2. **Ponytail Protocol:** Enforce hard limit ($\le 35$ additions, $\le 25$ deletions). Ban rewrites.
37
- 3. **Sensitive Path Review:** Flag changes touching `auth/` or `settings.py` for human sign-off.
42
+ 3. **Sensitive Path Review:** Flag changes touching `auth/` or credentials for explicit sign-off.
38
43
  4. **Behavior Preservation:** Ensure patch addresses flaw without breaking public APIs.
39
44
  5. **Dry-Run Rule:** Do NOT apply changes to disk during harden; emit bundle for review.
40
- 6. **Backup Readiness:** Ensure rollback procedures are prepared before staging patch.
41
-
42
- ---
43
-
44
- ## When to Use /torusguard harden
45
-
46
- | Trigger Scenario | Recommended Action |
47
- | :--- | :--- |
48
- | Formulating minimal patches for verified findings | Run `/torusguard harden` |
49
- | Packaging a 4-artifact remediation bundle for review | Run `/torusguard harden` |
50
- | Writing and applying changes to code files | Run `/torusguard apply` |
51
- | Differentially re-scanning code after patch application | Run `/torusguard recheck` |
52
- | Discovering new vulnerabilities | Run `/torusguard audit` |
45
+ 6. **Zero Bypasses:** Reject `# nosec`, `verify=False`, or `InsecureSkipVerify` under rule `TG-DIFF-001`.
53
46
 
54
47
  ---
55
48
 
@@ -57,30 +50,15 @@ Inspect finding targets and patch constraints before generating diffs:
57
50
  - Candidate patches transition findings in `security_report.md` into `CANDIDATE 🟡` status.
58
51
  - Every patch strictly conforms to Ponytail bounds (<= 35 additions, <= 25 deletions).
59
52
 
60
- ## Execution Steps
61
-
62
- 1. **Select Target Finding:** Choose verified flaw from active run directory.
63
- 2. **Examine Live Code Context:** Read surrounding lines (±15) of vulnerable sink.
64
- 3. **Draft Unified Diff:** Formulate minimal fix adhering to Ponytail Protocol limits.
65
- 4. **Audit Patch Safety:** Run `python .torusguard/scripts/diff_guard.py <patch.diff>`.
66
- 5. **Package 4-Artifact Bundle:** Write `patch.diff`, `plan.md`, `verification.md`, `rollback.md` to `.torusguard/runs/<run_id>/remediation/<finding_id>/`.
67
-
68
53
  ---
69
54
 
70
- ## Failure Recovery
71
-
72
- - **Line Churn Exceeded (>35 add or >25 del):** Decompose patch into smaller sequential sub-fixes.
73
- - **Sensitive Path Conflict:** Mark bundle with `Requires Sensitive-Path Sign-Off` in `plan.md`.
74
- - **Finding Not Found:** Ensure finding ID exists in active `findings.md`.
75
- - **Halt Trigger:** Abort if target source file cannot be read from disk.
76
-
77
- ---
78
-
79
- ## Hallucination Guard
55
+ ## Execution Steps
80
56
 
81
- - ❌ Never generate full-file replacements or unconstrained cosmetic code refactoring.
82
- - ❌ Never modify imports, variables, or functions unrelated to the vulnerability.
83
- - ✅ Always calculate addition and deletion line counts before emitting `patch.diff`.
57
+ 1. **Select Target Finding:** Choose verified flaw from `security_report.md`.
58
+ 2. **Examine Live Code Context:** Read surrounding lines ($\pm 3$) using bounded context extraction.
59
+ 3. **Formulate Minimal Semantic Patch:** Formulate `find_snippet` and `replace_snippet`.
60
+ 4. **Audit Patch Safety:** Run `torusguard harden` or call `torusguard_harden`.
61
+ 5. **Package Bundle:** Prepare candidate patch ready for the Human Gate.
84
62
 
85
63
  ---
86
64
 
@@ -89,10 +67,8 @@ Inspect finding targets and patch constraints before generating diffs:
89
67
  ```markdown
90
68
  ### 🛠️ TorusGuard Remediation Bundle
91
69
  - **Finding Target:** `TG-XXX-HASH` ([Vulnerability Name])
92
- - **File Affected:** `src/path/to/file.py`
70
+ - **File Affected:** `src/path/to/file`
93
71
  - **Line Churn:** +[Additions] / -[Deletions] (Ponytail: PASS)
94
- - **Sensitive Path:** [Yes (Sign-Off Needed) / No (Standard)]
95
- - **Bundle Path:** `.torusguard/runs/<run_id>/remediation/<finding_id>/`
96
72
  - **Status:** READY FOR REVIEW — run `/torusguard apply` to execute
97
73
  ```
98
74
 
@@ -100,5 +76,5 @@ Inspect finding targets and patch constraints before generating diffs:
100
76
 
101
77
  ## Next Steps
102
78
 
103
- 1. Review proposed diff in `.torusguard/runs/<run_id>/remediation/<finding_id>/patch.diff`.
104
- 2. Run `/torusguard apply` to execute the governed patch with automatic rollback backup.
79
+ 1. Review proposed diff or semantic reflection snippet.
80
+ 2. Run `/torusguard apply` or `torusguard apply` with Human Gate approval.
@@ -1,14 +1,15 @@
1
1
  ---
2
2
  description: Baseline project discovery, workspace scaffolding, stack detection, and framework-tailored security rule activation.
3
- tools: Read, Grep, Glob, Bash, Write
4
- version: 1.4.0
3
+ tools: Read, Grep, Glob, Bash, Write, run_command
4
+ version: 2.0.0
5
5
  agent: profiler
6
6
  lifecycle-phase: Phase 0 (Baseline Setup)
7
7
  required-skills:
8
8
  - torusguard-init
9
9
  scripts-binding:
10
- - .torusguard/scripts/report_sync.py
11
- - .torusguard/scripts/stack_detect.py
10
+ - internal/workspace/workspace.go
11
+ - cmd/torusguard/main.go
12
+ - cmd/torusguard/mcp.go
12
13
  ---
13
14
 
14
15
  # /torusguard init — Project Baseline & Workspace Initialization
@@ -18,71 +19,42 @@ $ARGUMENTS
18
19
  ---
19
20
 
20
21
  ## Objective
21
- Baseline project discovery, workspace scaffolding, stack detection, and security rule activation.
22
-
23
- Supported CLI flags:
24
- - `npx torusguard init [--target <dir>]` : Scaffold workspace into specified root directory
25
- - `npx torusguard init --template <golang|nextjs|fastapi|express|django|react>` : Guide stack configuration explicitly
26
- - `npx torusguard init --audit` : Run immediate baseline audit post-initialization
27
- - `npx torusguard init --force` : Force overwrite existing workspace and re-scaffold baseline
22
+ Baseline project discovery, workspace scaffolding across polyglot stacks, and activation of 74 canonical security rules across 18 families.
28
23
 
29
24
  ---
30
25
 
31
- ## Mandatory Pre-Flight Context Inspection
26
+ ## Tri-Mode Execution
32
27
 
33
- Inspect workspace state before running initialization:
34
- 1. **Config State (`.torusguard/config/torusguard.json`):** Check if workspace is already initialized. If active, prompt before re-writing.
35
- 2. **Project Manifests:** Check root for `package.json`, `manage.py`, `requirements.txt`, `pyproject.toml`, `go.mod`, or `Cargo.toml`.
36
- 3. **Disclosure Policy (`SECURITY.md`):** Check for existing responsible disclosure policy.
37
- 4. **Bootstrapper:** If `.torusguard/` is absent, invoke `python skills/torusguard/bootstrap.py` to unpack offline assets.
38
- 5. **Runtime Preconditions:** Ensure Python 3.10+ is available in the current execution shell.
28
+ | Mode | Command / Tool | Execution Method |
29
+ | :--- | :--- | :--- |
30
+ | **Mode A: Terminal CLI** | `torusguard init [--force] [--stack <name>]` | Terminal execution of workspace scaffolder. |
31
+ | **Mode B: AI Chat Slash** | `/torusguard init` | Conversational stack profiling and rule activation. |
32
+ | **Mode C: Native MCP Tool** | Administrative Command | Agents execute `torusguard init` via shell and monitor via `torusguard_status`. |
39
33
 
40
34
  ---
41
35
 
42
- ## When to Use /torusguard init
36
+ ## Mandatory Pre-Flight Context Inspection
43
37
 
44
- | Trigger Scenario | Recommended Command |
45
- | :--- | :--- |
46
- | First-time onboarding in any repository | Run `/torusguard init` |
47
- | Framework upgrade or major dependency changes | Run `/torusguard init` to refresh tailored rules |
48
- | Repository already configured | Run `/torusguard audit` |
49
- | Inspecting existing configuration | Run `/torusguard status` |
50
- | Testing legal boundaries | Run `/torusguard authorize` |
38
+ Inspect workspace state before running initialization:
39
+ 1. **Config State (`.torusguard/config/torusguard.json`):** Check if workspace is already initialized.
40
+ 2. **Project Manifests:** Check root for `package.json`, `go.mod`, `Cargo.toml`, `requirements.txt`, `pyproject.toml`.
41
+ 3. **Disclosure Policy (`SECURITY.md`):** Check for existing responsible disclosure policy.
51
42
 
52
43
  ---
53
44
 
54
45
  ## Living Report Invariant
55
- - Provisions baseline `security_report.md` single-source-of-truth ledger.
46
+ - Provisions baseline `SECURITY.md` responsible disclosure policy.
56
47
  - Activates tailored rules across 18 families based on detected stack.
57
48
 
58
- ## Execution Steps
59
-
60
- 1. **Scaffold Directory Topology:** Verify `.torusguard/` structure (`config/`, `rules/active/`, `runs/`, `scripts/`, `workflows/`, `templates/`, `schemas/`).
61
- 2. **Execute Stack Detection:**
62
- ```bash
63
- python .torusguard/scripts/stack_detect.py .
64
- ```
65
- 3. **Activate Tailored Rules:** Symlink or copy matching security rules from `.torusguard/rules/` into `.torusguard/rules/active/`.
66
- 4. **Write Configuration (`.torusguard/config/torusguard.json`):**
67
- Record detected stack, enabled rules count, timestamp, and runtime constraints.
68
- 5. **Verify Initialization:** Assert `.torusguard/config/torusguard.json` and `.torusguard/config/scope.json` exist.
69
-
70
49
  ---
71
50
 
72
- ## Failure Recovery
73
-
74
- - **Script Exit 1 (Detection Failed):** Check Python version (`python --version` >= 3.10) and verify read access to root manifests.
75
- - **Permission Error:** Verify write permissions for `.torusguard/config/` and `.torusguard/rules/active/`.
76
- - **Missing Directories:** Re-run directory scaffolding if any subfolder creation fails.
77
- - **Halt Condition:** If root directory is empty, halt and prompt user to open the project root.
78
-
79
- ---
80
-
81
- ## Hallucination Guard
51
+ ## Execution Steps
82
52
 
83
- - ❌ Never invent framework dependencies not present in `package.json` or `requirements.txt`.
84
- - ❌ Never overwrite an existing `.torusguard/config/scope.json` containing authorized domains.
85
- - ✅ Always execute `.torusguard/scripts/stack_detect.py` to ground detected technologies.
53
+ 1. **Scaffold Directory Topology:** Create `.torusguard/` structure (`config/`, `rules/active/`, `runs/`, `snapshots/`, `memory/`).
54
+ 2. **Detect Stack:** Automatically identify frameworks across 16+ polyglot languages.
55
+ 3. **Persist Configuration:** Write `.torusguard/config/torusguard.json`.
56
+ 4. **Provision Policy:** Generate baseline `SECURITY.md` at workspace root.
57
+ 5. **Recommend Audit:** Direct user to `/torusguard audit` or `torusguard audit`.
86
58
 
87
59
  ---
88
60
 
@@ -90,11 +62,10 @@ Inspect workspace state before running initialization:
90
62
 
91
63
  ```markdown
92
64
  ### 🛡️ TorusGuard Workspace Initialization
93
- - **Primary Framework:** [Detected Stack or None]
94
- - **Components:** [Backend / Frontend / Database]
95
- - **Active Rules:** [Count] rules enabled in `.torusguard/rules/active/`
65
+ - **Primary Framework:** [Detected Stack]
66
+ - **Active Rules:** 74 rules enabled across 18 families
96
67
  - **Config:** `.torusguard/config/torusguard.json` generated
97
- - **Scope Template:** `.torusguard/config/scope.json` ready
68
+ - **Policy:** `SECURITY.md` provisioned
98
69
  - **Status:** READY — run `/torusguard audit` to scan codebase
99
70
  ```
100
71
 
@@ -1,14 +1,15 @@
1
1
  ---
2
2
  description: TorusGuard Adaptive Security Memory Engine — view memory stats, export/import intelligence, apply TTL decay, and manage false positives.
3
- tools: Read, Grep, Glob, Bash
4
- version: 1.3.6
3
+ tools: Read, Grep, Glob, Bash, Write, run_command
4
+ version: 2.0.0
5
5
  agent: reviewer
6
6
  lifecycle-phase: Intelligence / Memory
7
7
  required-skills:
8
8
  - torusguard
9
9
  scripts-binding:
10
- - .torusguard/scripts/report_sync.py
11
- - .torusguard/scripts/memory_engine.py
10
+ - internal/memory/recipes.go
11
+ - cmd/torusguard/main.go
12
+ - cmd/torusguard/mcp.go
12
13
  ---
13
14
 
14
15
  # /torusguard memory — Adaptive Security Memory Engine & Intelligence Management
@@ -18,37 +19,31 @@ $ARGUMENTS
18
19
  ---
19
20
 
20
21
  ## Objective
21
- Inspect, manage, export, import, or compact persistent local security memory patterns, context window cards, and false positive suppressions.
22
+ Inspect, manage, export, import, or compact persistent local security memory patterns, context window cards, and Golden Fix Recipes.
22
23
 
23
24
  ---
24
25
 
25
- ## Subcommands & Usage
26
+ ## Tri-Mode Execution
26
27
 
27
- | Command | Action | Description |
28
+ | Mode | Command / Tool | Execution Method |
28
29
  | :--- | :--- | :--- |
29
- | `npx torusguard memory` | Status | Display memory stats, pattern count, and context token estimate |
30
- | `npx torusguard memory context` | Context Dump | Output the active pre-computed context window cards |
31
- | `npx torusguard memory fp --rule <RULE_ID>` | False Positive | Suppress rule as false positive across future scans |
32
- | `npx torusguard memory decay [--ttl 90]` | TTL Decay | Apply confidence decay to stale, unconfirmed patterns |
33
- | `npx torusguard memory export --path <FILE>` | Export | Export memory bundle for team sharing |
34
- | `npx torusguard memory import --path <FILE>` | Import | Merge external memory bundle into local project intelligence |
35
- | `npx torusguard memory compact` | Compaction | Archive raw events older than 30 days into single archive |
30
+ | **Mode A: Terminal CLI** | `torusguard recipes [list \| show \| export]` | Terminal management of Golden Fix Recipes. |
31
+ | **Mode B: AI Chat Slash** | `/torusguard recipes` | Interactive exploration of verified remediation patterns. |
32
+ | **Mode C: Native MCP Tool** | `torusguard://rules_catalog` | Programmatic access to catalog rules and distilled patterns. |
36
33
 
37
34
  ---
38
35
 
39
- ## Execution Steps
36
+ ## Subcommands & Usage
40
37
 
41
- 1. **Verify Memory Subsystem:** Confirm `.torusguard/memory/` exists and is shielded by `.gitignore`.
42
- 2. **Execute Requested Action:** Invoke `.torusguard/scripts/memory_engine.py` with appropriate action flag:
43
- ```bash
44
- python .torusguard/scripts/memory_engine.py --action status
45
- ```
46
- 3. **Verify Context Token Budget:** Confirm `context.json` remains within token budget ($\le 2,000$ tokens).
47
- 4. **Display Intelligence Card:** Render summary card to user.
38
+ | Command | Action | Description |
39
+ | :--- | :--- | :--- |
40
+ | `torusguard recipes` | List | Display Golden Fix recipes library |
41
+ | `torusguard recipes list` | Catalog | Enumerate verified fix patterns |
42
+ | `torusguard recipes export` | Export | Export memory bundle for team sharing |
48
43
 
49
44
  ---
50
45
 
51
46
  ## Privacy & Security Invariants
52
47
  - Memory files remain strictly local under `.torusguard/memory/` and are always gitignored.
53
- - Memory files are never packaged into npm release tarballs.
48
+ - Memory files are never packaged into release tarballs.
54
49
  - Export operations only occur when explicitly invoked by user command.