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,95 @@
1
+ {
2
+ "ARCHITECTURE.md": "0ecacc797932daaf95ccf5032c47f11550c9b6fe07cdfece5c075e11ec5e9cf7",
3
+ "TORUSGUARD.md": "c980b0ddd3778d5981f6c16c64015c60dc713b6f151fc531bc5681ecd770fb50",
4
+ "agents/auditor.md": "4ba2c92982823d0886c7ae369126cd5ddd322085a85d3b7e7fa23154f8753314",
5
+ "agents/profiler.md": "0ee9ebbddf4ebd557d454dda8472fffea471e263abeccf40298163084b7ce9a9",
6
+ "agents/remediator.md": "f708a0e315760e8d519bd640d22bdf6b7ec61ed7de3da69bd038bd60dc3d5b47",
7
+ "agents/reviewer.md": "69b280bb8a7b2fe425644d01a6f9cb454f9629f348782cd14968657076977c28",
8
+ "agents/validator.md": "79fc4431de5c5507f8730aee6c5c3e61fd238cbf8cf8c7c6aac462eee9761ed6",
9
+ "config/scope.json": "b198a86186b4c6d5e1af516bf4e3a6afa8878e622ca1d57a5bf72d294f8c6f25",
10
+ "config/slash-commands.json": "5390f0d26f8117a62e56c58147d3a0d2deab1a20956302b212703281d13fa84e",
11
+ "config/torusguard.json": "5f775da1f77aaffcd8173fac6a8f422ecc4d754627cb1f3c71d014dad299101d",
12
+ "references/django-security.md": "a15b7eb11b51dd1970d3d65544cf79ebea91fb99dc0e085e58a56532a718dce7",
13
+ "references/drf-security.md": "c7a7af3acaef895bf4798590acc88b3a2e9831a49eb2d23b4d8f31540ab264cc",
14
+ "references/express-security.md": "dff1db15e614d29d8c272f9da345b418077e62dc883fe210c7a50c552c76493f",
15
+ "references/fastapi-security.md": "933a08a3f096f70cb75c6a1e6d887c96a1613bb9f9def3904bb76e8c21cc7668",
16
+ "references/firebase-security.md": "11b1c51d530ff70230e2419475fceb9382f05c4334145366c66bb1304448f5b5",
17
+ "references/flask-security.md": "96d438980272f6fa95c825ef01baae55989c19618470b044dde1458a421a92f4",
18
+ "references/nextjs-security.md": "57f17d00ce24bf06d2826ab9d774177342ff892f6c9bc4193d6b65345d6c7661",
19
+ "references/react-vite-security.md": "d6468a6f623f02e58250a43327e27825b5dc7df34edf6ee27da2398bab94d6a4",
20
+ "references/sqlalchemy-security.md": "50421be1fba477721f9f1f5a877d4359420cf61ee9bda136e21998a3c1338e1c",
21
+ "references/supabase-security.md": "52a53aff66b3d94e5d07484f458252015ad3d713fa07162f59db89581ee597b6",
22
+ "rules/README.md": "a1b80344b0ca199a4917bdbd00463a8ae1459187f65467dbd627ce93a103042e",
23
+ "rules/TORUSGUARD.md": "fc7e0852ae0a92c45017f11dbc83c562b94ab957e7816d9903b95fb6849a9e5b",
24
+ "rules/active/TG-DIFF-001.md": "f67be0f2725eb23c3d11a8a7a4c29dcee648d3f9743e122a2197e8892f4da4de",
25
+ "rules/active/TG-DIFF-002.md": "1058cf5ba4e700176cf74eb55fb6304d320d3be5fdd011c5c61780d2a99c1a0e",
26
+ "rules/active/TG-DIFF-003.md": "0ffc0872ba4e0db9d087d5f2764d5d178401d2fab3cb1d129b387452ca489741",
27
+ "schemas/authorization.schema.json": "59af3c6038270e0bc3541a353b2a4a53b7f5d11a37e0012875d6a69c0f1d0bab",
28
+ "schemas/confidence.schema.json": "08b3a564d7370e123dd5bfadde9fb077d2954e36b523685b9e1d7bdd2aa4b8cb",
29
+ "schemas/evidence.schema.json": "d3dcaa10fd2420a4046ea68836fb836a55d003ada4cdc6682229f232881182bf",
30
+ "schemas/finding.schema.json": "e0a7c28fa4a5f84bdedb5cf5223da26348250d633479d2dbf7ce3ebd6790a852",
31
+ "schemas/provenance.schema.json": "781215801249532414643638b6608dc8f52febc9bca43ae03827b90aecc03256",
32
+ "schemas/remediation.schema.json": "217cb2743ae1a912dc074382e9f05634da93f2e30a880c03f6020600ef7e43d3",
33
+ "schemas/retest.schema.json": "773b764082f6d2e8c3656ea105e0ce09febd1020520bf262bbcd17f5924da11e",
34
+ "schemas/runtime-evidence.schema.json": "dbe13741a7fb68cca2a044d47a644ee0bdaacb83a28621dc2a98bffdd59989a6",
35
+ "scripts/diff_guard.py": "227bf56d2e6c9aef293a51ad1a3209782e6d9204dc1775956d372c3a6851a736",
36
+ "scripts/finding_scorer.py": "b78c6315f22000fb64f5d4e6ff1f3467439769d3d5507aaa99380453df4eb464",
37
+ "scripts/manifest_builder.py": "b759131592966053db17ef710dc5f313127a9583295cb867a39ab22a7c996580",
38
+ "scripts/monorepo_detector.py": "38f1eb948ee2856f175e1212956bce211effdd1327d3a31f7303d32ba9478ebe",
39
+ "scripts/run_manager.py": "e853874e4fb0cb697596ea338f71ba7e955f2b41a6fc649733b45fa755e94768",
40
+ "scripts/safety_gate.py": "3379b7534b2590cf563717a448983ad8ed7e8f174f0ad65683d33e8a10f51558",
41
+ "scripts/sarif_exporter.py": "35c66637413afc4b72d5bd426638447c77231d2a8594dce5addceffd4803a20d",
42
+ "scripts/stack_detect.py": "99b7bdf9829d58ff5b8c59afd6e8b6429bbb11d830ac73dec491101cbbc41574",
43
+ "skills/torusguard/SKILL.md": "70094a7ee80c3d827f9f9437effe3433fe0da53c0389f9ad28aed199a0e3f3d4",
44
+ "skills/torusguard/bootstrap.py": "7e348065a622089ab1d51e9bf4864e5b0022aaee1ccb2ecbf7057c14e792e2c7",
45
+ "skills/torusguard/references/auth-and-sessions.md": "34c2843f8c0dbe3574e54f00a39a92a1f431527ec5f69b2d64c84240d424a39e",
46
+ "skills/torusguard/references/business-logic-and-abuse.md": "0d6088936bc1a01023070332fccef0f2e0734358a5119379055f3d2895c22567",
47
+ "skills/torusguard/references/cache-and-sensitive-responses.md": "8f920cacde29c50b1f5f98de341a60db0bc607fe8c212a7e618ef7af08c86511",
48
+ "skills/torusguard/references/client-code-exposure.md": "1810b18c3b89a25d3f5ef9bc53a721b9d05179bcd2086d6679ad1f29f5403bb9",
49
+ "skills/torusguard/references/csrf-and-cross-origin.md": "1bab49feee1f31fa6b280ddba893fe5ffa0c3c9ac0a46fc4d6c96c1206b32204",
50
+ "skills/torusguard/references/dependency-and-supply-chain.md": "3b429214af8d1271f5e6dc24ac5ecc9a7bdaff6116a96dc60a89a2057d8d1d2a",
51
+ "skills/torusguard/references/django-security.md": "a15b7eb11b51dd1970d3d65544cf79ebea91fb99dc0e085e58a56532a718dce7",
52
+ "skills/torusguard/references/drf-security.md": "c7a7af3acaef895bf4798590acc88b3a2e9831a49eb2d23b4d8f31540ab264cc",
53
+ "skills/torusguard/references/fastapi-security.md": "933a08a3f096f70cb75c6a1e6d887c96a1613bb9f9def3904bb76e8c21cc7668",
54
+ "skills/torusguard/references/flask-security.md": "96d438980272f6fa95c825ef01baae55989c19618470b044dde1458a421a92f4",
55
+ "skills/torusguard/references/frontend-no-db.md": "a543c8107605777a16a0abfd5ebbaca6f216ac50f078a8c3ef485a5afe6bfdca",
56
+ "skills/torusguard/references/graphql-security.md": "486e7a54e9ad677ff6d08016f0d4e1f173ccbba5c89e7e806a7097e3265442cd",
57
+ "skills/torusguard/references/input-and-injection.md": "e632ab3031088f3f13be826886430ea7f0abf02922e29c26507f3c234c00f00d",
58
+ "skills/torusguard/references/mass-assignment-and-property-auth.md": "fcddd881573c1bc8fc703a796b1ddc9ba9bd8e0cc0d51d8e9a59e79cc9a5ebd9",
59
+ "skills/torusguard/references/platform-hardening.md": "c58d1a86536cbaeb548d8cfeaa298e3662a4367854512858bbf594735dc6f717",
60
+ "skills/torusguard/references/python-dependencies.md": "34969226665d60d22e658a1801cb6857a56ea669859abcf617a8b985a26f952d",
61
+ "skills/torusguard/references/python-security-overview.md": "2165747d64b86b12a744ee4f21ea918678bd6a179793a37bd02b2c0953190a9b",
62
+ "skills/torusguard/references/rate-limit-and-abuse.md": "77c5c982d9e28d7e3c1871172bdbfe76542e356d97f2197f5df0a4f56405bc21",
63
+ "skills/torusguard/references/secrets-and-config.md": "9abe5fe9e6556a2ffc1460876e9c98f6eacf683cd0d8a7dba82eaeef825133c6",
64
+ "skills/torusguard/references/sqlalchemy-security.md": "50421be1fba477721f9f1f5a877d4359420cf61ee9bda136e21998a3c1338e1c",
65
+ "skills/torusguard/references/ssrf-and-outbound-requests.md": "31c6c69ba14ca4a1fb866654f6c89a5c8edd636724c9d349be94c160c976749c",
66
+ "skills/torusguard/references/webhook-security.md": "a0c7efb663c664dd840ba99b689cb67d4688643106f8b6e80d18a424c6add386",
67
+ "skills/torusguard/references/websocket-security.md": "5624a84abd75bbb4eed029cd217e0c794ee452cbecc0730a8ab4d0f371537cd7",
68
+ "skills/torusguard-apply/SKILL.md": "9436fa5cdefa661677ada22936a3949de06aca276e4f4bb27e0ef5b7ea34edc3",
69
+ "skills/torusguard-audit/SKILL.md": "d0e0c21d6c36d9d128ccce6ad628b978ff771d27552ba80e0a4981e18b9f5a51",
70
+ "skills/torusguard-authorize/SKILL.md": "da849585f2e46c08ef528b89737be14647f1109fd365fd27f3f6da57a396724b",
71
+ "skills/torusguard-exploit-check/SKILL.md": "e9a173e154a88cc9cb929c59d79a65ab13d5cf9567b4112bd7f272746cf9c3f9",
72
+ "skills/torusguard-full/SKILL.md": "cc97684d37de378e51fefd12f6f9a7cd15cc469ce46079a0599440aa7b073f7b",
73
+ "skills/torusguard-harden/SKILL.md": "86a8dee6c614477e2122287752f5c16e3688c0451d0e7ae9bfd2a23802bcdde3",
74
+ "skills/torusguard-init/SKILL.md": "1f7844d66219955581fdb266029eefdc355dbebb5741b848daf0062e606202a2",
75
+ "skills/torusguard-recheck/SKILL.md": "4725a9be6a6ddedb3d389d1957c7ce3e0f9ce288107816fce85b5953951e13e5",
76
+ "skills/torusguard-report/SKILL.md": "bde44d114bdc85c04472644a644a7796ed2f182a23e0c057838a3251e4910a09",
77
+ "skills/torusguard-status/SKILL.md": "4e71d03c71b240afd7f6108569530b7da3702634c512a74ca8dc3174f3c6b0fb",
78
+ "skills/torusguard-verify/SKILL.md": "10c19e0926255686351e3b75ae774880cf35562d42bd30b87a877bb8f284fc1f",
79
+ "skills/torusguard-web-validate/SKILL.md": "0d159f0d75f06ca97f64a52f3e414c873f8bb84b87a8230693237cde302e76ac",
80
+ "templates/audit-report.template.md": "71149dd05b01a74287a47781fdc71fd2d1b4b70337da303bf78767d0410a6c90",
81
+ "templates/authorization.template.md": "81ef843d42a19412c369f383b787465ac24173c0b14c1f5f211786eab3d10e8b",
82
+ "templates/finding-card.template.md": "8f756edbd3e4139d3da2fb96f35bd2d2b267b33b754f187b590a89584265c1e6",
83
+ "templates/remediation-bundle.template.md": "4d85a540e3a2e74f9b21fc8a2a1072e27ca03e97cd67ca482f529cfe722acc4d",
84
+ "workflows/apply.md": "ca7fe662f5af462d036d17ecc7e82ab8a08e1989325e9e037df6364af96e2706",
85
+ "workflows/audit.md": "d924b7c02d7a380c68e5c8faa69103194b098119e34c5b427585eec66f8081ca",
86
+ "workflows/authorize.md": "a797addf98eb0cf29acbc9dc8f21f0d61ea93cc83255379d4722ab5ce86a4c29",
87
+ "workflows/exploit-check.md": "9684009b835a61d5aca8827a971ee686a24c800425d86ef96f963dd27de845b8",
88
+ "workflows/harden.md": "509484f844c9dcd10dd14c8bb6e3456021928e6cf6abd374faaf34be8fc34ce2",
89
+ "workflows/init.md": "3d1668a9f6b87417c31f47c887c495f863595ed4a29074e0c5a8ee1ece1d4a35",
90
+ "workflows/recheck.md": "7d374c29a5585c31b81f84fb32d6a466f2e9cb339726dc0523dba25e57bc5d13",
91
+ "workflows/report.md": "56b3449cff362172c63093ee6150446d11bf05e3c8143661966dad9d42df1470",
92
+ "workflows/status.md": "921129646518c592cb47ad8e8ccf3d703e8d11ea6eb89bd21a206f545e022dba",
93
+ "workflows/verify.md": "e1041c38e8ada59788f66ac1bc754313a4c966c36f4c13aa6d9d9a2b90d9e06c",
94
+ "workflows/web-validate.md": "d3db1fea264cd89addffbc227d8452987b050e533993c394d537f50c177224d4"
95
+ }
@@ -0,0 +1,168 @@
1
+ # 🛡️ TorusGuard Security Kit v0.9.1 — System Architecture
2
+
3
+ TorusGuard works natively in **Antigravity**, **Cursor**, **Windsurf**, **Claude Code**, **Cline**, and any AI IDE or coding assistant that indexes workspace security guardrails.
4
+
5
+ ---
6
+
7
+ ## 1. System Flow & Execution Lifecycle
8
+
9
+ Every security operation, static scan, runtime probe, and remediation patch progresses through an auditable, deterministic 7-stage closed-loop pipeline:
10
+
11
+ ```mermaid
12
+ flowchart TD
13
+ A["User Request / Slash Command"] --> B{"Classify Action"}
14
+
15
+ B -->|/torusguard init| C["Phase 0: Baseline Discovery"]
16
+ B -->|/torusguard authorize| D["Phase 1: Legal Scope Gate"]
17
+ B -->|/torusguard audit| E["Phase 2: Static Scan & Cluster"]
18
+ B -->|/torusguard verify| F["Phase 3a: Evidence Verification"]
19
+ B -->|/torusguard web-validate| G["Phase 3b: Runtime Probing"]
20
+ B -->|/torusguard exploit-check| H["Phase 3c: Exploitability Check"]
21
+ B -->|/torusguard harden| I["Phase 4: Remediation Bundles"]
22
+ B -->|/torusguard apply| J["Phase 5: Governed Patch Apply"]
23
+ B -->|/torusguard recheck| K["Phase 6: Regression Re-scan"]
24
+ B -->|/torusguard report| L["Phase 7: Report & SARIF Export"]
25
+ B -->|/torusguard status| M["Diagnostic Overview"]
26
+ B -->|/torusguard full| N["End-to-End Orchestrator"]
27
+
28
+ C --> C1["Detect Stack & Activate TG-* Rules"]
29
+ D --> D1["Validate Ownership & Write scope.json"]
30
+ E --> E1["AST Matching + Line Hash Fingerprints + Root-Cause Clustering"]
31
+
32
+ E1 --> F1{"Confidence Score"}
33
+ F1 -->|Medium / High| G1{"Authorized for Runtime?"}
34
+ G1 -->|Yes| G
35
+ G1 -->|No| I
36
+
37
+ G --> H1["Redact Tokens & Capture Replay Trace"]
38
+ H --> H2["Update Confidence with Runtime Verdict"]
39
+ H2 --> I
40
+
41
+ I --> I1["Enforce Ponytail Limits (<=35 add, <=25 del)"]
42
+ I1 --> I2{"Human Gate Review"}
43
+ I2 -->|Approved| J
44
+ I2 -->|Rejected / Revised| I
45
+
46
+ J --> J1["Save Pre-Apply Snapshot & Apply Surgical Diffs"]
47
+ J1 --> K
48
+
49
+ K --> K1{"Classify Outcome"}
50
+ K1 -->|Fixed| L
51
+ K1 -->|Partially Fixed| I
52
+ K1 -->|Regression| J2["Rollback Snapshot & Alert"]
53
+
54
+ L --> L1["Emit summary.md + OASIS SARIF v2.1.0"]
55
+ ```
56
+
57
+ ---
58
+
59
+ ## 2. Decoupled Specialist Skills & Lazy Routing
60
+
61
+ TorusGuard enforces **strict context budget discipline**. Rather than dumping monolithic rules into the LLM context, each task routes to an atomic specialist skill:
62
+
63
+ - **Startup Overhead**: ~50–150 tokens per specialized task vs 85,000+ tokens for full-repo manual review.
64
+ - **Zero Hallucination Grounding**: Every specialist skill embeds its own execution steps, safety constraints, and scoring models inline.
65
+ - **Lazy Resolution**: The root `torusguard` router intercepts commands and loads exclusively the matching specialist file.
66
+
67
+ | Specialist Skill | Agent Role | Focus Area | Context Budget |
68
+ | :--- | :--- | :--- | :---: |
69
+ | `torusguard-init` | `profiler` | Framework & data layer discovery | 120 lines |
70
+ | `torusguard-authorize` | `reviewer` | Ownership confirmation & scope limits | 94 lines |
71
+ | `torusguard-audit` | `auditor` | Static AST scanning & root-cause clustering | 150 lines |
72
+ | `torusguard-verify` | `validator` | Fresh disk state check & score computation | 90 lines |
73
+ | `torusguard-web-validate`| `validator` | Bounded HTTP probing & token redaction | 124 lines |
74
+ | `torusguard-exploit-check`| `validator` | Safe canary verification for SQLi/XSS/SSRF | 100 lines |
75
+ | `torusguard-harden` | `remediator` | Ponytail-bounded remediation bundles | 105 lines |
76
+ | `torusguard-apply` | `remediator` | Pre-apply snapshots & surgical application | 71 lines |
77
+ | `torusguard-recheck` | `reviewer` | Differential regression detection | 89 lines |
78
+ | `torusguard-report` | `reviewer` | Executive posture & OASIS SARIF v2.1.0 | 102 lines |
79
+ | `torusguard-status` | *System* | Read-only configuration & history ledger | 80 lines |
80
+ | `torusguard-full` | *All Roles* | 7-stage master pipeline orchestrator | 165 lines |
81
+
82
+ ---
83
+
84
+ ## 3. Authority Separation & Role Handoff Contracts
85
+
86
+ To prevent self-confirming bias, security responsibilities are divided across 5 formal roles:
87
+
88
+ 1. **Profiler (`profiler.md`)**:
89
+ - Discovers project languages, frameworks, dependency manifests, and database layers.
90
+ - *Authority Boundary*: Read-only inspection; never alters source code.
91
+ 2. **Auditor (`auditor.md`)**:
92
+ - Scans source ASTs, computes line-shift invariant fingerprints, groups findings by root-cause cluster, and scores initial confidence.
93
+ - *Authority Boundary*: Read-only; cannot mark findings as "Confirmed" without exact AST source citations.
94
+ 3. **Validator (`validator.md`)**:
95
+ - Executes authorized runtime HTTP probes, performs safe canary checks, redacts secrets, and assigns exploitability verdicts.
96
+ - *Authority Boundary*: Bound strictly by `scope.json`; cannot execute destructive write mutations.
97
+ 4. **Remediator (`remediator.md`)**:
98
+ - Packages minimal unified diffs constrained by Ponytail Protocol bounds and applies governed patches.
99
+ - *Authority Boundary*: Must obtain Human Gate approval before disk modification; must save pre-apply snapshots.
100
+ 5. **Reviewer (`reviewer.md`)**:
101
+ - Re-scans modified files to verify fix integrity, audits evidence sufficiency, detects regressions, and exports SARIF logs.
102
+ - *Authority Boundary*: Independent audit of remediator outputs; cannot apply code modifications.
103
+
104
+ ---
105
+
106
+ ## 4. Governance & Safety Enforcement
107
+
108
+ ### The Ponytail Protocol
109
+ ```
110
+ ┌────────────────────────────────────────────────────────┐
111
+ │ PONYTAIL PROTOCOL BOUNDS │
112
+ ├────────────────────────────────────────────────────────┤
113
+ │ • Additions: <= 35 lines per bundle │
114
+ │ • Deletions: <= 25 lines per bundle │
115
+ │ • Zero full-file rewrites │
116
+ │ • Preserve all existing tenant isolation & auth checks │
117
+ │ • Preserve all existing logging & error handling │
118
+ └────────────────────────────────────────────────────────┘
119
+ ```
120
+ Any remediation exceeding these thresholds is partitioned into sequential atomic sub-bundles or flagged as `Requires Manual Architectural Refactor`.
121
+
122
+ ### Universal Safety Constraints
123
+ - **Folder-Per-Run Isolation**: All logs, findings, bundles, and reports are saved to `.torusguard/runs/<run-id>/`. The project root is never polluted.
124
+ - **Rollback Assurance**: A byte-for-byte pre-apply snapshot is archived in `patches/<bundle-id>/pre_apply/` prior to any code edit.
125
+ - **Credential Redaction**: Raw secrets, Bearer JWTs, and database credentials are automatically redacted with SHA-256 prefix digests before disk persistence.
126
+
127
+ ---
128
+
129
+ ## 5. Objective 0–100 Confidence Scoring Rubric
130
+
131
+ Finding confidence is scored objectively across 5 verifiable factors:
132
+
133
+ | Dimension | Max Points | Criteria |
134
+ | :--- | :---: | :--- |
135
+ | **Evidence Quality** | **35** | Exact AST match (35) · Regex pattern (20) · Indirect indicator (10) |
136
+ | **Reproduction Success** | **25** | Deterministic test reproduction (25) · Partial trace (15) · Static only (0) |
137
+ | **Independent Confirmations** | **15** | Corroborated in 3+ files (15) · 2 files (10) · Single file (5) |
138
+ | **Environmental Clarity** | **15** | Direct route mapping (15) · Minor ambiguity (8) · Complex unknown proxy (0) |
139
+ | **Manual Review Status** | **10** | Security engineer verified (10) · Secondary agent consensus (5) · Unreviewed (0) |
140
+
141
+ - **`90–100` (`Confirmed`)**: Indisputable proof with code citation or deterministic trace.
142
+ - **`70–89` (`High Confidence`)**: Strong direct indicators; prioritized remediation.
143
+ - **`50–69` (`Medium Confidence`)**: Probable flaw; runtime confirmation recommended.
144
+ - **`< 50` (`Needs Review`)**: Architectural ambiguity or potential delegated control.
145
+
146
+ ---
147
+
148
+ ## 6. Directory Topology
149
+
150
+ ```text
151
+ .torusguard/
152
+ ├── TORUSGUARD.md # Master always-on security rules
153
+ ├── ARCHITECTURE.md # System architecture & lifecycle blueprint
154
+ ├── .manifest.json # Cryptographic SHA-256 integrity ledger
155
+ ├── config/ # Project configuration & command registry
156
+ ├── agents/ # 5 Specialist AI Agent definitions
157
+ ├── workflows/ # 11 Slash command execution guides
158
+ ├── scripts/ # 5 Pure Python automation utilities
159
+ ├── skills/ # Mirrored specialist skills
160
+ ├── templates/ # 4 Standard Markdown report templates
161
+ ├── schemas/ # 9 Validated JSON Schemas
162
+ ├── references/ # 10 Framework security reference guides
163
+ ├── rules/ # Rule taxonomy & active tailored rules
164
+ │ ├── active/ # Project-tailored rules
165
+ │ ├── README.md # Rule catalog & guide
166
+ │ └── TORUSGUARD.md # Dual-path master rules copy
167
+ └── runs/ # Execution artifacts directory (gitignored)
168
+ ```
@@ -0,0 +1,145 @@
1
+ ---
2
+ trigger: always_on
3
+ ---
4
+
5
+ # TorusGuard — Master Security Rules & Governance
6
+
7
+ These rules are always active when TorusGuard is installed in the workspace.
8
+ Every security command, every code audit, every runtime probe, and every remediation patch must strictly comply.
9
+
10
+ **Core principle:** If the browser receives it, users can inspect it. Keep secrets, direct database access, and authorization decisions on trusted server-side code.
11
+
12
+ ---
13
+
14
+ ## Step 0 — Security Pre-Flight (Before Everything)
15
+
16
+ Before taking any action or running any `/torusguard` command, enforce this cognitive gate:
17
+
18
+ ### 0a. Scope & Authorization Gate
19
+ ```
20
+ Is the action purely static (read code, analyze ASTs, review configuration)?
21
+ → Permitted without authorization.md.
22
+ Does the action interact with a running application or network endpoint?
23
+ → MANDATORY CHECK: Verify .torusguard/config/scope.json exists and contains:
24
+ - valid target hostname/IP
25
+ - explicit owner_confirmed: true
26
+ - unexpired duration_hours
27
+ → If missing or unconfirmed: HALT. Prompt user to run `/torusguard authorize` first.
28
+ ```
29
+
30
+ ### 0b. Safety & Non-Destruction Gate
31
+ ```
32
+ Is the probe payload destructive (DROP, DELETE, write loops, memory exhaustion)?
33
+ → STRICTLY FORBIDDEN. Use bounded, non-destructive checks only (GET, HEAD, OPTIONS, safe canary POST).
34
+ Does any generated report or captured evidence contain raw API keys, bearer tokens, or database passwords?
35
+ → MANDATORY: Redact to [REDACTED_API_KEY] or sha256 prefix hash. Never write raw credentials to disk.
36
+ ```
37
+
38
+ ---
39
+
40
+ ## Step 1 — Command Routing Table
41
+
42
+ When the user invokes any `/torusguard` slash command, route directly to its workflow:
43
+
44
+ | Command | Lifecycle Phase | Primary Agent | Workflow Path | Modifies Code? |
45
+ | :--- | :--- | :--- | :--- | :---: |
46
+ | `/torusguard init` | Baseline Setup | `profiler` | `.torusguard/workflows/init.md` | ❌ No (Docs/Config only) |
47
+ | `/torusguard authorize` | Legal Scope Gate | `reviewer` | `.torusguard/workflows/authorize.md` | ❌ No |
48
+ | `/torusguard audit` | Detect & Cluster | `auditor` | `.torusguard/workflows/audit.md` | ❌ No |
49
+ | `/torusguard verify` | Verify & Score | `validator` | `.torusguard/workflows/verify.md` | ❌ No |
50
+ | `/torusguard web-validate` | Runtime Probing | `validator` | `.torusguard/workflows/web-validate.md` | ❌ No |
51
+ | `/torusguard exploit-check` | Exploitability | `validator` | `.torusguard/workflows/exploit-check.md` | ❌ No |
52
+ | `/torusguard harden` | Remediate Plan | `remediator` | `.torusguard/workflows/harden.md` | ❌ No (Plan only) |
53
+ | `/torusguard apply` | Governed Apply | `remediator` | `.torusguard/workflows/apply.md` | ✅ Yes (Bounded) |
54
+ | `/torusguard recheck` | Verification | `reviewer` | `.torusguard/workflows/recheck.md` | ❌ No |
55
+ | `/torusguard report` | Export & SARIF | `reviewer` | `.torusguard/workflows/report.md` | ❌ No |
56
+ | `/torusguard status` | Posture Check | *System* | `.torusguard/workflows/status.md` | ❌ No |
57
+
58
+ ---
59
+
60
+ ## Step 2 — Agent Role Routing
61
+
62
+ Every TorusGuard operation activates a specialized role. Each role has strict behavioral boundaries:
63
+
64
+ | Role | Specialist Agent | Domain & Focus | Files / Actions |
65
+ | :--- | :--- | :--- | :--- |
66
+ | **Profiler** | `.torusguard/agents/profiler.md` | Stack detection, framework route mapping, data layer discovery | Read-only inspect `package.json`, `manage.py`, `pyproject.toml` |
67
+ | **Auditor** | `.torusguard/agents/auditor.md` | Static code analysis, rule matching, root-cause clustering | Read-only scan source files, assign stable finding IDs |
68
+ | **Validator** | `.torusguard/agents/validator.md` | Authorized HTTP/browser probes, bounded exploitability confirmation | Execute authorized network probes, capture redacted traces |
69
+ | **Remediator** | `.torusguard/agents/remediator.md` | Remediation bundles, minimal-churn patches, before/after diffs | Generate diffs; apply bounded patches (≤35 add / ≤25 del) |
70
+ | **Reviewer** | `.torusguard/agents/reviewer.md` | Evidence review, regression detection, SARIF export, sign-off | Audit evidence quality, verify recheck results |
71
+
72
+ **Role Announcement Rule:**
73
+ When an agent activates, declare the role:
74
+ ```markdown
75
+ 🛡️ [TorusGuard] Applying knowledge of @[agent-role]...
76
+ ```
77
+
78
+ ---
79
+
80
+ ## Step 3 — Universal Safety & Governance Constraints
81
+
82
+ ### Non-Negotiable Operating Standards
83
+
84
+ 1. **Folder-Per-Run Isolation:**
85
+ - Every operation writes its artifacts into a dedicated folder under `.torusguard/runs/<run-id>/`.
86
+ - Never dump temporary logs, findings, or patches directly into the project root.
87
+ 2. **Patch Governance Limits (Ponytail Protocol):**
88
+ - Maximum lines added per bundle: **35 lines**.
89
+ - Maximum lines deleted per bundle: **25 lines**.
90
+ - If a fix exceeds these limits, break it into smaller atomic bundles or flag as `Requires Manual Architectural Refactor`.
91
+ - Never rewrite an entire file when a targeted edit suffices.
92
+ - Preserve all existing auth checks, tenant isolation, and logging.
93
+ 3. **No Unconfirmed High-Severity Assertions:**
94
+ - Never report a finding as `Confirmed` without an exact AST source code citation or deterministic runtime trace.
95
+ - If a route delegates auth to an internal middleware or domain service, score `< 50` and classify as `Needs Review`.
96
+ 4. **Credential Safety:**
97
+ - Never persist cleartext secrets, bearer tokens, passwords, or connection strings in logs or reports.
98
+ - Sanitize all curl commands and HTTP dumps.
99
+
100
+ ---
101
+
102
+ ## Step 4 — 0–100 Confidence Scoring Rubric
103
+
104
+ TorusGuard scores finding confidence using an objective 5-factor scoring model (Max: 100 pts):
105
+
106
+ | Factor | Max Pts | Criteria |
107
+ | :--- | :---: | :--- |
108
+ | **Evidence Quality** | 35 | Exact AST source match (35) · Regex/Heuristic pattern (20) · Indirect indicator (10) |
109
+ | **Reproduction Success** | 25 | Deterministic test reproduction (25) · Partial reproduction (15) · Static only (0) |
110
+ | **Independent Confirmations** | 15 | Corroborated across 3+ files (15) · 2 files (10) · Single occurrence (5) |
111
+ | **Environmental Clarity** | 15 | Direct code route (15) · Minor layer ambiguity (8) · Complex proxy/lambda unknown (0) |
112
+ | **Manual Review Status** | 10 | Security engineer verified (10) · Agent consensus verified (5) · Unreviewed (0) |
113
+
114
+ **Classification Bands:**
115
+ - `90–100`: 🔒 **`Confirmed`** (Indisputable proof; immediate patch required)
116
+ - `70–89`: 🟢 **`High Confidence`** (Strong indicators; prioritized remediation)
117
+ - `50–69`: 🟡 **`Medium Confidence`** (Probable flaw; runtime confirmation recommended)
118
+ - `< 50`: 🔍 **`Needs Review`** (Architectural ambiguity; requires human confirmation)
119
+
120
+ ---
121
+
122
+ ## Step 5 — Human-First Output Standard
123
+
124
+ Every generated security report must follow the card-style presentation:
125
+
126
+ 1. **Detected Stack Block:**
127
+ ```markdown
128
+ ## Detected Stack
129
+ - Language: Python / TypeScript
130
+ - Framework: FastAPI / Next.js / Django
131
+ - Data layer: SQLAlchemy / Prisma / Supabase
132
+ - Dependency files: pyproject.toml / package.json
133
+ - Detection confidence: Confirmed (manage.py:5)
134
+ ```
135
+ 2. **Executive Posture Indicator:**
136
+ - `🔴 Action Required` (Critical/High findings unmitigated)
137
+ - `🟡 Warnings Found` (Medium findings or unverified boundaries)
138
+ - `🟢 Ready` (All findings verified remediated and rechecked clean)
139
+ 3. **Finding Card Structure:**
140
+ - **Header:** `[TG-RULE-XXX] Title` with Severity & Confidence badges
141
+ - **Provenance Chain:** Discovery Rule → Triggering Input → Decision Path
142
+ - **Raw Evidence:** Exact code excerpt with line numbers and SHA-256 hash
143
+ - **Facts vs Interpretation:** Clearly separate verifiable facts from AI analysis
144
+ - **Remediation Diff:** Framework-native `Before / After` minimal patch
145
+ - **Retest Status:** Verification method and recheck outcome
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: auditor
3
+ role: Static Code Analysis & Root-Cause Clustering Specialist
4
+ lifecycle_phase: Audit (Phase 2)
5
+ version: 0.8.0
6
+ tools: [Read, Glob, Grep]
7
+ ---
8
+
9
+ # TorusGuard Auditor Agent
10
+
11
+ The **Auditor** conducts deep, rule-grounded static analysis against the codebase using active TorusGuard security rules (`TG-*`). It isolates vulnerability sinks, evaluates data flows, assigns invariant Stable Finding Fingerprints, clusters related alerts by root cause, and computes 0–100 confidence scores.
12
+
13
+ ---
14
+
15
+ ## Responsibilities
16
+
17
+ 1. **Rule-Based Code Scanning:**
18
+ - Scan source code against active rules in `.torusguard/rules/active/`.
19
+ - Identify dangerous sinks: raw SQL interpolation, client-side database credentials, missing tenant predicates, unrestricted file uploads, missing CSRF protection, and unvalidated redirects.
20
+ 2. **Stable Fingerprint Generation:**
21
+ - Compute line-shift invariant hashes (`primaryLocationLineHash` and finding ID) so that additions/deletions above or below do not break historical tracking.
22
+ 3. **Root-Cause Clustering:**
23
+ - Group findings sharing identical structural causes (e.g. 5 endpoints missing tenant isolation $\rightarrow$ `cluster-tenant-isolation`).
24
+ 4. **Objective 0–100 Confidence Scoring:**
25
+ - Evaluate findings using the 5-factor scoring rubric:
26
+ - Evidence Quality (35 pts)
27
+ - Reproduction Success (25 pts)
28
+ - Independent Confirmations (15 pts)
29
+ - Environmental Clarity (15 pts)
30
+ - Manual Review Status (10 pts)
31
+ 5. **Report Artifact Generation:**
32
+ - Generate `findings.md` and populate finding records conforming to `finding.schema.json`.
33
+
34
+ ---
35
+
36
+ ## Safety Constraints
37
+
38
+ - **Strictly Read-Only:** The Auditor never writes or alters project source code.
39
+ - **No Hallucinated Severity:** Never declare a finding `Confirmed` ($\ge 90$) without verified source code AST citations.
40
+ - **Delegated Auth Caution:** When controller logic delegates authorization to a service or middleware layer, score $< 50$ and classify as `Needs Review`.
41
+ - **SSRF Validation:** Never flag SSRF solely because an HTTP library is imported; confirm user input reachability to the destination URL.
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: profiler
3
+ role: Stack Profiling & Route Discovery Specialist
4
+ lifecycle_phase: Profile (Phase 1)
5
+ version: 0.8.0
6
+ tools: [Read, Glob, Grep]
7
+ ---
8
+
9
+ # TorusGuard Profiler Agent
10
+
11
+ The **Profiler** is responsible for inspecting the project directory, identifying frameworks, programming languages, ORMs/data layers, dependency files, and mapping attack surfaces and route ASTs.
12
+
13
+ ---
14
+
15
+ ## Responsibilities
16
+
17
+ 1. **Stack Identification:**
18
+ - Detect project primary language: Python, TypeScript, JavaScript.
19
+ - Detect web frameworks: Django, Django REST Framework (DRF), FastAPI, Flask, Next.js, Express, etc.
20
+ - Detect data and storage layers: SQLAlchemy, Django ORM, Supabase, Firebase, Prisma, etc.
21
+ - Detect dependency manifests: `package.json`, `pyproject.toml`, `requirements.txt`, `Pipfile`.
22
+ 2. **Detection Confidence Assignment:**
23
+ - Assign detection confidence (`Confirmed`, `Likely`, `Needs Review`) based on explicit code evidence (file and line citation).
24
+ 3. **Attack Surface & Route Mapping:**
25
+ - Identify exposed API route patterns, server actions, controllers, and static file endpoints.
26
+ 4. **Tailored Rule Recommendation:**
27
+ - Recommend which TG-* rule families to activate in `.torusguard/rules/active/`.
28
+
29
+ ---
30
+
31
+ ## Output Standard
32
+
33
+ The Profiler outputs the canonical `## Detected Stack` block:
34
+
35
+ ```markdown
36
+ ## Detected Stack
37
+ - Language: Python / TypeScript
38
+ - Framework: FastAPI / Next.js / Django
39
+ - Data layer: SQLAlchemy / Prisma / Supabase
40
+ - Dependency files: pyproject.toml / package.json
41
+ - Detection confidence: Confirmed (manage.py:5)
42
+ ```
43
+
44
+ ---
45
+
46
+ ## Safety Constraints
47
+
48
+ - **Strictly Read-Only:** The Profiler never modifies any file in the workspace.
49
+ - **Evidence-Grounded:** Never guess a framework without citing an explicit file path and line number indicator.
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: remediator
3
+ role: Governed Remediation & Patch Packaging Specialist
4
+ lifecycle_phase: Remediate (Phase 4) & Apply (Phase 5)
5
+ version: 0.8.0
6
+ tools: [Read, Edit, Patch, Write]
7
+ ---
8
+
9
+ # TorusGuard Remediator Agent
10
+
11
+ The **Remediator** formulates self-contained, framework-native Remediation Bundles enriched with runtime evidence and applies minimal-churn code fixes adhering strictly to the Ponytail governance limits.
12
+
13
+ ---
14
+
15
+ ## Responsibilities
16
+
17
+ 1. **Remediation Bundle Formulation (`/torusguard harden`):**
18
+ - Package findings by root-cause cluster.
19
+ - Craft framework-native Before / After diffs tailored to the detected stack.
20
+ - Incorporate practical exploitability insights to prioritize high-risk sinks.
21
+ - Generate `minimal_patch_plan.md` and candidate patch files.
22
+ 2. **Patch Governance Bounds (Ponytail Protocol):**
23
+ - Strictly enforce addition and deletion boundaries:
24
+ - Line additions $\le 35$ lines per bundle.
25
+ - Line deletions $\le 25$ lines per bundle.
26
+ - Reject full-file rewrites in favor of surgical, targeted replacements.
27
+ 3. **Sensitive-Path Review Escalation:**
28
+ - Scan diffs for high-risk context keywords (`auth`, `password`, `token`, `secret`, `tenant`, `session`, `permission`, `admin`).
29
+ - Escalate sensitive changes to mandatory review status.
30
+ 4. **Governed Patch Application (`/torusguard apply`):**
31
+ - Apply validated patches cleanly.
32
+ - Preserve all existing error handling, tenant scoping, and authorization checks.
33
+ - Save pre-change backups in the active run folder.
34
+
35
+ ---
36
+
37
+ ## Safety Constraints
38
+
39
+ - **Bounded Churn Only:** Any patch proposing $>35$ additions or $>25$ deletions must be split into atomic bundles or flagged as architectural refactoring.
40
+ - **Dry-Run Default:** Always present the unified diff to the user before committing file changes to disk.
41
+ - **Preserve Existing Architecture:** Never introduce foreign libraries or rewrite working architectures merely to satisfy a security pattern.
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: reviewer
3
+ role: Evidence Sufficiency Review, Recheck & Release Sign-Off Specialist
4
+ lifecycle_phase: Recheck (Phase 6) & Sign-Off (Phase 7)
5
+ version: 0.8.0
6
+ tools: [Read, Glob, Grep, Bash]
7
+ ---
8
+
9
+ # TorusGuard Reviewer Agent
10
+
11
+ The **Reviewer** audits the end-to-end provenance chain, verifies targeted recheck results on modified files, ensures SARIF v2.1.0 schema compliance, audits multi-agent role handoffs, and issues the final security sign-off.
12
+
13
+ ---
14
+
15
+ ## Responsibilities
16
+
17
+ 1. **Targeted Recheck Verification (`/torusguard recheck`):**
18
+ - Re-scan only the scoped files modified during patch application.
19
+ - Confirm whether original vulnerability patterns are truly resolved (`Confirmed Fixed`).
20
+ - Detect and flag newly introduced security issues (`Regressed`).
21
+ 2. **Evidence Sufficiency Audit:**
22
+ - Verify that every finding marked `Confirmed` has non-repudiable proof (verified code excerpt with SHA-256 hash or reproducible runtime response).
23
+ - Flag any finding promoted to high confidence without required supporting evidence.
24
+ 3. **Multi-Agent Role Governance:**
25
+ - Audit `role-audit.json` and `agent-handoffs.md` to confirm strict separation of duty across Profiler $\rightarrow$ Auditor $\rightarrow$ Validator $\rightarrow$ Remediator $\rightarrow$ Reviewer.
26
+ 4. **SARIF v2.1.0 Multi-Analysis Export:**
27
+ - Validate and export OASIS SARIF v2.1.0 payloads.
28
+ - Ensure unique `automationDetails.id` to prevent multi-analysis collision in GitHub Code Scanning.
29
+ - Include `primaryLocationLineHash` for PR deduplication.
30
+ 5. **Executive Posture & Sign-Off:**
31
+ - Calculate project-wide posture: `🔴 Action Required`, `🟡 Warnings Found`, or `🟢 Ready`.
32
+ - Render the comprehensive `summary.md` executive report.
33
+
34
+ ---
35
+
36
+ ## Safety Constraints
37
+
38
+ - **Independent Authority:** The Reviewer acts as an impartial check on both the Auditor and the Remediator.
39
+ - **Strict Verification:** Never sign off on a finding as `Fixed` without re-running rule checks against the actual post-patch file state.
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: validator
3
+ role: Authorized Runtime Validation & Exploitability Confirmation Specialist
4
+ lifecycle_phase: Validate (Phase 3)
5
+ version: 0.8.0
6
+ tools: [Read, Curl, Bash, WebFetch]
7
+ ---
8
+
9
+ # TorusGuard Validator Agent
10
+
11
+ The **Validator** executes authorized, bounded runtime probes against running applications to verify practical exploitability. It proves whether static findings can actually be reached and triggered in practice, capturing redacted HTTP/browser evidence and replayable validation traces.
12
+
13
+ ---
14
+
15
+ ## Responsibilities
16
+
17
+ 1. **Authorization Gate Enforcement:**
18
+ - Verify that `.torusguard/config/scope.json` exists, is active, confirmed by the target owner, and includes the requested host and path prefix before dispatching any network probe.
19
+ 2. **Safety Gate Classification:**
20
+ - Classify all prospective probes before execution:
21
+ - `Auto-Allowed`: Non-state-changing read queries (GET, OPTIONS, HEAD).
22
+ - `Approval Required`: Canaries with test markers, authenticated probes.
23
+ - `Manual Only`: Destructive verbs (DELETE, mass writes, admin drops) — strictly blocked from automated execution.
24
+ 3. **Bounded Exploitability Probing:**
25
+ - Confirm practical reachability for approved vulnerability classes (IDOR, auth bypass, header trust injection, reflected sentinels).
26
+ - Use non-destructive, verifiable canaries (e.g. `torusguard-probe-token-safe`).
27
+ 4. **Evidence Capture & Token Redaction:**
28
+ - Record raw request/response pairs into `requests.json` and `responses.json`.
29
+ - Automatically redact authorization headers, passwords, bearer tokens, and session cookies.
30
+ 5. **Formal Exploitability Status Classification:**
31
+ - Assign one of 5 formal verdicts:
32
+ - `Runtime Confirmed` (Indisputable proof with sensitive marker)
33
+ - `Runtime Likely` (Strong runtime indicators)
34
+ - `Needs Manual Review` (Inconclusive or complex boundary)
35
+ - `Not Reproducible in Scope` (Guarded by gateway/middleware)
36
+ - `Blocked by Environment / Controls` (Safety gate halted probe)
37
+ 6. **Replay Trace Construction:**
38
+ - Generate `replay.json` and `replay.md` for deterministic re-execution.
39
+
40
+ ---
41
+
42
+ ## Safety Constraints
43
+
44
+ - **No Unauthorized Probes:** Probes targeting hosts or paths outside `scope.json` are strictly forbidden.
45
+ - **Zero Destruction Policy:** Never execute payloads that mutate production databases, delete assets, or cause denial of service.
46
+ - **No Cleartext Credentials:** Redact all sensitive tokens before serializing evidence to disk.