torusguard 1.3.5 → 1.4.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 (194) hide show
  1. package/.torusguard/.manifest.json +37 -36
  2. package/.torusguard/runs/report-latest.html +5862 -315
  3. package/.torusguard/runs/results-latest.sarif +20 -0
  4. package/.torusguard/runs/run-20260918-104221-audit/findings.json +1 -0
  5. package/.torusguard/runs/run-20260918-104221-audit/findings.md +8 -0
  6. package/.torusguard/runs/run-20260918-104221-audit/manifest.json +12 -0
  7. package/.torusguard/runs/run-20260918-104221-audit/summary.md +5 -0
  8. package/.torusguard/runs/run-20260918-104236-audit/findings.json +2314 -0
  9. package/.torusguard/runs/run-20260918-104236-audit/findings.md +960 -0
  10. package/.torusguard/runs/run-20260918-104236-audit/manifest.json +12 -0
  11. package/.torusguard/runs/run-20260918-104236-audit/summary.md +5 -0
  12. package/.torusguard/runs/run-20260918-105723-audit/findings.json +2382 -0
  13. package/.torusguard/runs/run-20260918-105723-audit/findings.md +960 -0
  14. package/.torusguard/runs/run-20260918-105723-audit/manifest.json +12 -0
  15. package/.torusguard/runs/run-20260918-105723-audit/summary.md +5 -0
  16. package/.torusguard/runs/run-20260918-105731-audit/findings.json +1 -0
  17. package/.torusguard/runs/run-20260918-105731-audit/findings.md +8 -0
  18. package/.torusguard/runs/run-20260918-105731-audit/manifest.json +12 -0
  19. package/.torusguard/runs/run-20260918-105731-audit/summary.md +5 -0
  20. package/.torusguard/runs/run-20260918-105940-audit/findings.json +1 -0
  21. package/.torusguard/runs/run-20260918-105940-audit/findings.md +8 -0
  22. package/.torusguard/runs/run-20260918-105940-audit/manifest.json +13 -0
  23. package/.torusguard/runs/run-20260918-105940-audit/remediation.md +7 -0
  24. package/.torusguard/runs/run-20260918-105940-audit/summary.md +5 -0
  25. package/.torusguard/runs/run-20260919-145701-audit/findings.json +1 -0
  26. package/.torusguard/runs/run-20260919-145701-audit/findings.md +8 -0
  27. package/.torusguard/runs/run-20260919-145701-audit/manifest.json +12 -0
  28. package/.torusguard/runs/run-20260919-145701-audit/summary.md +5 -0
  29. package/.torusguard/runs/run-20260919-151729-audit/findings.json +1 -0
  30. package/.torusguard/runs/run-20260919-151729-audit/findings.md +8 -0
  31. package/.torusguard/runs/run-20260919-151729-audit/manifest.json +13 -0
  32. package/.torusguard/runs/run-20260919-151729-audit/remediation.md +7 -0
  33. package/.torusguard/runs/run-20260919-151729-audit/summary.md +5 -0
  34. package/.torusguard/runs/run-20260919-152340-audit/findings.json +1 -0
  35. package/.torusguard/runs/run-20260919-152340-audit/findings.md +8 -0
  36. package/.torusguard/runs/run-20260919-152340-audit/manifest.json +12 -0
  37. package/.torusguard/runs/run-20260919-152340-audit/summary.md +5 -0
  38. package/.torusguard/runs/run-20260919-152345-audit/findings.json +1 -0
  39. package/.torusguard/runs/run-20260919-152345-audit/findings.md +8 -0
  40. package/.torusguard/runs/run-20260919-152345-audit/manifest.json +12 -0
  41. package/.torusguard/runs/run-20260919-152345-audit/summary.md +5 -0
  42. package/.torusguard/runs/run-20260919-153500-audit/findings.json +1 -0
  43. package/.torusguard/runs/run-20260919-153500-audit/findings.md +8 -0
  44. package/.torusguard/runs/run-20260919-153500-audit/manifest.json +12 -0
  45. package/.torusguard/runs/run-20260919-153500-audit/summary.md +5 -0
  46. package/.torusguard/scripts/__pycache__/apply_runner.cpython-314.pyc +0 -0
  47. package/.torusguard/scripts/__pycache__/audit_runner.cpython-314.pyc +0 -0
  48. package/.torusguard/scripts/__pycache__/diff_guard.cpython-314.pyc +0 -0
  49. package/.torusguard/scripts/__pycache__/finding_scorer.cpython-314.pyc +0 -0
  50. package/.torusguard/scripts/__pycache__/harden_runner.cpython-314.pyc +0 -0
  51. package/.torusguard/scripts/__pycache__/html_reporter.cpython-314.pyc +0 -0
  52. package/.torusguard/scripts/__pycache__/manifest_builder.cpython-314.pyc +0 -0
  53. package/.torusguard/scripts/__pycache__/memory_engine.cpython-314.pyc +0 -0
  54. package/.torusguard/scripts/__pycache__/monorepo_detector.cpython-314.pyc +0 -0
  55. package/.torusguard/scripts/__pycache__/recheck_runner.cpython-314.pyc +0 -0
  56. package/.torusguard/scripts/__pycache__/recipes_runner.cpython-314.pyc +0 -0
  57. package/.torusguard/scripts/__pycache__/report_sync.cpython-314.pyc +0 -0
  58. package/.torusguard/scripts/__pycache__/run_manager.cpython-314.pyc +0 -0
  59. package/.torusguard/scripts/__pycache__/sarif_exporter.cpython-314.pyc +0 -0
  60. package/.torusguard/scripts/__pycache__/stack_detect.cpython-314.pyc +0 -0
  61. package/.torusguard/scripts/__pycache__/term_ui.cpython-314.pyc +0 -0
  62. package/.torusguard/scripts/apply_runner.py +108 -9
  63. package/.torusguard/scripts/audit_runner.py +336 -24
  64. package/.torusguard/scripts/harden_runner.py +124 -70
  65. package/.torusguard/scripts/html_reporter.py +3585 -648
  66. package/.torusguard/scripts/manifest_builder.py +2 -0
  67. package/.torusguard/scripts/recheck_runner.py +5 -4
  68. package/.torusguard/scripts/recipes_runner.py +91 -8
  69. package/.torusguard/scripts/report_sync.py +496 -73
  70. package/.torusguard/scripts/sarif_exporter.py +48 -8
  71. package/.torusguard/scripts/stack_detect.py +44 -2
  72. package/.torusguard/scripts/status_runner.py +267 -0
  73. package/.torusguard/scripts/term_ui.py +1 -1
  74. package/.torusguard/skills/torusguard/SKILL.md +75 -72
  75. package/.torusguard/skills/torusguard-apply/SKILL.md +84 -80
  76. package/.torusguard/skills/torusguard-audit/SKILL.md +87 -83
  77. package/.torusguard/skills/torusguard-authorize/SKILL.md +7 -2
  78. package/.torusguard/skills/torusguard-exploit-check/SKILL.md +7 -2
  79. package/.torusguard/skills/torusguard-full/SKILL.md +7 -2
  80. package/.torusguard/skills/torusguard-harden/SKILL.md +98 -94
  81. package/.torusguard/skills/torusguard-init/SKILL.md +68 -64
  82. package/.torusguard/skills/torusguard-recheck/SKILL.md +81 -77
  83. package/.torusguard/skills/torusguard-report/SKILL.md +93 -72
  84. package/.torusguard/skills/torusguard-status/SKILL.md +62 -58
  85. package/.torusguard/skills/torusguard-verify/SKILL.md +7 -2
  86. package/.torusguard/skills/torusguard-web-validate/SKILL.md +7 -2
  87. package/.torusguard/workflows/apply.md +1 -1
  88. package/.torusguard/workflows/audit.md +1 -1
  89. package/.torusguard/workflows/authorize.md +1 -1
  90. package/.torusguard/workflows/exploit-check.md +1 -1
  91. package/.torusguard/workflows/harden.md +1 -1
  92. package/.torusguard/workflows/init.md +1 -1
  93. package/.torusguard/workflows/memory.md +1 -1
  94. package/.torusguard/workflows/recheck.md +1 -1
  95. package/.torusguard/workflows/report.md +1 -1
  96. package/.torusguard/workflows/status.md +1 -1
  97. package/.torusguard/workflows/verify.md +1 -1
  98. package/.torusguard/workflows/web-validate.md +1 -1
  99. package/README.md +115 -81
  100. package/bin/torusguard.js +244 -38
  101. package/package.json +6 -2
  102. package/skills/torusguard/SKILL.md +1 -1
  103. package/skills/torusguard/__pycache__/bootstrap.cpython-314.pyc +0 -0
  104. package/skills/torusguard/bootstrap.py +52 -8
  105. package/skills/torusguard/payload/.manifest.json +51 -36
  106. package/skills/torusguard/payload/scripts/__pycache__/apply_runner.cpython-314.pyc +0 -0
  107. package/skills/torusguard/payload/scripts/__pycache__/audit_runner.cpython-311.pyc +0 -0
  108. package/skills/torusguard/payload/scripts/__pycache__/audit_runner.cpython-314.pyc +0 -0
  109. package/skills/torusguard/payload/scripts/__pycache__/diff_guard.cpython-311.pyc +0 -0
  110. package/skills/torusguard/payload/scripts/__pycache__/diff_guard.cpython-314.pyc +0 -0
  111. package/skills/torusguard/payload/scripts/__pycache__/finding_scorer.cpython-311.pyc +0 -0
  112. package/skills/torusguard/payload/scripts/__pycache__/finding_scorer.cpython-314.pyc +0 -0
  113. package/skills/torusguard/payload/scripts/__pycache__/harden_runner.cpython-314.pyc +0 -0
  114. package/skills/torusguard/payload/scripts/__pycache__/html_reporter.cpython-311.pyc +0 -0
  115. package/skills/torusguard/payload/scripts/__pycache__/html_reporter.cpython-314.pyc +0 -0
  116. package/skills/torusguard/payload/scripts/__pycache__/manifest_builder.cpython-314.pyc +0 -0
  117. package/skills/torusguard/payload/scripts/__pycache__/memory_engine.cpython-311.pyc +0 -0
  118. package/skills/torusguard/payload/scripts/__pycache__/memory_engine.cpython-314.pyc +0 -0
  119. package/skills/torusguard/payload/scripts/__pycache__/monorepo_detector.cpython-311.pyc +0 -0
  120. package/skills/torusguard/payload/scripts/__pycache__/monorepo_detector.cpython-314.pyc +0 -0
  121. package/skills/torusguard/payload/scripts/__pycache__/recheck_runner.cpython-314.pyc +0 -0
  122. package/skills/torusguard/payload/scripts/__pycache__/report_sync.cpython-311.pyc +0 -0
  123. package/skills/torusguard/payload/scripts/__pycache__/report_sync.cpython-314.pyc +0 -0
  124. package/skills/torusguard/payload/scripts/__pycache__/rules_sync.cpython-311.pyc +0 -0
  125. package/skills/torusguard/payload/scripts/__pycache__/run_manager.cpython-311.pyc +0 -0
  126. package/skills/torusguard/payload/scripts/__pycache__/run_manager.cpython-314.pyc +0 -0
  127. package/skills/torusguard/payload/scripts/__pycache__/sarif_exporter.cpython-314.pyc +0 -0
  128. package/skills/torusguard/payload/scripts/__pycache__/stack_detect.cpython-311.pyc +0 -0
  129. package/skills/torusguard/payload/scripts/__pycache__/stack_detect.cpython-314.pyc +0 -0
  130. package/skills/torusguard/payload/scripts/__pycache__/term_ui.cpython-311.pyc +0 -0
  131. package/skills/torusguard/payload/scripts/__pycache__/term_ui.cpython-314.pyc +0 -0
  132. package/skills/torusguard/payload/scripts/apply_runner.py +108 -9
  133. package/skills/torusguard/payload/scripts/audit_runner.py +336 -24
  134. package/skills/torusguard/payload/scripts/harden_runner.py +124 -70
  135. package/skills/torusguard/payload/scripts/html_reporter.py +3585 -648
  136. package/skills/torusguard/payload/scripts/manifest_builder.py +2 -0
  137. package/skills/torusguard/payload/scripts/recheck_runner.py +5 -4
  138. package/skills/torusguard/payload/scripts/recipes_runner.py +91 -8
  139. package/skills/torusguard/payload/scripts/report_sync.py +496 -73
  140. package/skills/torusguard/payload/scripts/sarif_exporter.py +48 -8
  141. package/skills/torusguard/payload/scripts/stack_detect.py +44 -2
  142. package/skills/torusguard/payload/scripts/status_runner.py +267 -0
  143. package/skills/torusguard/payload/scripts/term_ui.py +1 -1
  144. package/skills/torusguard/payload/skills/torusguard/SKILL.md +1 -1
  145. package/skills/torusguard/payload/skills/torusguard-apply/SKILL.md +1 -1
  146. package/skills/torusguard/payload/skills/torusguard-audit/SKILL.md +1 -1
  147. package/skills/torusguard/payload/skills/torusguard-authorize/SKILL.md +1 -1
  148. package/skills/torusguard/payload/skills/torusguard-exploit-check/SKILL.md +1 -1
  149. package/skills/torusguard/payload/skills/torusguard-full/SKILL.md +1 -1
  150. package/skills/torusguard/payload/skills/torusguard-harden/SKILL.md +1 -1
  151. package/skills/torusguard/payload/skills/torusguard-init/SKILL.md +1 -1
  152. package/skills/torusguard/payload/skills/torusguard-recheck/SKILL.md +1 -1
  153. package/skills/torusguard/payload/skills/torusguard-report/SKILL.md +40 -23
  154. package/skills/torusguard/payload/skills/torusguard-status/SKILL.md +1 -1
  155. package/skills/torusguard/payload/skills/torusguard-verify/SKILL.md +1 -1
  156. package/skills/torusguard/payload/skills/torusguard-web-validate/SKILL.md +1 -1
  157. package/skills/torusguard/payload/workflows/apply.md +9 -1
  158. package/skills/torusguard/payload/workflows/audit.md +8 -2
  159. package/skills/torusguard/payload/workflows/authorize.md +1 -1
  160. package/skills/torusguard/payload/workflows/exploit-check.md +1 -1
  161. package/skills/torusguard/payload/workflows/harden.md +6 -1
  162. package/skills/torusguard/payload/workflows/init.md +7 -1
  163. package/skills/torusguard/payload/workflows/memory.md +1 -1
  164. package/skills/torusguard/payload/workflows/recheck.md +1 -1
  165. package/skills/torusguard/payload/workflows/recipes.md +55 -0
  166. package/skills/torusguard/payload/workflows/report.md +59 -55
  167. package/skills/torusguard/payload/workflows/status.md +4 -1
  168. package/skills/torusguard/payload/workflows/torusguard-apply.md +110 -0
  169. package/skills/torusguard/payload/workflows/torusguard-audit.md +105 -0
  170. package/skills/torusguard/payload/workflows/torusguard-authorize.md +96 -0
  171. package/skills/torusguard/payload/workflows/torusguard-exploit-check.md +98 -0
  172. package/skills/torusguard/payload/workflows/torusguard-harden.md +104 -0
  173. package/skills/torusguard/payload/workflows/torusguard-init.md +106 -0
  174. package/skills/torusguard/payload/workflows/torusguard-recheck.md +101 -0
  175. package/skills/torusguard/payload/workflows/torusguard-recipes.md +55 -0
  176. package/skills/torusguard/payload/workflows/torusguard-report.md +105 -0
  177. package/skills/torusguard/payload/workflows/torusguard-status.md +103 -0
  178. package/skills/torusguard/payload/workflows/torusguard-verify.md +100 -0
  179. package/skills/torusguard/payload/workflows/torusguard-web-validate.md +96 -0
  180. package/skills/torusguard/payload/workflows/torusguard.md +19 -0
  181. package/skills/torusguard/payload/workflows/verify.md +1 -1
  182. package/skills/torusguard/payload/workflows/web-validate.md +1 -1
  183. package/skills/torusguard-apply/SKILL.md +1 -1
  184. package/skills/torusguard-audit/SKILL.md +1 -1
  185. package/skills/torusguard-authorize/SKILL.md +1 -1
  186. package/skills/torusguard-exploit-check/SKILL.md +1 -1
  187. package/skills/torusguard-full/SKILL.md +1 -1
  188. package/skills/torusguard-harden/SKILL.md +1 -1
  189. package/skills/torusguard-init/SKILL.md +1 -1
  190. package/skills/torusguard-recheck/SKILL.md +1 -1
  191. package/skills/torusguard-report/SKILL.md +40 -23
  192. package/skills/torusguard-status/SKILL.md +1 -1
  193. package/skills/torusguard-verify/SKILL.md +1 -1
  194. package/skills/torusguard-web-validate/SKILL.md +1 -1
@@ -0,0 +1,103 @@
1
+ ---
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: 1.4.0
5
+ agent: reviewer
6
+ lifecycle-phase: System / Diagnostics
7
+ required-skills:
8
+ - torusguard-status
9
+ scripts-binding:
10
+ - .torusguard/scripts/report_sync.py
11
+ - .torusguard/scripts/run_manager.py
12
+ ---
13
+
14
+ # /torusguard status — Workspace Security Posture & Diagnostic Overview
15
+
16
+ $ARGUMENTS
17
+
18
+ ---
19
+
20
+ ## Objective
21
+ Read-only diagnostic overview of workspace security posture, active configuration, and run history.
22
+
23
+ Supported CLI flags:
24
+ - `npx torusguard status [--target <dir>]` : Diagnostic check on specified project directory
25
+
26
+ ---
27
+
28
+ ## Mandatory Pre-Flight Context Inspection
29
+
30
+ Inspect workspace state and configuration records prior to status display:
31
+ 1. **Config State (`.torusguard/config/torusguard.json`):** Confirm workspace initialization and read detected stack.
32
+ 2. **Active Rules Directory (`.torusguard/rules/active/`):** Count active rule files.
33
+ 3. **Run Folder Ledger (`.torusguard/runs/`):** Check run history and locate latest `manifest.json`.
34
+ 4. **Scope Record (`.torusguard/config/scope.json`):** Check whether runtime authorization TTL is active or expired.
35
+ 5. **Read-Only Invariant:** Ensure command performs zero file modifications or disk mutations.
36
+
37
+ ---
38
+
39
+ ## When to Use /torusguard status
40
+
41
+ | Trigger Scenario | Recommended Action |
42
+ | :--- | :--- |
43
+ | Checking workspace configuration and active security posture | Run `/torusguard status` |
44
+ | Reviewing recent audit runs and finding counts | Run `/torusguard status` |
45
+ | Checking active legal scope authorization TTL | Run `/torusguard status` |
46
+ | Initializing workspace for the first time | Run `/torusguard init` |
47
+ | Executing full security scan | Run `/torusguard audit` |
48
+
49
+ ---
50
+
51
+ ## Living Report Invariant
52
+ - Reads current health score and status breakdown directly from `security_report.md`.
53
+ - Displays 18 rule families and 74 rules in standardized 75-column terminal cards.
54
+
55
+ ## Execution Steps
56
+
57
+ 1. **Read Configuration:** Load `.torusguard/config/torusguard.json`; extract stack, version, and enabled rule count.
58
+ 2. **Enumerate Active Rules:** Count rule files physically present in `.torusguard/rules/active/`.
59
+ 3. **Inspect Run History:**
60
+ ```bash
61
+ python .torusguard/scripts/run_manager.py list
62
+ ```
63
+ 4. **Evaluate Scope Expiry:** Parse `.torusguard/config/scope.json`; report if TTL is valid or expired.
64
+ 5. **Print Status Overview:** Render complete workspace diagnostic overview card.
65
+
66
+ ---
67
+
68
+ ## Failure Recovery
69
+
70
+ - **Uninitialized Workspace:** If config is missing, prompt user to execute `/torusguard init`.
71
+ - **Zero Runs Found:** Display clean status card noting no historical audit runs exist yet.
72
+ - **Corrupt Config File:** Report parsing error and recommend re-running `/torusguard init`.
73
+ - **Halt Trigger:** Abort command if read access to `.torusguard/` is denied.
74
+
75
+ ---
76
+
77
+ ## Hallucination Guard
78
+
79
+ - ❌ Never display fabricated finding counts not substantiated by run manifests.
80
+ - ❌ Never execute modifying shell commands or edit source code during status inspection.
81
+ - ✅ Always report factual file counts from `.torusguard/rules/active/` and `.torusguard/runs/`.
82
+
83
+ ---
84
+
85
+ ## Output Card Format
86
+
87
+ ```markdown
88
+ ### 🛡️ TorusGuard Workspace Status
89
+ - **Version:** v0.9.2
90
+ - **Framework Detected:** [Stack or None]
91
+ - **Active Rules:** [Count] rules active in `.torusguard/rules/active/`
92
+ - **Total Runs:** [Count] historical runs recorded
93
+ - **Latest Run:** `run-YYYYMMDD-HHMMSS` ([Findings Count] findings)
94
+ - **Scope Status:** [Authorized (TTL Active) / Expired / Unconfigured]
95
+ - **Health Posture:** [GOOD / ACTION NEEDED]
96
+ ```
97
+
98
+ ---
99
+
100
+ ## Next Steps
101
+
102
+ 1. Run `/torusguard audit` to scan codebase for security vulnerabilities.
103
+ 2. Run `/torusguard authorize` to configure or refresh live target scope.
@@ -0,0 +1,100 @@
1
+ ---
2
+ description: Evidence sufficiency verification, live disk line match audit, and finding score refinement.
3
+ tools: Read, Grep, Glob, Bash, Write
4
+ version: 1.3.6
5
+ agent: validator
6
+ lifecycle-phase: Phase 3a (Evidence Verification)
7
+ required-skills:
8
+ - torusguard-verify
9
+ scripts-binding:
10
+ - .torusguard/scripts/report_sync.py
11
+ - .torusguard/scripts/finding_scorer.py
12
+ ---
13
+
14
+ # /torusguard verify — Evidence Verification & Score Refinement
15
+
16
+ $ARGUMENTS
17
+
18
+ ---
19
+
20
+ ## Objective
21
+ Evidence sufficiency verification, live disk line match audit, and finding score refinement.
22
+
23
+ ---
24
+
25
+ ## Mandatory Pre-Flight Context Inspection
26
+
27
+ Inspect finding records and evidence integrity before verification:
28
+ 1. **Latest Run Records (`.torusguard/runs/`):** Locate most recent audit run directory.
29
+ 2. **Finding Files:** Confirm `findings.md` or `findings.json` exists in the target run folder.
30
+ 3. **Live File Drift:** Assert cited source files have not been edited or relocated on disk.
31
+ 4. **Scoring Model Calibration:** Ensure `finding_scorer.py` evaluates all 5 rubric dimensions.
32
+ 5. **Role Boundary:** Enforce validator role; do not apply code modifications during verification.
33
+
34
+ ---
35
+
36
+ ## When to Use /torusguard verify
37
+
38
+ | Trigger Scenario | Recommended Action |
39
+ | :--- | :--- |
40
+ | Auditing whether static findings are valid code flaws | Run `/torusguard verify` |
41
+ | Upgrading Medium confidence finding to Confirmed | Run `/torusguard verify` |
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` |
45
+
46
+ ---
47
+
48
+ ## Living Report Invariant
49
+ - Confirmed evidence sufficiency transitions findings in `security_report.md` to `VERIFIED 🟠`.
50
+ - False positives transition to `FALSE POSITIVE ⚪`.
51
+
52
+ ## Execution Steps
53
+
54
+ 1. **Locate Target Findings:** Load active findings from latest run directory.
55
+ 2. **Live Disk Line Match:** Read current code at cited line ranges; verify AST snippet matches.
56
+ 3. **Audit Evidence Sufficiency:** Assess whether taint path is unbroken and caller context is exposed.
57
+ 4. **Refine Confidence Scores:**
58
+ ```bash
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`.
80
+
81
+ ---
82
+
83
+ ## Output Card Format
84
+
85
+ ```markdown
86
+ ### 🧪 TorusGuard Evidence Verification
87
+ - **Run ID:** `run-YYYYMMDD-HHMMSS-audit`
88
+ - **Findings Evaluated:** [Count] findings
89
+ - **Confirmed Real:** [Count] verified flaws
90
+ - **Downgraded / False Positives:** [Count] filtered out
91
+ - **Refined Mean Score:** [Score]/100
92
+ - **Ledger:** `.torusguard/runs/<run_id>/verified-evidence.md`
93
+ ```
94
+
95
+ ---
96
+
97
+ ## Next Steps
98
+
99
+ 1. Run `/torusguard web-validate` if live endpoint probing is required.
100
+ 2. Run `/torusguard harden` to build surgical patch bundles for verified flaws.
@@ -0,0 +1,96 @@
1
+ ---
2
+ description: Authorized HTTP probing, token redaction, transparent audit header injection, and replay trace capture.
3
+ tools: Read, Grep, Glob, Bash, Write
4
+ version: 1.3.6
5
+ agent: validator
6
+ lifecycle-phase: Phase 3b (Runtime Web Validation)
7
+ required-skills:
8
+ - torusguard-web-validate
9
+ scripts-binding:
10
+ - .torusguard/scripts/report_sync.py
11
+ - .torusguard/scripts/safety_gate.py
12
+ ---
13
+
14
+ # /torusguard web-validate — Bounded HTTP Probing & Session Capture
15
+
16
+ $ARGUMENTS
17
+
18
+ ---
19
+
20
+ ## Objective
21
+ Authorized HTTP probing, token redaction, transparent audit header injection, and replay capture.
22
+
23
+ ---
24
+
25
+ ## Mandatory Pre-Flight Context Inspection
26
+
27
+ Inspect authorization parameters and safety limits before sending HTTP requests:
28
+ 1. **Active Scope (`.torusguard/config/scope.json`):** Assert target host and path are authorized with valid TTL.
29
+ 2. **Safety Gate Classification:** Test proposed endpoint against `.torusguard/scripts/safety_gate.py`.
30
+ 3. **Sensitive Route Guard:** Ensure destructive endpoints (`DELETE`, account drops) are never called automatically.
31
+ 4. **Token Redaction Pipeline:** Ensure bearer tokens and session cookies are masked (`Bearer [REDACTED]`).
32
+ 5. **Request Budget:** Enforce maximum cap of 50 requests per validation session.
33
+
34
+ ---
35
+
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
+ ## Execution Steps
49
+
50
+ 1. **Verify Legal Scope:** Check target URL against `.torusguard/config/scope.json`.
51
+ 2. **Invoke Safety Gate:**
52
+ ```bash
53
+ python .torusguard/scripts/safety_gate.py check --url <target_url> --method GET
54
+ ```
55
+ 3. **Dispatch Non-Destructive Probe:** Send bounded HTTP request with audit header `X-TorusGuard-AuthID`.
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`).
76
+
77
+ ---
78
+
79
+ ## Output Card Format
80
+
81
+ ```markdown
82
+ ### 🌐 TorusGuard Web Validation
83
+ - **Target Host:** [Host URL]
84
+ - **Endpoints Probed:** [Count] routes tested
85
+ - **Security Headers:** [CSP / HSTS / CORS status]
86
+ - **Cookie Security:** [HttpOnly / Secure / SameSite status]
87
+ - **Replay Trace:** `.torusguard/runs/<run_id>/replay.json`
88
+ - **Status:** COMPLETED — non-destructive probe finished
89
+ ```
90
+
91
+ ---
92
+
93
+ ## Next Steps
94
+
95
+ 1. Run `/torusguard exploit-check` to confirm if reachable flaws constitute verified exploits.
96
+ 2. Run `/torusguard harden` to build surgical remediation diffs.
@@ -0,0 +1,19 @@
1
+ ---
2
+ description: TorusGuard Autonomous Security Command Engine — run static security audits, authorized runtime web validation, governed remediation, and SARIF exports.
3
+ version: 1.3.6
4
+ tools: Read, Grep, Glob, Bash, Edit, Write
5
+ agent: auditor
6
+ ---
7
+
8
+ # /torusguard — Autonomous Application Security Guardrails
9
+
10
+ $ARGUMENTS
11
+
12
+ ## Objective
13
+ Execute TorusGuard security workflows across polyglot codebases (Python, TypeScript, Go, Rust, Java, C#, PHP, and 16+ ecosystems) using either AI chat slash commands or dedicated terminal CLI commands.
14
+
15
+ ## Execution
16
+ Parse the requested action from `$ARGUMENTS` (e.g. `audit`, `verify`, `web-validate`, `exploit-check`, `harden`, `apply`, `rollback`, `recheck`, `recipes`, `report`, `status`, `init`):
17
+ 1. **If action is omitted or 'status':** View `.torusguard/workflows/status.md` and report posture (or run `npx torusguard status`).
18
+ 2. **If action is specified:** Load the dedicated workflow from `.torusguard/workflows/<action>.md` and matching skill from `skills/torusguard-<action>/SKILL.md` (or run equivalent CLI command: `npx torusguard <action>`).
19
+ 3. Follow the phase execution steps defined in the workflow.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  description: Evidence sufficiency verification, live disk line match audit, and finding score refinement.
3
3
  tools: Read, Grep, Glob, Bash, Write
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  agent: validator
6
6
  lifecycle-phase: Phase 3a (Evidence Verification)
7
7
  required-skills:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  description: Authorized HTTP probing, token redaction, transparent audit header injection, and replay trace capture.
3
3
  tools: Read, Grep, Glob, Bash, Write
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  agent: validator
6
6
  lifecycle-phase: Phase 3b (Runtime Web Validation)
7
7
  required-skills:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: torusguard-apply
3
3
  description: Apply governed remediation patches to disk with pre-apply rollback snapshots and Human Gate validation via CLI or AI Agent.
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  workflow: .torusguard/workflows/apply.md
6
6
  tools: Read, Grep, Glob, Write, replace_file_content, run_command
7
7
  scripts-binding:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: torusguard-audit
3
3
  description: Static AST security scanning, line-shift invariant fingerprinting, root-cause clustering, and 0-100 confidence scoring via CLI or AI Agent.
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  workflow: .torusguard/workflows/audit.md
6
6
  tools: Read, Grep, Glob, Write, run_command
7
7
  scripts-binding:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: torusguard-authorize
3
3
  description: Register and validate runtime target authorization boundaries — scope boundaries, ownership proofs, TTL expiration, and Safety Gate enforcement.
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  workflow: .torusguard/workflows/authorize.md
6
6
  tools: Read, Grep, Glob, Write, run_command
7
7
  scripts-binding:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: torusguard-exploit-check
3
3
  description: Safe, non-destructive confirmation of exploitability using inert canary tokens and sentinels.
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  workflow: .torusguard/workflows/exploit-check.md
6
6
  tools: Read, Grep, Glob, Bash, Write, run_command
7
7
  scripts-binding:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: torusguard-full
3
3
  description: Master 7-stage security pipeline orchestrator — coordinates discovery, authorization, static audit, runtime validation, governed remediation, recheck, and reporting.
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  workflow: .torusguard/workflows/audit.md
6
6
  tools: Read, Grep, Glob, Bash, Edit, Write, run_command
7
7
  scripts-binding:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: torusguard-harden
3
3
  description: Package surgical remediation bundles conforming to the Ponytail Protocol (<= 35 additions, <= 25 deletions) via CLI or AI Agent.
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  workflow: .torusguard/workflows/harden.md
6
6
  tools: Read, Grep, Glob, Write, run_command
7
7
  scripts-binding:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: torusguard-init
3
3
  description: Initialize TorusGuard workspace — detect project stack, activate tailored TG-* security rules, and generate SECURITY.md baseline via CLI or AI Agent.
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  workflow: .torusguard/workflows/init.md
6
6
  tools: Read, Grep, Glob, Write, run_command
7
7
  scripts-binding:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: torusguard-recheck
3
3
  description: Execute targeted differential AST re-scan against modified files, verify fix closure, and assert zero regressions via CLI or AI Agent.
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  workflow: .torusguard/workflows/recheck.md
6
6
  tools: Read, Grep, Glob, Write, run_command
7
7
  scripts-binding:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: torusguard-report
3
3
  description: Generate executive posture reports, export OASIS SARIF v2.1.0 logs, and render dark-mode HTML dashboards via CLI or AI Agent.
4
- version: 1.3.5
4
+ version: 2.2.0
5
5
  workflow: .torusguard/workflows/report.md
6
6
  tools: Read, Grep, Glob, Write, run_command
7
7
  scripts-binding:
@@ -15,61 +15,78 @@ scripts-binding:
15
15
  # TorusGuard Report — Posture Reporting & SARIF / HTML Export
16
16
 
17
17
  ## Objective
18
- Aggregate findings, verification traces, and recheck results into an auditable executive security report, export schema-compliant OASIS SARIF v2.1.0 logs for CI/CD pipelines, and render zero-dependency single-file visual HTML posture reports.
18
+ Aggregate findings, verification traces, and recheck results into an auditable executive security report, export schema-compliant OASIS SARIF v2.1.0 logs for CI/CD pipelines, and render zero-dependency single-file visual HTML posture reports with full dual-mode parity.
19
19
 
20
20
  ---
21
21
 
22
- ## Two Execution Modes
22
+ ## Execution Steps
23
23
 
24
24
  ### Mode A: Automated CLI Execution
25
25
  Run the report engine from your terminal:
26
26
  ```bash
27
- # Generate visual dark-mode HTML dashboard
27
+ # Generate visual dark-mode HTML dashboard (defaults to report.html at project root)
28
28
  npx torusguard report --html
29
29
 
30
30
  # Export OASIS SARIF v2.1.0 for GitHub Code Scanning / CI
31
31
  npx torusguard report --sarif
32
32
 
33
- # Generate both HTML and SARIF for latest run
33
+ # Generate both HTML and SARIF in a single pass
34
34
  npx torusguard report --html --sarif
35
35
 
36
- # Generate report for a specific project directory
37
- npx torusguard report ./examples/vulnerable-react-express --html
36
+ # Custom HTML output location
37
+ npx torusguard report --html --out ./docs/security-audit.html
38
38
 
39
- # Target a specific run ID
40
- npx torusguard report --run run-20260910-121618-audit --html
39
+ # Target a specific subproject / monorepo package
40
+ npx torusguard report --target ./apps/api --html
41
41
  ```
42
+
42
43
  **Under the Hood:**
43
- - Invokes `python .torusguard/scripts/html_reporter.py` to compile self-contained, offline-ready HTML reports with dynamic filtering, posture gauge, and cluster summaries at `.torusguard/runs/<run_id>/report.html`.
44
- - Invokes `python .torusguard/scripts/sarif_exporter.py` to produce OASIS SARIF v2.1.0 logs at `.torusguard/runs/<run_id>/results.sarif`.
44
+ - Invokes `python .torusguard/scripts/html_reporter.py` to compile self-contained, offline-ready HTML reports with dynamic filtering, posture gauge, directory attack surface heatmap, and golden recipe explorer at `report.html` (workspace root) and mirrors to `.torusguard/runs/report-latest.html`.
45
+ - Invokes `python .torusguard/scripts/sarif_exporter.py` to produce OASIS SARIF v2.1.0 logs at `.torusguard/runs/results-latest.sarif`.
45
46
  - Finalizes `manifest.json` metrics and updates historical posture scoring.
46
- - Displays 75-column terminal cards.
47
+ - Displays standardized 75-column terminal cards adhering to visual width invariants.
47
48
 
48
49
  ### Mode B: In-Session AI Chat Agent Reporting
49
50
  When generating security posture summaries in AI chat:
50
51
  1. **Aggregate Run Data:** Inspect `findings.json`, `remediation.md`, and `recheck.md` from the active run.
51
- 2. **Calculate Posture Score:** Compute posture score ($0$–$100$) based on severity weighting (Critical: 25, High: 15, Medium: 5, Low: 2).
52
+ 2. **Calculate Posture Score:** Compute posture score ($0$–$100$) based on severity weighting (Critical: 25, High: 15, Medium: 5, Low: 2). Clean repositories earn 100/100 across 74 defended invariants.
52
53
  3. **Format Executive Card:** Present finding counts, closed vulnerabilities, remaining risks, and compliance posture.
53
- 4. **Export Artifacts:** Verify that `report.html` and `results.sarif` are serialized to disk.
54
+ 4. **Export Artifacts:** Verify that `report.html` and `results-latest.sarif` are serialized to disk.
55
+ 5. **Keep Living Ledger in Lockstep:** Ensure `security_report.md` reflects all findings and verified closures.
56
+
57
+ ---
58
+
59
+ ## Zero-CDN & Offline Guarantee
60
+ - Zero external `<script>` or `<link>` tags. All styles, fonts, SVG icons, and scripts are embedded directly inside `report.html`.
61
+ - Full offline inspection: can be opened directly via `file:///` without an active internet connection.
62
+ - In-browser artifact downloads (SARIF v2.1.0 and CSV) use native `URL.createObjectURL(new Blob(...))` with zero network calls.
54
63
 
55
64
  ---
56
65
 
57
- ## SARIF v2.1.0 Specification
66
+ ## SARIF v2.1.0 Output Specification
58
67
  - **Schema:** `https://docs.oasis-open.org/sarif/sarif/v2.1.0/cos02/schemas/sarif-schema-2.1.0.json`
59
- - **Tool Driver:** `name: TorusGuard`, `semanticVersion: 1.3.5`, full rules catalog in `driver.rules`.
68
+ - **Tool Driver:** `name: TorusGuard`, `semanticVersion: 1.3.6`, full rules catalog in `driver.rules`.
60
69
  - **Automation Details:** `automationDetails.id: "torusguard/static"` to avoid collisions in multi-scanner CI/CD pipelines.
61
70
  - **Fingerprints:** `partialFingerprints.primaryLocationLineHash` with SHA-256 context hash.
62
71
 
63
72
  ---
64
73
 
65
- ## Output Card Format
74
+ ## Safety Constraints
75
+ - Never display raw secrets, tokens, or credentials in terminal outputs or emitted reports.
76
+ - Enforce read-only state for `report` actions — never modify source code during report generation.
77
+ - Ensure atomic writes with fallback retry to prevent corrupt reports during concurrent browser viewing.
78
+ - Respect monorepo target boundaries when `--target` is specified.
79
+
80
+ ---
81
+
82
+ ## Output Format
66
83
  ```markdown
67
- ### 📊 TorusGuard Security Posture Report Emitted
68
- - **Run ID:** `run-20260910-121618-audit`
69
- - **Posture Score:** 85 / 100 (HIGH SECURITY)
70
- - **Findings Summary:** 3 Evaluated · 2 Confirmed Fixed · 1 Unresolved
71
- - **HTML Dashboard:** `.torusguard/runs/<run_id>/report.html` (View in browser)
72
- - **SARIF v2.1.0 Export:** `.torusguard/runs/<run_id>/results.sarif` (Ready for CI)
84
+ ### 🛡️ TorusGuard Security Posture Report Emitted
85
+ - **Posture Score:** 100 / 100 (OPTIMAL DEFENSE)
86
+ - **Invariants Defended:** 74 Defended · 0 Harmed (74 Rules)
87
+ - **HTML Dashboard:** `report.html` (View in browser)
88
+ - **SARIF v2.1.0 Export:** `.torusguard/runs/results-latest.sarif` (Ready for CI)
89
+ - **Living Ledger:** `security_report.md` (Synchronized in lockstep)
73
90
  ```
74
91
 
75
92
  ## Living Report Ground Truth
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: torusguard-status
3
3
  description: Display current TorusGuard security posture, active configuration, rules catalog, and run history via CLI or AI Agent.
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  workflow: .torusguard/workflows/status.md
6
6
  tools: Read, Grep, Glob, run_command, Write
7
7
  scripts-binding:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: torusguard-verify
3
3
  description: Verify finding evidence sufficiency, audit live code line matches, and calibrate 0–100 confidence scores.
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  workflow: .torusguard/workflows/verify.md
6
6
  tools: Read, Grep, Glob, Write, run_command
7
7
  scripts-binding:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: torusguard-web-validate
3
3
  description: Execute authorized HTTP probing against local/staging web applications — session capture, transparent audit headers, and secret redaction.
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  workflow: .torusguard/workflows/web-validate.md
6
6
  tools: Read, Grep, Glob, Bash, Write, run_command
7
7
  scripts-binding: