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,53 @@
1
+ # Frontend Database Protection
2
+
3
+ ## When to load
4
+
5
+ Load during `/TorusGuard check database`, full-stack audits, or when frontend code connects to data stores.
6
+
7
+ ## Linked rules
8
+
9
+ - [TG-DB-001](../../rules/TG-DB-001-frontend-database-query.md) — Database Query in Frontend (High)
10
+ - [TG-DB-002](../../rules/TG-DB-002-privileged-database-credential.md) — Privileged Credential in Browser (Critical)
11
+ - [TG-DB-003](../../rules/TG-DB-003-frontend-admin-sdk.md) — Frontend Admin SDK (Critical)
12
+
13
+ ## Hard bans
14
+
15
+ - No SQL in frontend directories (`src/`, `app/`, `pages/`, `components/`, `client/`, `public/`)
16
+ - No imports of `pg`, `mysql`, `mongoose`, `@prisma/client`, Sequelize, TypeORM, Drizzle server client
17
+ - No Supabase service-role key or Firebase Admin SDK in browser code
18
+ - No trust in client-provided user ID or role without server verification
19
+
20
+ ## Safe architecture
21
+
22
+ ```
23
+ Browser → HTTPS API → AuthZ → Parameterized query/ORM → Database
24
+ ```
25
+
26
+ ## Supabase
27
+
28
+ - Browser: anon key + **RLS enabled** on all exposed tables
29
+ - Server: service-role key only for admin tasks
30
+ - **Manual review required:** RLS policies for every table
31
+
32
+ ## Firebase
33
+
34
+ - Browser: client SDK + Security Rules
35
+ - Server: Admin SDK only
36
+ - **Manual review required:** Firestore/Storage rules
37
+
38
+ ## Audit checklist
39
+
40
+ - [ ] No DB queries or drivers in client code (TG-DB-001, TG-DB-003)
41
+ - [ ] No connection strings or service-role keys in bundle (TG-DB-002)
42
+ - [ ] All mutations authorized server-side
43
+ - [ ] Supabase RLS / Firebase rules reviewed and tested
44
+
45
+ ## Framework guides
46
+
47
+ - [Supabase](../../guides/supabase-security.md)
48
+ - [Firebase](../../guides/firebase-security.md)
49
+ - [React/Vite](../../guides/react-vite-security.md)
50
+
51
+ ## Related rules
52
+
53
+ TG-SEC-002, TG-AUTH-002, TG-AUTH-003
@@ -0,0 +1,12 @@
1
+ # GraphQL Security
2
+
3
+ - Resolver-level authentication and authorization.
4
+ - Query depth limits.
5
+ - Query complexity limits.
6
+ - Pagination and page-size caps.
7
+ - Batching controls.
8
+ - Introspection policy.
9
+ - Aliases and recursive relationships.
10
+ - Error sanitization.
11
+ - Sensitive field exposure.
12
+ - Data-loader and N+1 concerns as resource risks.
@@ -0,0 +1,51 @@
1
+ # Input Validation and Injection Prevention
2
+
3
+ ## When to load
4
+
5
+ Load during `/TorusGuard check input`, API route reviews, or upload/webhook implementation.
6
+
7
+ ## Linked rules
8
+
9
+ - [TG-INPUT-001](../../rules/TG-INPUT-001-missing-server-validation.md) — Missing Server Validation (High)
10
+ - [TG-INPUT-002](../../rules/TG-INPUT-002-raw-sql-concatenation.md) — Raw SQL Concatenation (Critical)
11
+ - [TG-INPUT-003](../../rules/TG-INPUT-003-unsafe-html-or-code-execution.md) — Unsafe HTML/Code Execution (High)
12
+ - [TG-INPUT-004](../../rules/TG-INPUT-004-unrestricted-file-upload.md) — Unrestricted File Upload (High)
13
+
14
+ ## Hard bans
15
+
16
+ - No raw SQL concatenation with request input
17
+ - No `eval`, `Function()`, or shell execution with untrusted input
18
+ - No unsanitized user HTML via `dangerouslySetInnerHTML`
19
+ - No file upload without size, type, and authorization checks
20
+ - No trust in `req.body.role`, `isAdmin`, or `userId`
21
+
22
+ ## Safe defaults
23
+
24
+ - Validate all external input on the server: body, query, params, headers, cookies, webhooks, uploads
25
+ - Treat third-party API and **LLM output** as untrusted
26
+ - Use Zod, Joi, Yup, or Ajv schemas at route entry
27
+ - Parameterized queries or safe ORM APIs only
28
+ - Redirect URLs must use allowlists
29
+ - Uploads: MIME allowlist, size cap, server-generated filenames, storage outside web root
30
+
31
+ ## Audit checklist
32
+
33
+ - [ ] Every API route validates input (TG-INPUT-001)
34
+ - [ ] No concatenated SQL (TG-INPUT-002)
35
+ - [ ] No unsafe HTML/code execution (TG-INPUT-003)
36
+ - [ ] Upload routes restricted (TG-INPUT-004)
37
+
38
+ ## Framework notes
39
+
40
+ - **Express** — validation middleware before handlers
41
+ - **Next.js** — validate in route handlers and Server Actions
42
+ - **Supabase** — Edge Functions validate before privileged ops
43
+
44
+ ## Manual review
45
+
46
+ - Business-logic validation beyond schema (e.g., cross-field rules)
47
+ - NoSQL injection patterns in MongoDB query builders
48
+
49
+ ## Related rules
50
+
51
+ TG-AUTH-002, TG-RATE-003, TG-PLATFORM-004
@@ -0,0 +1,22 @@
1
+ # Mass Assignment and Property Authorization
2
+
3
+ - Explicit writable-field allowlists.
4
+ - DTOs or request schemas.
5
+ - Separate user-editable and server-managed fields.
6
+ - Server-side assignment for role, balance, status, ownership, and verification.
7
+ - Authorization checks for sensitive individual properties.
8
+ - Tests that submit unexpected fields.
9
+
10
+ ## Unsafe
11
+ ```javascript
12
+ await User.update(req.body, { where: { id: req.user.id } });
13
+ ```
14
+
15
+ ## Safe
16
+ ```javascript
17
+ const input = updateProfileSchema.parse(req.body);
18
+ await User.update(
19
+ { displayName: input.displayName, avatarUrl: input.avatarUrl },
20
+ { where: { id: req.user.id } }
21
+ );
22
+ ```
@@ -0,0 +1,56 @@
1
+ # Platform and HTTP Hardening
2
+
3
+ ## When to load
4
+
5
+ Load during `/TorusGuard check platform`, deployment prep, or `/TorusGuard verify`.
6
+
7
+ ## Linked rules
8
+
9
+ - [TG-PLATFORM-001](../../rules/TG-PLATFORM-001-wildcard-cors-with-credentials.md) — Wildcard CORS + Credentials (High)
10
+ - [TG-PLATFORM-002](../../rules/TG-PLATFORM-002-missing-security-headers.md) — Missing Security Headers (Medium)
11
+ - [TG-PLATFORM-003](../../rules/TG-PLATFORM-003-production-stack-trace-exposure.md) — Stack Trace Exposure (Medium)
12
+ - [TG-PLATFORM-004](../../rules/TG-PLATFORM-004-missing-request-size-limits.md) — Missing Request Size Limits (Medium)
13
+
14
+ ## Hard bans
15
+
16
+ - No `Access-Control-Allow-Origin: *` with credentials
17
+ - No production stack traces or raw DB errors to clients
18
+ - No debug mode in production
19
+ - No missing body limits on public JSON endpoints
20
+ - No executable uploads in public web directories
21
+
22
+ ## Safe defaults
23
+
24
+ - CORS explicit allowlist
25
+ - Helmet or equivalent: CSP, `X-Content-Type-Options`, HSTS (production), `Referrer-Policy`, clickjacking protection
26
+ - Generic user-facing errors; detailed logs server-side with request ID
27
+ - HTTPS enforced in production
28
+ - `express.json({ limit: '100kb' })` or appropriate caps
29
+ - Dependency audit before deploy
30
+
31
+ ## Audit checklist
32
+
33
+ - [ ] CORS allowlist (TG-PLATFORM-001)
34
+ - [ ] Security headers configured (TG-PLATFORM-002)
35
+ - [ ] Errors sanitized (TG-PLATFORM-003)
36
+ - [ ] Request/upload limits set (TG-PLATFORM-004)
37
+
38
+ ## Framework notes
39
+
40
+ - **Express** — Helmet + central error handler
41
+ - **Next.js** — headers in `next.config` or middleware
42
+ - **Reverse proxy** — TLS termination, HSTS, rate limits
43
+
44
+ ## Manual review
45
+
46
+ - CSP compatibility with actual script/style sources
47
+ - Infrastructure firewall and WAF rules
48
+ - Backup and monitoring configuration
49
+
50
+ ## Related rules
51
+
52
+ TG-RATE-003, TG-SEC-004, TG-CLIENT-001
53
+
54
+ ## Framework guide
55
+
56
+ [Express Security](../../guides/express-security.md)
@@ -0,0 +1,16 @@
1
+ # TorusGuard Skill Reference: Python Dependencies and Supply Chain
2
+
3
+ > **Loaded When:** Python dependency manifests (`requirements.txt`, `pyproject.toml`, `Pipfile`, `poetry.lock`, `uv.lock`) or `.github/workflows/*.yml` are detected.
4
+
5
+ ---
6
+
7
+ ## 🛡️ Key Inspection Areas & Rules
8
+
9
+ ### 1. Lockfile Integrity
10
+ * `TG-SUPPLY-001`: Verify that deterministic lockfiles exist alongside manifests and are not excluded in `.gitignore`.
11
+
12
+ ### 2. Known CVE Vulnerability Auditing
13
+ * `TG-SUPPLY-002`: Check for vulnerable dependencies using `pip-audit`. Avoid recommending blind major-version upgrades that introduce breaking changes without tests.
14
+
15
+ ### 3. CI/CD Workflow Hardening
16
+ * `TG-SUPPLY-004`: Inspect `.github/workflows/*.yml` for unpinned 3rd-party actions and overbroad default permissions.
@@ -0,0 +1,12 @@
1
+ # TorusGuard Skill Reference: Python Security Overview
2
+
3
+ > **Loaded When:** Any Python project is detected (`requirements.txt`, `pyproject.toml`, `Pipfile`, `.py` source files).
4
+
5
+ ---
6
+
7
+ ## 🐍 Python Platform Security Principles
8
+
9
+ 1. **Explicit Boundaries Over Dynamic Magic:** Avoid unpacking arbitrary user dictionaries directly into database ORM models or data structures (`**req.dict()`, `**request.json`).
10
+ 2. **Server-Side Authorization First:** Route decorators (`@login_required`) verify identity, but database queries must verify resource ownership (`user_id == current_user.id`).
11
+ 3. **Outbound Request Bounding (SSRF):** Always validate scheme, resolve DNS, and block private CIDR blocks before calling `requests.get()` or `httpx.get()`.
12
+ 4. **Deterministic Environments:** Always maintain virtual environment isolation and commit cryptographically verifiable lockfiles (`poetry.lock`, `uv.lock`, `requirements.lock`).
@@ -0,0 +1,57 @@
1
+ # Rate Limiting and Abuse Prevention
2
+
3
+ ## When to load
4
+
5
+ Load during `/TorusGuard check rate-limit`, auth endpoint reviews, or public API design.
6
+
7
+ ## Linked rules
8
+
9
+ - [TG-RATE-001](../../rules/TG-RATE-001-unlimited-auth-endpoint.md) — Unlimited Auth Endpoint (High)
10
+ - [TG-RATE-002](../../rules/TG-RATE-002-unlimited-public-write-endpoint.md) — Unlimited Public Write (Medium)
11
+ - [TG-RATE-003](../../rules/TG-RATE-003-unbounded-resource-consumption.md) — Unbounded Resource Use (High)
12
+
13
+ ## Hard bans
14
+
15
+ - Never rely only on frontend throttling
16
+ - Never leave login, reset, OTP, or contact endpoints unlimited in production
17
+ - Never use in-memory-only rate limits as sole protection in distributed production
18
+
19
+ ## Configurable default limits
20
+
21
+ | Endpoint | Suggested starting point |
22
+ |----------|-------------------------|
23
+ | Login | 5 / IP / 15 min + account backoff |
24
+ | Password reset | 3 / email / hour |
25
+ | OTP | 3 / identifier / 15 min |
26
+ | Contact/feedback | 5 / IP / hour |
27
+ | Public API | 60 / IP / minute |
28
+ | Search | 30 / IP / minute |
29
+ | Upload | 10 / IP / hour + size limits |
30
+ | AI/LLM | Per-user and per-IP cost limits |
31
+
32
+ Adjust for your traffic profile — these are defaults, not universal values.
33
+
34
+ ## Safe defaults
35
+
36
+ - Per-IP limits on public endpoints
37
+ - Per-account limits on auth flows
38
+ - HTTP 429 with `Retry-After` when practical
39
+ - Body, upload, and pagination caps (TG-RATE-003)
40
+ - Timeouts and concurrency limits on expensive endpoints
41
+ - Shared store (Redis) for multi-instance deployments
42
+
43
+ ## Audit checklist
44
+
45
+ - [ ] Auth endpoints rate-limited (TG-RATE-001)
46
+ - [ ] Public write/AI endpoints protected (TG-RATE-002)
47
+ - [ ] Body/upload/pagination limits set (TG-RATE-003)
48
+
49
+ ## Manual review
50
+
51
+ - Webhook endpoints (signature + IP limits)
52
+ - GraphQL complexity/depth limits
53
+ - Spend alerts for metered third-party APIs
54
+
55
+ ## Related rules
56
+
57
+ TG-AUTH-005, TG-PLATFORM-004, TG-INPUT-004
@@ -0,0 +1,64 @@
1
+ # Secrets and Environment Configuration
2
+
3
+ ## When to load
4
+
5
+ Load during `/TorusGuard check secrets`, secret-related audits, or before adding environment variables, CI config, or deployment secrets.
6
+
7
+ ## Linked rules
8
+
9
+ - [TG-SEC-001](../../rules/TG-SEC-001-hardcoded-secrets.md) — Hardcoded Secret (Critical)
10
+ - [TG-SEC-002](../../rules/TG-SEC-002-public-environment-secrets.md) — Public Environment Secret (Critical)
11
+ - [TG-SEC-003](../../rules/TG-SEC-003-tracked-env-file.md) — Tracked Environment File (High)
12
+ - [TG-SEC-004](../../rules/TG-SEC-004-sensitive-logging.md) — Sensitive Data Logging (Medium)
13
+
14
+ ## Hard bans
15
+
16
+ - Never hardcode database URLs, JWT secrets, passwords, or API keys in source
17
+ - Never expose service-role or admin credentials to the browser
18
+ - Never put secrets in `VITE_*`, `NEXT_PUBLIC_*`, or `REACT_APP_*` variables
19
+ - Never log passwords, tokens, session IDs, API keys, or full authorization headers
20
+ - Never commit `.env`, credentials JSON, or private key files
21
+
22
+ ## Frontend env prefixes are public
23
+
24
+ | Prefix | Reaches browser? |
25
+ |--------|------------------|
26
+ | `VITE_` | Yes |
27
+ | `NEXT_PUBLIC_` | Yes |
28
+ | `REACT_APP_` | Yes |
29
+ | (no prefix) | Server only |
30
+
31
+ Only intentionally public configuration may use client prefixes.
32
+
33
+ ## Safe defaults
34
+
35
+ 1. Server-only env for all secrets
36
+ 2. `.env` in `.gitignore`
37
+ 3. `.env.example` with placeholder values only
38
+ 4. Rotate/revoke any discovered leaked secret immediately
39
+ 5. Separate dev/test/production secret stores where applicable
40
+
41
+ ## Audit checklist
42
+
43
+ - [ ] No real secrets in tracked source (TG-SEC-001)
44
+ - [ ] No sensitive values in public env vars (TG-SEC-002)
45
+ - [ ] `.env` not tracked by Git (TG-SEC-003)
46
+ - [ ] Logs redact auth material (TG-SEC-004)
47
+ - [ ] `.env.example` exists with safe placeholders
48
+
49
+ ## Framework notes
50
+
51
+ - **Vite/CRA/Next public vars** — treat as published in the client bundle
52
+ - **Supabase** — anon key in browser OK; service-role server-only
53
+ - **Firebase** — client config public; Admin SDK credentials server-only
54
+ - **CI/CD** — use platform secret stores, not plaintext in workflow files
55
+
56
+ ## Manual review
57
+
58
+ - Verify secret rotation after any exposure
59
+ - Review CI logs for accidental secret echo
60
+ - Confirm production secrets differ from development
61
+
62
+ ## Related rules
63
+
64
+ TG-DB-002, TG-DB-003, TG-CLIENT-002
@@ -0,0 +1,16 @@
1
+ # TorusGuard Skill Reference: SQLAlchemy Security
2
+
3
+ > **Loaded When:** Project uses `sqlalchemy` dependencies or imports.
4
+
5
+ ---
6
+
7
+ ## 🛡️ Key Inspection Areas & Rules
8
+
9
+ ### 1. SQL Injection in Raw Query Clauses
10
+ * `TG-INPUT-003`: Search for `text(f"...")`, `text("..." + ...)`, or `.format()` inside `text()` constructs. Ensure parameter mapping `text("... WHERE col = :val")` is used.
11
+
12
+ ### 2. Tenant Scoping & Object Ownership
13
+ * `TG-AUTH-007`: Verify queries on tenant-isolated tables include tenant/user ID predicates in `.filter()` or `.filter_by()`.
14
+
15
+ ### 3. Mass Assignment via Bulk Updates
16
+ * `TG-AUTH-006`: Inspect `.update(dict)` calls to ensure input dictionaries are filtered against permitted field allowlists.
@@ -0,0 +1,46 @@
1
+ # SSRF and Outbound Requests
2
+
3
+ ## When the reference applies
4
+ Applies to any endpoint that fetches a URL.
5
+
6
+ ## User-controlled URL detection
7
+ Always check if the URL is user-controlled.
8
+
9
+ ## URL scheme validation
10
+ Only allow expected schemes.
11
+
12
+ ## Hostname and IP validation
13
+ Validate hostnames carefully.
14
+
15
+ ## Private-network blocking
16
+ Block internal IP addresses.
17
+
18
+ ## Cloud metadata protection
19
+ Block 169.254.169.254 and similar.
20
+
21
+ ## Redirect handling
22
+ Disable redirects or validate them.
23
+
24
+ ## DNS rebinding considerations
25
+ Check DNS at resolution time.
26
+
27
+ ## Timeout and response-size limits
28
+ Enforce timeouts and max response sizes.
29
+
30
+ ## Network isolation
31
+ Run fetches from isolated networks if possible.
32
+
33
+ ## Safe logging
34
+ Avoid logging raw URLs with credentials.
35
+
36
+ ## Manual-review checklist
37
+ - [ ] Is the outbound URL user-controlled?
38
+ - [ ] Is HTTPS required?
39
+ - [ ] Is the hostname allowlisted?
40
+ - [ ] Are loopback and private IPs blocked?
41
+ - [ ] Are cloud metadata endpoints blocked?
42
+ - [ ] Are redirects disabled or revalidated?
43
+ - [ ] Is DNS resolution checked safely?
44
+ - [ ] Is there a timeout?
45
+ - [ ] Is response size limited?
46
+ - [ ] Is the server isolated from sensitive networks?
@@ -0,0 +1,15 @@
1
+ # Webhook Security
2
+
3
+ - Signature verification over the raw request body.
4
+ - Timestamp tolerance.
5
+ - Replay protection.
6
+ - Event-type allowlisting.
7
+ - Payload schema validation.
8
+ - Idempotency keys or event IDs.
9
+ - Safe retry behavior.
10
+ - Rate and size limits.
11
+ - Generic response errors.
12
+ - No trust in event fields before signature verification.
13
+
14
+ ## Workflow
15
+ Receive raw body → Verify signature → Verify timestamp → Check event ID/idempotency → Validate event schema → Authorize event source/tenant → Process within transaction → Return safe response
@@ -0,0 +1,12 @@
1
+ # WebSocket Security
2
+
3
+ - Authentication during handshake.
4
+ - Re-authentication or token expiry.
5
+ - Origin validation.
6
+ - Per-room and per-channel authorization.
7
+ - Message schema validation.
8
+ - Message-size limits.
9
+ - Connection and subscription limits.
10
+ - Tenant isolation.
11
+ - Disconnect behavior.
12
+ - Logging and abuse detection.
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: torusguard-apply
3
+ description: Apply governed remediation patches to disk with pre-apply rollback snapshots and Human Gate validation.
4
+ version: 0.9.2
5
+ workflow: .torusguard/workflows/apply.md
6
+ tools: Read, Grep, Glob, Bash, Edit, Write
7
+ scripts-binding:
8
+ - .torusguard/scripts/run_manager.py
9
+ - .torusguard/scripts/diff_guard.py
10
+ ---
11
+
12
+ # TorusGuard Apply — Governed Patch Application & Rollback Snapshot
13
+
14
+ ## Objective
15
+ Safely apply approved remediation bundles to disk source files, capturing a byte-for-byte pre-apply backup snapshot and asserting syntax validity post-patch.
16
+
17
+ ---
18
+
19
+ ## Execution Steps
20
+
21
+ 1. **Load Bundle:** Read `patch.diff` and metadata from `.torusguard/runs/<run_id>/remediation/<finding_id>/`.
22
+ 2. **Pre-Apply Snapshot:** Save exact backup to `.torusguard/runs/<run_id>/pre_apply/<filename>.bak`.
23
+ 3. **Obtain Human Gate:** Confirm user approval for proposed diff.
24
+ 4. **Apply Patch:** Execute surgical modification using `replace_file_content` or `patch`.
25
+ 5. **Assert Integrity:** Verify modified file compiles cleanly without syntax errors.
26
+ 6. **Record Ledger:** Log timestamp, file path, and post-patch SHA-256 in `apply-log.json`.
27
+
28
+ ---
29
+
30
+ ## Governance & Safety Rules
31
+ - Hard limit: additions $\le 35$, deletions $\le 25$ lines.
32
+ - Always create a rollback snapshot before modifying disk code.
33
+ - If compile or syntax error occurs, instantly restore from `.bak`.
34
+ - Require explicit operator confirmation before writing changes.
35
+
36
+ ---
37
+
38
+ ## Output Format
39
+ ```markdown
40
+ 🚀 [TorusGuard] Patch Applied Successfully
41
+ - Finding Target: <Finding ID> | File: <Path>
42
+ - Churn: +<Additions> / -<Deletions>
43
+ - Rollback Backup: `.torusguard/runs/<run_id>/pre_apply/<file>.bak`
44
+ - Compile Check: PASSED
45
+ Next: Run `/torusguard recheck` to verify vulnerability is closed.
46
+ ```
@@ -0,0 +1,70 @@
1
+ ---
2
+ name: torusguard-audit
3
+ description: Static security AST scanning, stable fingerprinting, root-cause clustering, and 0–100 confidence scoring.
4
+ version: 0.9.2
5
+ workflow: .torusguard/workflows/audit.md
6
+ tools: Read, Grep, Glob, Write
7
+ scripts-binding:
8
+ - .torusguard/scripts/finding_scorer.py
9
+ - .torusguard/scripts/run_manager.py
10
+ ---
11
+
12
+ # TorusGuard Audit — Static Code Analysis & Finding Clustering
13
+
14
+ ## Objective
15
+ Execute static analysis across ASTs, generate line-shift invariant fingerprints, group findings into root causes, compute 0–100 confidence scores, and persist findings to `.torusguard/runs/`.
16
+
17
+ ---
18
+
19
+ ## Execution Steps
20
+
21
+ 1. **Setup Run Directory:** Initialize `.torusguard/runs/run-YYYYMMDD-HHMMSS-audit/` via `run_manager.py`.
22
+ 2. **Load Active Rules:** Load rules from `.torusguard/rules/active/` and thresholds from `torusguard.json`.
23
+ 3. **AST Scan Sinks:** Match files against active rules:
24
+ - `TG-SEC-*`: Leaked API keys, secrets.
25
+ - `TG-INPUT-*`: Unescaped SQL or unvalidated payloads.
26
+ - `TG-DB-*`: Unscoped queries omitting tenant filters (`Model.get(id=id)`).
27
+ - `TG-AUTH-*`: Missing `HttpOnly`/`Secure` flags; open CORS.
28
+ - `TG-CLIENT-*`: Admin credentials in client bundles.
29
+ 4. **Stable Fingerprinting:** Compute SHA-256 hash of normalized 3 surrounding AST lines.
30
+ 5. **Root-Cause Clustering:** Group findings by root cause (`cluster-tenant-isolation`, `cluster-raw-sql-sink`).
31
+ 6. **Confidence Scoring:** Calculate 0–100 score across 5-factor rubric via `finding_scorer.py`.
32
+ 7. **Write Run Artifacts:** Persist `findings.md`, `findings.json`, and `summary.md`.
33
+
34
+ ---
35
+
36
+ ## Confidence Scoring Rubric
37
+ - **1. Evidence (35):** AST flow (35), regex match (20), indirect (10).
38
+ - **2. Reproduction (25):** Deterministic test (25), simulated (15), hypothesis (0).
39
+ - **3. Corroboration (15):** >=3 files (15), 2 files (10), single (5).
40
+ - **4. Environment (15):** Explicit route (15), minor ambiguity (8), unknown (0).
41
+ - **5. Review Status (10):** Human verified (10), agent consensus (5), auto (0).
42
+ - **Bands:** 90–100 (`Confirmed`), 70–89 (`High`), 50–69 (`Medium`), <50 (`Review`).
43
+
44
+ ---
45
+
46
+ ## Finding Card Format
47
+ ```markdown
48
+ ### [TG-DB-004] Missing Tenant Scoping in /invoices/
49
+ - **Severity**: High | **Confidence**: 90/100 (Confirmed)
50
+ - **File**: `views.py:42` | **Cluster**: `cluster-tenant-isolation`
51
+ - **Evidence**: Unscoped query leaks records.
52
+ - **Remediation**: Scope by `tenant=request.user.tenant`.
53
+ ```
54
+
55
+ ---
56
+
57
+ ## Safety Constraints
58
+ - Read-only execution; zero code modifications.
59
+ - Exclude build folders (`node_modules/`, `.venv/`, `dist/`).
60
+ - Redact secrets before saving to `findings.md`.
61
+
62
+ ---
63
+
64
+ ## Output Format
65
+ ```markdown
66
+ 🛡️ [TorusGuard] Static Code Audit Completed
67
+ - Run ID: run-YYYYMMDD-HHMMSS-audit | Files: <Count> | Findings: <Count>
68
+ - Clusters: <Count> identified | Posture: ACTION REQUIRED
69
+ Next: Run `/torusguard harden` to formulate surgical fixes.
70
+ ```
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: torusguard-authorize
3
+ description: Register and validate runtime target authorization boundaries — scope boundaries, ownership proofs, TTL expiration, and Safety Gate enforcement.
4
+ version: 0.9.2
5
+ workflow: .torusguard/workflows/authorize.md
6
+ tools: Read, Grep, Glob, Write
7
+ scripts-binding:
8
+ - .torusguard/scripts/safety_gate.py
9
+ ---
10
+
11
+ # TorusGuard Authorize — Legal Scope & Safety Gate Registration
12
+
13
+ ## Objective
14
+ Define and validate legal runtime authorization boundaries, verify target ownership, enforce maximum rate limits, and persist a cryptographically auditable `.torusguard/config/scope.json`.
15
+
16
+ ---
17
+
18
+ ## Execution Steps
19
+
20
+ 1. **Capture Scope Parameters:** Collect target host URL, allowed path prefixes, forbidden prefixes, and session TTL.
21
+ 2. **Validate Environment:** Assert target is local (`localhost`, `127.0.0.1`) or staging (`*.staging.*`). Block production targets without explicit override.
22
+ 3. **Verify Host Ownership:** Confirm ownership token or local process socket binding.
23
+ 4. **Invoke Safety Gate:**
24
+ ```bash
25
+ python .torusguard/scripts/safety_gate.py check --url <target_url>
26
+ ```
27
+ 5. **Write Scope Record:** Persist authorized targets, rate limits, and expiration timestamp into `.torusguard/config/scope.json`.
28
+ 6. **Validate Schema:** Confirm `scope.json` adheres to `auth-boundary.schema.json`.
29
+
30
+ ---
31
+
32
+ ## Safety Constraints
33
+ - Never authorize wildcard hosts (`*`) or third-party domains.
34
+ - State-changing destructive actions (`DELETE`, bulk drops) are disabled by default.
35
+ - Set strict TTL (default 4 hours, maximum 24 hours).
36
+
37
+ ---
38
+
39
+ ## Output Format
40
+ ```markdown
41
+ 🔒 [TorusGuard] Target Scope Authorized
42
+ - Target Host: <Host URL> | Environment: <Local / Staging>
43
+ - Allowed Paths: <Prefixes> | Rate Limit: <Max Req/sec>
44
+ - Expiration TTL: <Timestamp>
45
+ - Scope File: `.torusguard/config/scope.json`
46
+ Next: Run `/torusguard web-validate` to begin safe runtime probing.
47
+ ```
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: torusguard-exploit-check
3
+ description: Safe, non-destructive confirmation of exploitability using inert canary tokens and sentinels.
4
+ version: 0.9.2
5
+ workflow: .torusguard/workflows/exploit-check.md
6
+ tools: Read, Grep, Glob, Bash, Write
7
+ scripts-binding:
8
+ - .torusguard/scripts/safety_gate.py
9
+ - .torusguard/scripts/finding_scorer.py
10
+ ---
11
+
12
+ # TorusGuard Exploit Check — Bounded Exploitability Confirmation
13
+
14
+ ## Objective
15
+ Confirm whether candidate findings are practically exploitable using safe, single-step sentinel canaries without data loss or weaponized execution.
16
+
17
+ ---
18
+
19
+ ## Authorization Gate Check
20
+ Before dispatching any exploitability probe:
21
+ 1. Verify target route is explicitly authorized in `.torusguard/config/scope.json`.
22
+ 2. Verify authorization TTL has not expired.
23
+ 3. Assert probe passes `.torusguard/scripts/safety_gate.py`.
24
+
25
+ ---
26
+
27
+ ## Bounded Probe Strategies
28
+ - **SQLi:** Mathematical identity canary (`' OR 1=1--`) asserting differential response without altering data.
29
+ - **XSS:** Inert HTML marker tag (`<tg-canary-tag>`) checking unescaped reflection in DOM.
30
+ - **IDOR:** Cross-tenant GET using secondary tenant session; assert 403 vs leak.
31
+ - **Auth:** Omit auth header on protected route; assert 401.
32
+
33
+ ---
34
+
35
+ ## Execution Steps
36
+
37
+ 1. **Verify Scope:** Read `scope.json`; assert authorized endpoint.
38
+ 2. **Select Canary:** Choose matching non-destructive probe strategy.
39
+ 3. **Dispatch Probe:** Send request with header `X-TorusGuard-AuthID`.
40
+ 4. **Classify Status:** Transition finding into one of 5 canonical outcomes:
41
+ - `Confirmed`: Canary reflected or secondary tenant data leaked.
42
+ - `Not Reproducible`: Endpoint responded with 401/403 or sanitized input.
43
+ - `Needs Review`: Ambiguous status code or incomplete response.
44
+ - `Blocked by Controls`: WAF or rate limiter stopped probe.
45
+ - `Out of Scope`: Target endpoint is not authorized.
46
+ 5. **Record Evidence:** Save trace in `.torusguard/runs/<run_id>/exploit-evidence.md`.
47
+
48
+ ---
49
+
50
+ ## Safety Constraints
51
+ - Zero destructive payloads (`DROP`, `DELETE`, `UPDATE`).
52
+ - No denial-of-service or continuous fuzzing loops.
53
+ - Redact tokens before recording traces.
54
+
55
+ ---
56
+
57
+ ## Output Format
58
+ ```markdown
59
+ 🎯 [TorusGuard] Exploitability Confirmation
60
+ - Finding ID: <Finding ID> | Target: <Route>
61
+ - Status: <Confirmed / Not Reproducible / Blocked>
62
+ - Evidence: <Response snippet or status code>
63
+ Next: Run `/torusguard harden` to formulate surgical remediation bundle.
64
+ ```