torusguard 0.9.2

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 (236) hide show
  1. package/.torusguard/.manifest.json +95 -0
  2. package/.torusguard/ARCHITECTURE.md +168 -0
  3. package/.torusguard/TORUSGUARD.md +145 -0
  4. package/.torusguard/agents/auditor.md +41 -0
  5. package/.torusguard/agents/profiler.md +49 -0
  6. package/.torusguard/agents/remediator.md +41 -0
  7. package/.torusguard/agents/reviewer.md +39 -0
  8. package/.torusguard/agents/validator.md +46 -0
  9. package/.torusguard/config/scope.json +24 -0
  10. package/.torusguard/config/slash-commands.json +102 -0
  11. package/.torusguard/config/torusguard.json +30 -0
  12. package/.torusguard/references/django-security.md +43 -0
  13. package/.torusguard/references/drf-security.md +20 -0
  14. package/.torusguard/references/express-security.md +103 -0
  15. package/.torusguard/references/fastapi-security.md +20 -0
  16. package/.torusguard/references/firebase-security.md +78 -0
  17. package/.torusguard/references/flask-security.md +20 -0
  18. package/.torusguard/references/nextjs-security.md +96 -0
  19. package/.torusguard/references/react-vite-security.md +97 -0
  20. package/.torusguard/references/sqlalchemy-security.md +16 -0
  21. package/.torusguard/references/supabase-security.md +84 -0
  22. package/.torusguard/rules/README.md +62 -0
  23. package/.torusguard/rules/TORUSGUARD.md +145 -0
  24. package/.torusguard/rules/active/.gitkeep +0 -0
  25. package/.torusguard/rules/active/TG-DIFF-001.md +20 -0
  26. package/.torusguard/rules/active/TG-DIFF-002.md +20 -0
  27. package/.torusguard/rules/active/TG-DIFF-003.md +19 -0
  28. package/.torusguard/runs/.gitkeep +0 -0
  29. package/.torusguard/schemas/authorization.schema.json +81 -0
  30. package/.torusguard/schemas/confidence.schema.json +72 -0
  31. package/.torusguard/schemas/evidence.schema.json +66 -0
  32. package/.torusguard/schemas/finding.schema.json +164 -0
  33. package/.torusguard/schemas/provenance.schema.json +46 -0
  34. package/.torusguard/schemas/remediation.schema.json +59 -0
  35. package/.torusguard/schemas/retest.schema.json +53 -0
  36. package/.torusguard/schemas/runtime-evidence.schema.json +72 -0
  37. package/.torusguard/scripts/__pycache__/diff_guard.cpython-311.pyc +0 -0
  38. package/.torusguard/scripts/__pycache__/monorepo_detector.cpython-311.pyc +0 -0
  39. package/.torusguard/scripts/diff_guard.py +171 -0
  40. package/.torusguard/scripts/finding_scorer.py +86 -0
  41. package/.torusguard/scripts/manifest_builder.py +130 -0
  42. package/.torusguard/scripts/monorepo_detector.py +164 -0
  43. package/.torusguard/scripts/run_manager.py +89 -0
  44. package/.torusguard/scripts/safety_gate.py +64 -0
  45. package/.torusguard/scripts/sarif_exporter.py +116 -0
  46. package/.torusguard/scripts/stack_detect.py +152 -0
  47. package/.torusguard/skills/torusguard/SKILL.md +37 -0
  48. package/.torusguard/skills/torusguard/bootstrap.py +158 -0
  49. package/.torusguard/skills/torusguard/references/auth-and-sessions.md +56 -0
  50. package/.torusguard/skills/torusguard/references/business-logic-and-abuse.md +23 -0
  51. package/.torusguard/skills/torusguard/references/cache-and-sensitive-responses.md +10 -0
  52. package/.torusguard/skills/torusguard/references/client-code-exposure.md +55 -0
  53. package/.torusguard/skills/torusguard/references/csrf-and-cross-origin.md +11 -0
  54. package/.torusguard/skills/torusguard/references/dependency-and-supply-chain.md +22 -0
  55. package/.torusguard/skills/torusguard/references/django-security.md +43 -0
  56. package/.torusguard/skills/torusguard/references/drf-security.md +20 -0
  57. package/.torusguard/skills/torusguard/references/fastapi-security.md +20 -0
  58. package/.torusguard/skills/torusguard/references/flask-security.md +20 -0
  59. package/.torusguard/skills/torusguard/references/frontend-no-db.md +53 -0
  60. package/.torusguard/skills/torusguard/references/graphql-security.md +12 -0
  61. package/.torusguard/skills/torusguard/references/input-and-injection.md +51 -0
  62. package/.torusguard/skills/torusguard/references/mass-assignment-and-property-auth.md +22 -0
  63. package/.torusguard/skills/torusguard/references/platform-hardening.md +56 -0
  64. package/.torusguard/skills/torusguard/references/python-dependencies.md +16 -0
  65. package/.torusguard/skills/torusguard/references/python-security-overview.md +12 -0
  66. package/.torusguard/skills/torusguard/references/rate-limit-and-abuse.md +57 -0
  67. package/.torusguard/skills/torusguard/references/secrets-and-config.md +64 -0
  68. package/.torusguard/skills/torusguard/references/sqlalchemy-security.md +16 -0
  69. package/.torusguard/skills/torusguard/references/ssrf-and-outbound-requests.md +46 -0
  70. package/.torusguard/skills/torusguard/references/webhook-security.md +15 -0
  71. package/.torusguard/skills/torusguard/references/websocket-security.md +12 -0
  72. package/.torusguard/skills/torusguard-apply/SKILL.md +46 -0
  73. package/.torusguard/skills/torusguard-audit/SKILL.md +70 -0
  74. package/.torusguard/skills/torusguard-authorize/SKILL.md +47 -0
  75. package/.torusguard/skills/torusguard-exploit-check/SKILL.md +64 -0
  76. package/.torusguard/skills/torusguard-full/SKILL.md +70 -0
  77. package/.torusguard/skills/torusguard-harden/SKILL.md +63 -0
  78. package/.torusguard/skills/torusguard-init/SKILL.md +52 -0
  79. package/.torusguard/skills/torusguard-recheck/SKILL.md +53 -0
  80. package/.torusguard/skills/torusguard-report/SKILL.md +54 -0
  81. package/.torusguard/skills/torusguard-status/SKILL.md +42 -0
  82. package/.torusguard/skills/torusguard-verify/SKILL.md +55 -0
  83. package/.torusguard/skills/torusguard-web-validate/SKILL.md +64 -0
  84. package/.torusguard/templates/audit-report.template.md +54 -0
  85. package/.torusguard/templates/authorization.template.md +34 -0
  86. package/.torusguard/templates/finding-card.template.md +32 -0
  87. package/.torusguard/templates/remediation-bundle.template.md +35 -0
  88. package/.torusguard/workflows/apply.md +95 -0
  89. package/.torusguard/workflows/audit.md +93 -0
  90. package/.torusguard/workflows/authorize.md +95 -0
  91. package/.torusguard/workflows/exploit-check.md +97 -0
  92. package/.torusguard/workflows/harden.md +93 -0
  93. package/.torusguard/workflows/init.md +95 -0
  94. package/.torusguard/workflows/recheck.md +95 -0
  95. package/.torusguard/workflows/report.md +95 -0
  96. package/.torusguard/workflows/status.md +95 -0
  97. package/.torusguard/workflows/verify.md +95 -0
  98. package/.torusguard/workflows/web-validate.md +95 -0
  99. package/LICENSE +21 -0
  100. package/README.md +319 -0
  101. package/bin/torusguard.js +110 -0
  102. package/install.py +98 -0
  103. package/package.json +48 -0
  104. package/skills/torusguard/SKILL.md +41 -0
  105. package/skills/torusguard/__pycache__/bootstrap.cpython-311.pyc +0 -0
  106. package/skills/torusguard/bootstrap.py +256 -0
  107. package/skills/torusguard/payload/.manifest.json +95 -0
  108. package/skills/torusguard/payload/ARCHITECTURE.md +168 -0
  109. package/skills/torusguard/payload/TORUSGUARD.md +145 -0
  110. package/skills/torusguard/payload/agents/auditor.md +41 -0
  111. package/skills/torusguard/payload/agents/profiler.md +49 -0
  112. package/skills/torusguard/payload/agents/remediator.md +41 -0
  113. package/skills/torusguard/payload/agents/reviewer.md +39 -0
  114. package/skills/torusguard/payload/agents/validator.md +46 -0
  115. package/skills/torusguard/payload/config/scope.json +24 -0
  116. package/skills/torusguard/payload/config/slash-commands.json +102 -0
  117. package/skills/torusguard/payload/config/torusguard.json +30 -0
  118. package/skills/torusguard/payload/references/django-security.md +43 -0
  119. package/skills/torusguard/payload/references/drf-security.md +20 -0
  120. package/skills/torusguard/payload/references/express-security.md +103 -0
  121. package/skills/torusguard/payload/references/fastapi-security.md +20 -0
  122. package/skills/torusguard/payload/references/firebase-security.md +78 -0
  123. package/skills/torusguard/payload/references/flask-security.md +20 -0
  124. package/skills/torusguard/payload/references/nextjs-security.md +96 -0
  125. package/skills/torusguard/payload/references/react-vite-security.md +97 -0
  126. package/skills/torusguard/payload/references/sqlalchemy-security.md +16 -0
  127. package/skills/torusguard/payload/references/supabase-security.md +84 -0
  128. package/skills/torusguard/payload/rules/README.md +62 -0
  129. package/skills/torusguard/payload/rules/TORUSGUARD.md +145 -0
  130. package/skills/torusguard/payload/rules/active/.gitkeep +0 -0
  131. package/skills/torusguard/payload/rules/active/TG-DIFF-001.md +20 -0
  132. package/skills/torusguard/payload/rules/active/TG-DIFF-002.md +20 -0
  133. package/skills/torusguard/payload/rules/active/TG-DIFF-003.md +19 -0
  134. package/skills/torusguard/payload/schemas/authorization.schema.json +81 -0
  135. package/skills/torusguard/payload/schemas/confidence.schema.json +72 -0
  136. package/skills/torusguard/payload/schemas/evidence.schema.json +66 -0
  137. package/skills/torusguard/payload/schemas/finding.schema.json +164 -0
  138. package/skills/torusguard/payload/schemas/provenance.schema.json +46 -0
  139. package/skills/torusguard/payload/schemas/remediation.schema.json +59 -0
  140. package/skills/torusguard/payload/schemas/retest.schema.json +53 -0
  141. package/skills/torusguard/payload/schemas/runtime-evidence.schema.json +72 -0
  142. package/skills/torusguard/payload/scripts/diff_guard.py +171 -0
  143. package/skills/torusguard/payload/scripts/finding_scorer.py +86 -0
  144. package/skills/torusguard/payload/scripts/manifest_builder.py +130 -0
  145. package/skills/torusguard/payload/scripts/monorepo_detector.py +164 -0
  146. package/skills/torusguard/payload/scripts/run_manager.py +89 -0
  147. package/skills/torusguard/payload/scripts/safety_gate.py +64 -0
  148. package/skills/torusguard/payload/scripts/sarif_exporter.py +116 -0
  149. package/skills/torusguard/payload/scripts/stack_detect.py +152 -0
  150. package/skills/torusguard/payload/skills/torusguard/SKILL.md +37 -0
  151. package/skills/torusguard/payload/skills/torusguard/bootstrap.py +158 -0
  152. package/skills/torusguard/payload/skills/torusguard/references/auth-and-sessions.md +56 -0
  153. package/skills/torusguard/payload/skills/torusguard/references/business-logic-and-abuse.md +23 -0
  154. package/skills/torusguard/payload/skills/torusguard/references/cache-and-sensitive-responses.md +10 -0
  155. package/skills/torusguard/payload/skills/torusguard/references/client-code-exposure.md +55 -0
  156. package/skills/torusguard/payload/skills/torusguard/references/csrf-and-cross-origin.md +11 -0
  157. package/skills/torusguard/payload/skills/torusguard/references/dependency-and-supply-chain.md +22 -0
  158. package/skills/torusguard/payload/skills/torusguard/references/django-security.md +43 -0
  159. package/skills/torusguard/payload/skills/torusguard/references/drf-security.md +20 -0
  160. package/skills/torusguard/payload/skills/torusguard/references/fastapi-security.md +20 -0
  161. package/skills/torusguard/payload/skills/torusguard/references/flask-security.md +20 -0
  162. package/skills/torusguard/payload/skills/torusguard/references/frontend-no-db.md +53 -0
  163. package/skills/torusguard/payload/skills/torusguard/references/graphql-security.md +12 -0
  164. package/skills/torusguard/payload/skills/torusguard/references/input-and-injection.md +51 -0
  165. package/skills/torusguard/payload/skills/torusguard/references/mass-assignment-and-property-auth.md +22 -0
  166. package/skills/torusguard/payload/skills/torusguard/references/platform-hardening.md +56 -0
  167. package/skills/torusguard/payload/skills/torusguard/references/python-dependencies.md +16 -0
  168. package/skills/torusguard/payload/skills/torusguard/references/python-security-overview.md +12 -0
  169. package/skills/torusguard/payload/skills/torusguard/references/rate-limit-and-abuse.md +57 -0
  170. package/skills/torusguard/payload/skills/torusguard/references/secrets-and-config.md +64 -0
  171. package/skills/torusguard/payload/skills/torusguard/references/sqlalchemy-security.md +16 -0
  172. package/skills/torusguard/payload/skills/torusguard/references/ssrf-and-outbound-requests.md +46 -0
  173. package/skills/torusguard/payload/skills/torusguard/references/webhook-security.md +15 -0
  174. package/skills/torusguard/payload/skills/torusguard/references/websocket-security.md +12 -0
  175. package/skills/torusguard/payload/skills/torusguard-apply/SKILL.md +46 -0
  176. package/skills/torusguard/payload/skills/torusguard-audit/SKILL.md +70 -0
  177. package/skills/torusguard/payload/skills/torusguard-authorize/SKILL.md +47 -0
  178. package/skills/torusguard/payload/skills/torusguard-exploit-check/SKILL.md +64 -0
  179. package/skills/torusguard/payload/skills/torusguard-full/SKILL.md +70 -0
  180. package/skills/torusguard/payload/skills/torusguard-harden/SKILL.md +63 -0
  181. package/skills/torusguard/payload/skills/torusguard-init/SKILL.md +52 -0
  182. package/skills/torusguard/payload/skills/torusguard-recheck/SKILL.md +53 -0
  183. package/skills/torusguard/payload/skills/torusguard-report/SKILL.md +54 -0
  184. package/skills/torusguard/payload/skills/torusguard-status/SKILL.md +42 -0
  185. package/skills/torusguard/payload/skills/torusguard-verify/SKILL.md +55 -0
  186. package/skills/torusguard/payload/skills/torusguard-web-validate/SKILL.md +64 -0
  187. package/skills/torusguard/payload/templates/audit-report.template.md +54 -0
  188. package/skills/torusguard/payload/templates/authorization.template.md +34 -0
  189. package/skills/torusguard/payload/templates/finding-card.template.md +32 -0
  190. package/skills/torusguard/payload/templates/remediation-bundle.template.md +35 -0
  191. package/skills/torusguard/payload/workflows/apply.md +95 -0
  192. package/skills/torusguard/payload/workflows/audit.md +93 -0
  193. package/skills/torusguard/payload/workflows/authorize.md +95 -0
  194. package/skills/torusguard/payload/workflows/exploit-check.md +97 -0
  195. package/skills/torusguard/payload/workflows/harden.md +93 -0
  196. package/skills/torusguard/payload/workflows/init.md +95 -0
  197. package/skills/torusguard/payload/workflows/recheck.md +95 -0
  198. package/skills/torusguard/payload/workflows/report.md +95 -0
  199. package/skills/torusguard/payload/workflows/status.md +95 -0
  200. package/skills/torusguard/payload/workflows/verify.md +95 -0
  201. package/skills/torusguard/payload/workflows/web-validate.md +95 -0
  202. package/skills/torusguard/references/auth-and-sessions.md +56 -0
  203. package/skills/torusguard/references/business-logic-and-abuse.md +23 -0
  204. package/skills/torusguard/references/cache-and-sensitive-responses.md +10 -0
  205. package/skills/torusguard/references/client-code-exposure.md +55 -0
  206. package/skills/torusguard/references/csrf-and-cross-origin.md +11 -0
  207. package/skills/torusguard/references/dependency-and-supply-chain.md +22 -0
  208. package/skills/torusguard/references/django-security.md +43 -0
  209. package/skills/torusguard/references/drf-security.md +20 -0
  210. package/skills/torusguard/references/fastapi-security.md +20 -0
  211. package/skills/torusguard/references/flask-security.md +20 -0
  212. package/skills/torusguard/references/frontend-no-db.md +53 -0
  213. package/skills/torusguard/references/graphql-security.md +12 -0
  214. package/skills/torusguard/references/input-and-injection.md +51 -0
  215. package/skills/torusguard/references/mass-assignment-and-property-auth.md +22 -0
  216. package/skills/torusguard/references/platform-hardening.md +56 -0
  217. package/skills/torusguard/references/python-dependencies.md +16 -0
  218. package/skills/torusguard/references/python-security-overview.md +12 -0
  219. package/skills/torusguard/references/rate-limit-and-abuse.md +57 -0
  220. package/skills/torusguard/references/secrets-and-config.md +64 -0
  221. package/skills/torusguard/references/sqlalchemy-security.md +16 -0
  222. package/skills/torusguard/references/ssrf-and-outbound-requests.md +46 -0
  223. package/skills/torusguard/references/webhook-security.md +15 -0
  224. package/skills/torusguard/references/websocket-security.md +12 -0
  225. package/skills/torusguard-apply/SKILL.md +46 -0
  226. package/skills/torusguard-audit/SKILL.md +70 -0
  227. package/skills/torusguard-authorize/SKILL.md +47 -0
  228. package/skills/torusguard-exploit-check/SKILL.md +64 -0
  229. package/skills/torusguard-full/SKILL.md +70 -0
  230. package/skills/torusguard-harden/SKILL.md +63 -0
  231. package/skills/torusguard-init/SKILL.md +52 -0
  232. package/skills/torusguard-recheck/SKILL.md +53 -0
  233. package/skills/torusguard-report/SKILL.md +54 -0
  234. package/skills/torusguard-status/SKILL.md +42 -0
  235. package/skills/torusguard-verify/SKILL.md +55 -0
  236. package/skills/torusguard-web-validate/SKILL.md +64 -0
@@ -0,0 +1,52 @@
1
+ ---
2
+ name: torusguard-init
3
+ description: Initialize TorusGuard workspace โ€” detect project stack, activate tailored TG-* security rules, and generate SECURITY.md baseline.
4
+ version: 0.9.2
5
+ workflow: .torusguard/workflows/init.md
6
+ tools: Read, Grep, Glob, Write
7
+ scripts-binding:
8
+ - .torusguard/scripts/stack_detect.py
9
+ ---
10
+
11
+ # TorusGuard Init โ€” Project Stack Discovery & Rule Activation
12
+
13
+ ## Objective
14
+ Auto-detect repository technology stack via indicators or `stack_detect.py`, activate framework-tailored `TG-*` security rules into `.torusguard/rules/active/`, and provision `torusguard.json` and `SECURITY.md`.
15
+
16
+ ---
17
+
18
+ ## Pre-Flight Check
19
+ 1. Verify `.torusguard/` layout (`config/`, `rules/active/`, `runs/`, `scripts/`, `workflows/`, `templates/`, `schemas/`).
20
+ 2. If missing, unpack via `python skills/torusguard/bootstrap.py --target .`.
21
+ 3. Check existing `.torusguard/config/torusguard.json` before overwriting.
22
+
23
+ ---
24
+
25
+ ## Execution Steps
26
+
27
+ 1. **Stack Detection:** Run `python .torusguard/scripts/stack_detect.py .` to detect:
28
+ - Python: Django (`manage.py`), FastAPI (`fastapi`), Flask (`flask`), SQLAlchemy.
29
+ - Node: Next.js (`"next"`), Express (`"express"`), React/Vite (`"vite"`).
30
+ - BaaS: Supabase (`@supabase/supabase-js`), Firebase (`firebase-admin`).
31
+ 2. **Emit Stack Record:** Log detected language, framework, ORM, and client SDKs.
32
+ 3. **Activate Tailored Rules:** Copy matching `TG-*` rules from `.torusguard/rules/` into `.torusguard/rules/active/`.
33
+ 4. **Provision Policy:** Create `SECURITY.md` if absent, configuring responsible disclosure contacts.
34
+ 5. **Write Configuration:** Persist detected stack and active rules count to `.torusguard/config/torusguard.json`.
35
+
36
+ ---
37
+
38
+ ## Safety Constraints
39
+ - Never overwrite custom rules in `.torusguard/rules/active/` without prompt.
40
+ - Retain existing `SECURITY.md` if already established by repository owners.
41
+ - Strictly read-only detection against source files.
42
+
43
+ ---
44
+
45
+ ## Output Format
46
+ ```markdown
47
+ ๐Ÿ›ก๏ธ [TorusGuard] Workspace Initialized
48
+ - Primary Stack: <Detected Stack> | Components: <Backend/Frontend/DB>
49
+ - Active Rules: <Count> rules enabled in `.torusguard/rules/active/`
50
+ - Configuration: `.torusguard/config/torusguard.json` written
51
+ Next: Run `/torusguard audit` to execute static security scan.
52
+ ```
@@ -0,0 +1,53 @@
1
+ ---
2
+ name: torusguard-recheck
3
+ description: Execute targeted differential AST re-scan against modified files, verify fix closure, and assert zero regressions.
4
+ version: 0.9.2
5
+ workflow: .torusguard/workflows/recheck.md
6
+ tools: Read, Grep, Glob, Write
7
+ scripts-binding:
8
+ - .torusguard/scripts/run_manager.py
9
+ - .torusguard/scripts/finding_scorer.py
10
+ ---
11
+
12
+ # TorusGuard Recheck โ€” Targeted Differential Audit & Regression Verification
13
+
14
+ ## Objective
15
+ Re-scan only files modified by remediation patches, confirming that targeted vulnerability sinks have been neutralized and verifying that no new security regressions were introduced.
16
+
17
+ ---
18
+
19
+ ## Execution Steps
20
+
21
+ 1. **Identify Modified Files:** Read `apply-log.json` from active run directory.
22
+ 2. **Execute Differential Scan:** Re-run active `TG-*` rules exclusively against the modified files.
23
+ 3. **Evaluate Finding Status:** Transition finding state according to transition rules below.
24
+ 4. **Assert Regression-Free:** Ensure no new security warnings triggered on altered lines.
25
+ 5. **Update State:** Record verified status in `findings.json`.
26
+ 6. **Emit Recheck Report:** Save summary in `.torusguard/runs/<run_id>/recheck-report.md`.
27
+
28
+ ---
29
+
30
+ ## State Transition Rules
31
+ - **`Fixed`:** Targeted vulnerable AST pattern is absent and no new issues appear on modified lines.
32
+ - **`Partially Fixed`:** Vulnerability surface was reduced but sanitization remains incomplete.
33
+ - **`Not Fixed`:** Vulnerable AST sink remains present in patched file.
34
+ - **`Regression`:** Patch introduced a new security rule violation on modified lines.
35
+
36
+ ---
37
+
38
+ ## Safety Constraints
39
+ - Restrict AST scan strictly to modified files and direct callers.
40
+ - If regression is detected, halt and recommend immediate rollback via `.bak` snapshot.
41
+ - Read-only differential analysis.
42
+
43
+ ---
44
+
45
+ ## Output Format
46
+ ```markdown
47
+ โœ… [TorusGuard] Differential Recheck Completed
48
+ - Modified Files Scanned: <Count>
49
+ - Target Finding: <Finding ID> โ”€โ”€โ–บ FIXED
50
+ - Regressions Detected: 0
51
+ - Report: `.torusguard/runs/<run_id>/recheck-report.md`
52
+ Next: Run `/torusguard report` to export final SARIF and release summary.
53
+ ```
@@ -0,0 +1,54 @@
1
+ ---
2
+ name: torusguard-report
3
+ description: Generate unified security posture reports and export OASIS SARIF v2.1.0 logs for CI/CD integration.
4
+ version: 0.9.2
5
+ workflow: .torusguard/workflows/report.md
6
+ tools: Read, Grep, Glob, Write
7
+ scripts-binding:
8
+ - .torusguard/scripts/sarif_exporter.py
9
+ - .torusguard/scripts/run_manager.py
10
+ ---
11
+
12
+ # TorusGuard Report โ€” Unified Security Posture Report & SARIF Export
13
+
14
+ ## Objective
15
+ Aggregate findings, verification traces, and recheck results into a signed executive security summary and export schema-compliant OASIS SARIF v2.1.0 logs for CI/CD pipelines.
16
+
17
+ ---
18
+
19
+ ## Execution Steps
20
+
21
+ 1. **Aggregate Run Data:** Read findings, verified evidence, and recheck records from active run.
22
+ 2. **Export OASIS SARIF v2.1.0:**
23
+ ```bash
24
+ python .torusguard/scripts/sarif_exporter.py --run <run_dir> --output <run_dir>/results.sarif
25
+ ```
26
+ 3. **Compile Executive Markdown Report:** Generate `report.md` with posture score, open/closed finding tables, and risk breakdown.
27
+ 4. **Update Run Manifest:** Finalize `manifest.json` status counts.
28
+ 5. **Archive Release Artifacts:** Ensure `report.md` and `results.sarif` are serialized to disk.
29
+
30
+ ---
31
+
32
+ ## SARIF v2.1.0 Output Specification
33
+ - **Version:** `$schema: https://docs.oasis-open.org/sarif/sarif/v2.1.0/cos02/schemas/sarif-schema-2.1.0.json`, `version: 2.1.0`.
34
+ - **Tool Driver:** `name: TorusGuard`, `semanticVersion: 0.9.2`, full rules catalog in `driver.rules`.
35
+ - **Category Hygiene:** Set `automationDetails.id: "torusguard/static"` to avoid collisions in multi-analysis CI.
36
+ - **Fingerprinting:** Populate `partialFingerprints.primaryLocationLineHash` with SHA-256 context hash.
37
+
38
+ ---
39
+
40
+ ## Safety Constraints
41
+ - Redact all tokens, passwords, and API keys before saving report.
42
+ - Strictly read-only reporting; no source code modifications.
43
+ - Ensure SARIF passes JSON schema validation.
44
+
45
+ ---
46
+
47
+ ## Output Format
48
+ ```markdown
49
+ ๐Ÿ“Š [TorusGuard] Security Posture Report Emitted
50
+ - Run ID: <Run ID> | Posture Score: <Score>/100
51
+ - Findings: <Total> (<Fixed> Fixed ยท <Open> Open)
52
+ - SARIF Export: `.torusguard/runs/<run_id>/results.sarif`
53
+ - Executive Report: `.torusguard/runs/<run_id>/report.md`
54
+ ```
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: torusguard-status
3
+ description: Display current TorusGuard security posture, active configuration, rules catalog, and run history.
4
+ version: 0.9.2
5
+ workflow: .torusguard/workflows/status.md
6
+ tools: Read, Grep, Glob
7
+ scripts-binding:
8
+ - .torusguard/scripts/run_manager.py
9
+ ---
10
+
11
+ # TorusGuard Status โ€” Workspace Security Posture & Diagnostic Overview
12
+
13
+ ## Objective
14
+ Provide an instant diagnostic summary of the repository's security state, active framework rules, historical run results, and runtime scope validity.
15
+
16
+ ---
17
+
18
+ ## Execution Steps
19
+
20
+ 1. **Read Configuration:** Parse `.torusguard/config/torusguard.json` to verify initialization state and detected framework stack.
21
+ 2. **Enumerate Active Rules:** Count rule files physically present in `.torusguard/rules/active/`.
22
+ 3. **Inspect Run History:** List historical run folders in `.torusguard/runs/` via `run_manager.py`.
23
+ 4. **Check Authorization Scope:** Check `.torusguard/config/scope.json` for active targets and TTL expiration.
24
+ 5. **Render Diagnostic Overview:** Output formatted status card.
25
+
26
+ ---
27
+
28
+ ## Safety Constraints
29
+ - Read-only execution; zero file modifications.
30
+ - Handle uninitialized workspaces gracefully with advice to run `/torusguard init`.
31
+
32
+ ---
33
+
34
+ ## Output Format
35
+ ```markdown
36
+ ๐Ÿ›ก๏ธ [TorusGuard] Workspace Status Overview
37
+ - Version: v0.9.2 | Stack: <Detected Framework>
38
+ - Active Rules: <Count> rules active in `.torusguard/rules/active/`
39
+ - Historical Runs: <Count> runs recorded
40
+ - Scope: <Authorized (TTL Active) / Expired / Unconfigured>
41
+ - Posture: <SECURE / ACTION REQUIRED>
42
+ ```
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: torusguard-verify
3
+ description: Verify finding evidence sufficiency, audit live code line matches, and calibrate 0โ€“100 confidence scores.
4
+ version: 0.9.2
5
+ workflow: .torusguard/workflows/verify.md
6
+ tools: Read, Grep, Glob, Write
7
+ scripts-binding:
8
+ - .torusguard/scripts/finding_scorer.py
9
+ ---
10
+
11
+ # TorusGuard Verify โ€” Finding Evidence Verification & Calibration
12
+
13
+ ## Objective
14
+ Audit the evidence sufficiency of candidate findings by reading current disk lines, evaluating unbroken taint source-to-sink flow, filtering false alarms, and calibrating final 0โ€“100 confidence scores.
15
+
16
+ ---
17
+
18
+ ## Execution Steps
19
+
20
+ 1. **Locate Target Findings:** Load active findings from `.torusguard/runs/<latest-run>/findings.md`.
21
+ 2. **Live Disk Line Match:** Inspect exact cited lines using `view_file` to confirm code presence.
22
+ 3. **Audit Evidence Sufficiency:** Verify source-to-sink flow against criteria below.
23
+ 4. **Calibrate Confidence Score:**
24
+ ```bash
25
+ python .torusguard/scripts/finding_scorer.py --run <run_dir> --verify
26
+ ```
27
+ 5. **Update State:** Mark finding as `Confirmed`, `Needs Review`, or `False Positive`.
28
+ 6. **Emit Verified Evidence:** Save report in `.torusguard/runs/<run_id>/verified-evidence.md`.
29
+
30
+ ---
31
+
32
+ ## Evidence Sufficiency
33
+ A finding is verified as sufficient when:
34
+ - **Direct AST Match:** The vulnerable API or sink call exists on disk at the cited location.
35
+ - **Exposed Surface:** The sink is reachable from an external route, view, or public method.
36
+ - **Absence of Sanitizer:** No escaping function, parameterization, or validating middleware neutralizes the input.
37
+ - **Taint Integrity:** Untrusted request data flows into the sink without structural validation.
38
+
39
+ ---
40
+
41
+ ## Safety Constraints
42
+ - Read-only analysis; no files are modified.
43
+ - Never guess line numbers; always verify via active disk read.
44
+ - Downgrade findings with sanitizer presence to `False Positive`.
45
+
46
+ ---
47
+
48
+ ## Output Format
49
+ ```markdown
50
+ ๐Ÿงช [TorusGuard] Finding Verification Complete
51
+ - Findings Audited: <Count> | Confirmed Real: <Count>
52
+ - False Positives Filtered: <Count> | Refined Mean Score: <Score>/100
53
+ - Artifact: `.torusguard/runs/<run_id>/verified-evidence.md`
54
+ Next: Run `/torusguard harden` to formulate surgical fixes for confirmed flaws.
55
+ ```
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: torusguard-web-validate
3
+ description: Execute authorized HTTP probing against local/staging web applications โ€” session capture, transparent audit headers, and secret redaction.
4
+ version: 0.9.2
5
+ workflow: .torusguard/workflows/web-validate.md
6
+ tools: Read, Grep, Glob, Bash, Write
7
+ scripts-binding:
8
+ - .torusguard/scripts/safety_gate.py
9
+ ---
10
+
11
+ # TorusGuard Web Validate โ€” Bounded HTTP Probing & Session Capture
12
+
13
+ ## Objective
14
+ Safely probe live web applications within authorized scope, injecting transparent audit headers, verifying security headers and cookies, redacting sensitive tokens, and recording deterministic replay traces.
15
+
16
+ ---
17
+
18
+ ## Authorization Gate Check
19
+ Before dispatching any HTTP request:
20
+ 1. Verify `.torusguard/config/scope.json` exists and contains target URL.
21
+ 2. Confirm current timestamp is prior to `expires_at` TTL.
22
+ 3. Assert target is local or non-production staging.
23
+
24
+ ---
25
+
26
+ ## Safety Gate
27
+ All requests pass through `.torusguard/scripts/safety_gate.py`:
28
+ - `Auto-Allowed`: Read-only `GET`, `HEAD`, `OPTIONS` on non-sensitive paths.
29
+ - `Approval Required`: Requests touching auth, sessions, or parameters.
30
+ - `Manual Only`: Any destructive method (`DELETE`, `DROP`) is strictly blocked.
31
+
32
+ ---
33
+
34
+ ## Execution Steps
35
+
36
+ 1. **Gate Check:** Validate scope in `scope.json` and query `safety_gate.py`.
37
+ 2. **Inject Audit Header:** Attach `X-TorusGuard-AuthID: <auth_id>` to all outbound requests.
38
+ 3. **Dispatch Bounded Probe:** Send single non-destructive HTTP request.
39
+ 4. **Validate Security Headers:** Check for CSP, HSTS, X-Content-Type-Options, and CORS configurations.
40
+ 5. **Audit Cookie Flags:** Verify `HttpOnly`, `Secure`, and `SameSite` on session cookies.
41
+ 6. **Capture Replay Trace:** Save sanitized trace in `.torusguard/runs/<run_id>/requests.json`.
42
+
43
+ ---
44
+
45
+ ## Credential Redaction
46
+ All Bearer tokens, cookies, passwords, and API keys are redacted prior to disk serialization (`Bearer [REDACTED]`).
47
+
48
+ ---
49
+
50
+ ## Safety Constraints
51
+ - Max 50 requests per validation session.
52
+ - Never test unauthorized domains or third-party APIs.
53
+ - Zero state-changing destructive operations.
54
+
55
+ ---
56
+
57
+ ## Output Format
58
+ ```markdown
59
+ ๐ŸŒ [TorusGuard] Web Validation Completed
60
+ - Target: <Host URL> | Endpoints Tested: <Count>
61
+ - Header Posture: <CSP/HSTS Status> | Cookies: <Flags Status>
62
+ - Replay Trace: `.torusguard/runs/<run_id>/requests.json`
63
+ Next: Run `/torusguard exploit-check` to confirm exploitability of candidate flaws.
64
+ ```