torusguard 2.0.0-alpha → 2.1.1

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 (227) hide show
  1. package/.torusguard/.manifest.json +94 -30
  2. package/.torusguard/core/__init__.py +146 -0
  3. package/.torusguard/core/agent_roles.py +104 -0
  4. package/.torusguard/core/ast_walker.py +283 -0
  5. package/.torusguard/core/authorization.py +218 -0
  6. package/.torusguard/core/browser_verifier.py +128 -0
  7. package/.torusguard/core/bundle.py +141 -0
  8. package/.torusguard/core/call_graph.py +184 -0
  9. package/.torusguard/core/clustering.py +275 -0
  10. package/.torusguard/core/confidence.py +120 -0
  11. package/.torusguard/core/cross_file_taint.py +101 -0
  12. package/.torusguard/core/exploit_checker.py +317 -0
  13. package/.torusguard/core/formatter.py +351 -0
  14. package/.torusguard/core/governance.py +210 -0
  15. package/.torusguard/core/identity.py +104 -0
  16. package/.torusguard/core/import_resolver.py +91 -0
  17. package/.torusguard/core/incremental.py +102 -0
  18. package/.torusguard/core/lifecycle.py +137 -0
  19. package/.torusguard/core/models.py +425 -0
  20. package/.torusguard/core/parallel.py +56 -0
  21. package/.torusguard/core/parser.py +202 -0
  22. package/.torusguard/core/rechecker.py +107 -0
  23. package/.torusguard/core/replay_trace.py +178 -0
  24. package/.torusguard/core/rules_registry.py +131 -0
  25. package/.torusguard/core/run_folder.py +60 -0
  26. package/.torusguard/core/run_manager.py +163 -0
  27. package/.torusguard/core/runtime_evidence.py +175 -0
  28. package/.torusguard/core/runtime_validator.py +246 -0
  29. package/.torusguard/core/safety_gate.py +139 -0
  30. package/.torusguard/core/sarif.py +189 -0
  31. package/.torusguard/core/stack_profiler.py +184 -0
  32. package/.torusguard/core/symbol_table.py +91 -0
  33. package/.torusguard/core/taint.py +133 -0
  34. package/.torusguard/core/taint_graph.py +235 -0
  35. package/.torusguard/core/taint_rules.py +268 -0
  36. package/.torusguard/core/v070_reporter.py +102 -0
  37. package/.torusguard/core/v070_workflow.py +339 -0
  38. package/.torusguard/core/v6_reporter.py +180 -0
  39. package/.torusguard/core/v6_workflow.py +221 -0
  40. package/.torusguard/core/watcher.py +58 -0
  41. package/.torusguard/rules/TG-INPUT-007-unvalidated-redirect.md +53 -0
  42. package/.torusguard/rules/TG-INPUT-008-insecure-deserialization.md +52 -0
  43. package/.torusguard/rules/container/TG-CONT-001-root-user-execution.md +50 -0
  44. package/.torusguard/rules/container/TG-CONT-002-docker-socket-mount.md +47 -0
  45. package/.torusguard/rules/container/TG-CONT-003-privileged-container-mode.md +53 -0
  46. package/.torusguard/rules/container/TG-CONT-004-build-arg-secret-exposure.md +43 -0
  47. package/.torusguard/rules/git/TG-GIT-001-historical-secret-in-git-commit.md +44 -0
  48. package/.torusguard/rules/git/TG-GIT-002-plaintext-credentials-in-git-config.md +41 -0
  49. package/.torusguard/rules/git/TG-GIT-003-sensitive-tracked-file-gitignore-breach.md +40 -0
  50. package/.torusguard/rules/rag/TG-RAG-001-untrusted-rag-context-injection.md +72 -0
  51. package/.torusguard/rules/rag/TG-RAG-002-autonomous-llm-tool-unsandboxed-call.md +51 -0
  52. package/.torusguard/rules/rag/TG-RAG-003-unpartitioned-vector-tenant-lookup.md +51 -0
  53. package/.torusguard/rules/redos/TG-REDOS-001-catastrophic-exponential-backtracking.md +46 -0
  54. package/.torusguard/rules/redos/TG-REDOS-002-unbounded-nested-quantifier.md +43 -0
  55. package/.torusguard/rules_catalog.json +96 -0
  56. package/.torusguard/scripts/__pycache__/audit_runner.cpython-314.pyc +0 -0
  57. package/.torusguard/scripts/__pycache__/finding_scorer.cpython-314.pyc +0 -0
  58. package/.torusguard/scripts/__pycache__/manifest_builder.cpython-314.pyc +0 -0
  59. package/.torusguard/scripts/__pycache__/rules_sync.cpython-314.pyc +0 -0
  60. package/.torusguard/scripts/audit_runner.py +108 -10
  61. package/.torusguard/scripts/finding_scorer.py +43 -13
  62. package/.torusguard/scripts/manifest_builder.py +1 -1
  63. package/.torusguard/scripts/skill_profiler.py +26 -0
  64. package/.torusguard/skills/torusguard/SKILL.md +74 -25
  65. package/.torusguard/skills/torusguard/bootstrap.py +57 -24
  66. package/.torusguard/skills/torusguard-ai-guard/SKILL.md +95 -0
  67. package/.torusguard/skills/torusguard-apply/SKILL.md +60 -34
  68. package/.torusguard/skills/torusguard-audit/SKILL.md +131 -57
  69. package/.torusguard/skills/torusguard-authorize/SKILL.md +48 -6
  70. package/.torusguard/skills/torusguard-container/SKILL.md +94 -0
  71. package/.torusguard/skills/torusguard-exploit-check/SKILL.md +50 -6
  72. package/.torusguard/skills/torusguard-full/SKILL.md +62 -19
  73. package/.torusguard/skills/torusguard-git-mine/SKILL.md +92 -0
  74. package/.torusguard/skills/torusguard-harden/SKILL.md +81 -50
  75. package/.torusguard/skills/torusguard-init/SKILL.md +61 -14
  76. package/.torusguard/skills/torusguard-ocr-scan/SKILL.md +94 -0
  77. package/.torusguard/skills/torusguard-recheck/SKILL.md +71 -18
  78. package/.torusguard/skills/torusguard-redos/SKILL.md +91 -0
  79. package/.torusguard/skills/torusguard-report/SKILL.md +50 -9
  80. package/.torusguard/skills/torusguard-status/SKILL.md +63 -10
  81. package/.torusguard/skills/torusguard-verify/SKILL.md +52 -10
  82. package/.torusguard/skills/torusguard-web-validate/SKILL.md +53 -8
  83. package/.torusguard/workflows/ai-guard.md +31 -0
  84. package/.torusguard/workflows/apply.md +32 -55
  85. package/.torusguard/workflows/audit.md +35 -49
  86. package/.torusguard/workflows/authorize.md +27 -50
  87. package/.torusguard/workflows/container.md +29 -0
  88. package/.torusguard/workflows/exploit-check.md +28 -50
  89. package/.torusguard/workflows/git-mine.md +25 -0
  90. package/.torusguard/workflows/harden.md +29 -48
  91. package/.torusguard/workflows/init.md +27 -50
  92. package/.torusguard/workflows/memory.md +18 -23
  93. package/.torusguard/workflows/ocr-scan.md +25 -0
  94. package/.torusguard/workflows/recheck.md +28 -46
  95. package/.torusguard/workflows/redos.md +27 -0
  96. package/.torusguard/workflows/report.md +33 -52
  97. package/.torusguard/workflows/status.md +31 -52
  98. package/.torusguard/workflows/verify.md +29 -49
  99. package/.torusguard/workflows/web-validate.md +22 -45
  100. package/README.md +96 -60
  101. package/package.json +7 -2
  102. package/skills/torusguard/SKILL.md +75 -24
  103. package/skills/torusguard/__pycache__/bootstrap.cpython-314.pyc +0 -0
  104. package/skills/torusguard/bootstrap.py +60 -71
  105. package/skills/torusguard/payload/.manifest.json +94 -31
  106. package/skills/torusguard/payload/core/__init__.py +146 -0
  107. package/skills/torusguard/payload/core/agent_roles.py +104 -0
  108. package/skills/torusguard/payload/core/ast_walker.py +283 -0
  109. package/skills/torusguard/payload/core/authorization.py +218 -0
  110. package/skills/torusguard/payload/core/browser_verifier.py +128 -0
  111. package/skills/torusguard/payload/core/bundle.py +141 -0
  112. package/skills/torusguard/payload/core/call_graph.py +184 -0
  113. package/skills/torusguard/payload/core/clustering.py +275 -0
  114. package/skills/torusguard/payload/core/confidence.py +120 -0
  115. package/skills/torusguard/payload/core/cross_file_taint.py +101 -0
  116. package/skills/torusguard/payload/core/exploit_checker.py +317 -0
  117. package/skills/torusguard/payload/core/formatter.py +351 -0
  118. package/skills/torusguard/payload/core/governance.py +210 -0
  119. package/skills/torusguard/payload/core/identity.py +104 -0
  120. package/skills/torusguard/payload/core/import_resolver.py +91 -0
  121. package/skills/torusguard/payload/core/incremental.py +102 -0
  122. package/skills/torusguard/payload/core/lifecycle.py +137 -0
  123. package/skills/torusguard/payload/core/models.py +425 -0
  124. package/skills/torusguard/payload/core/parallel.py +56 -0
  125. package/skills/torusguard/payload/core/parser.py +202 -0
  126. package/skills/torusguard/payload/core/rechecker.py +107 -0
  127. package/skills/torusguard/payload/core/replay_trace.py +178 -0
  128. package/skills/torusguard/payload/core/rules_registry.py +131 -0
  129. package/skills/torusguard/payload/core/run_folder.py +60 -0
  130. package/skills/torusguard/payload/core/run_manager.py +163 -0
  131. package/skills/torusguard/payload/core/runtime_evidence.py +175 -0
  132. package/skills/torusguard/payload/core/runtime_validator.py +246 -0
  133. package/skills/torusguard/payload/core/safety_gate.py +139 -0
  134. package/skills/torusguard/payload/core/sarif.py +189 -0
  135. package/skills/torusguard/payload/core/stack_profiler.py +184 -0
  136. package/skills/torusguard/payload/core/symbol_table.py +91 -0
  137. package/skills/torusguard/payload/core/taint.py +133 -0
  138. package/skills/torusguard/payload/core/taint_graph.py +235 -0
  139. package/skills/torusguard/payload/core/taint_rules.py +268 -0
  140. package/skills/torusguard/payload/core/v070_reporter.py +102 -0
  141. package/skills/torusguard/payload/core/v070_workflow.py +339 -0
  142. package/skills/torusguard/payload/core/v6_reporter.py +180 -0
  143. package/skills/torusguard/payload/core/v6_workflow.py +221 -0
  144. package/skills/torusguard/payload/core/watcher.py +58 -0
  145. package/skills/torusguard/payload/rules/TG-INPUT-007-unvalidated-redirect.md +53 -0
  146. package/skills/torusguard/payload/rules/TG-INPUT-008-insecure-deserialization.md +52 -0
  147. package/skills/torusguard/payload/rules/container/TG-CONT-001-root-user-execution.md +50 -0
  148. package/skills/torusguard/payload/rules/container/TG-CONT-002-docker-socket-mount.md +47 -0
  149. package/skills/torusguard/payload/rules/container/TG-CONT-003-privileged-container-mode.md +53 -0
  150. package/skills/torusguard/payload/rules/container/TG-CONT-004-build-arg-secret-exposure.md +43 -0
  151. package/skills/torusguard/payload/rules/git/TG-GIT-001-historical-secret-in-git-commit.md +44 -0
  152. package/skills/torusguard/payload/rules/git/TG-GIT-002-plaintext-credentials-in-git-config.md +41 -0
  153. package/skills/torusguard/payload/rules/git/TG-GIT-003-sensitive-tracked-file-gitignore-breach.md +40 -0
  154. package/skills/torusguard/payload/rules/rag/TG-RAG-001-untrusted-rag-context-injection.md +72 -0
  155. package/skills/torusguard/payload/rules/rag/TG-RAG-002-autonomous-llm-tool-unsandboxed-call.md +51 -0
  156. package/skills/torusguard/payload/rules/rag/TG-RAG-003-unpartitioned-vector-tenant-lookup.md +51 -0
  157. package/skills/torusguard/payload/rules/redos/TG-REDOS-001-catastrophic-exponential-backtracking.md +46 -0
  158. package/skills/torusguard/payload/rules/redos/TG-REDOS-002-unbounded-nested-quantifier.md +43 -0
  159. package/skills/torusguard/payload/rules_catalog.json +338 -518
  160. package/skills/torusguard/payload/scripts/__pycache__/term_ui.cpython-314.pyc +0 -0
  161. package/skills/torusguard/payload/scripts/audit_runner.py +108 -10
  162. package/skills/torusguard/payload/scripts/finding_scorer.py +43 -13
  163. package/skills/torusguard/payload/scripts/manifest_builder.py +1 -1
  164. package/skills/torusguard/payload/skills/torusguard/SKILL.md +74 -25
  165. package/skills/torusguard/payload/skills/torusguard/bootstrap.py +57 -24
  166. package/skills/torusguard/payload/skills/torusguard/references/csharp-security.md +41 -41
  167. package/skills/torusguard/payload/skills/torusguard/references/go-security.md +41 -41
  168. package/skills/torusguard/payload/skills/torusguard/references/java-security.md +40 -40
  169. package/skills/torusguard/payload/skills/torusguard/references/polyglot-security-matrix.md +25 -25
  170. package/skills/torusguard/payload/skills/torusguard/references/rust-security.md +40 -40
  171. package/skills/torusguard/payload/skills/torusguard-ai-guard/SKILL.md +95 -0
  172. package/skills/torusguard/payload/skills/torusguard-apply/SKILL.md +60 -34
  173. package/skills/torusguard/payload/skills/torusguard-audit/SKILL.md +131 -57
  174. package/skills/torusguard/payload/skills/torusguard-authorize/SKILL.md +48 -6
  175. package/skills/torusguard/payload/skills/torusguard-container/SKILL.md +94 -0
  176. package/skills/torusguard/payload/skills/torusguard-exploit-check/SKILL.md +50 -6
  177. package/skills/torusguard/payload/skills/torusguard-full/SKILL.md +62 -19
  178. package/skills/torusguard/payload/skills/torusguard-git-mine/SKILL.md +92 -0
  179. package/skills/torusguard/payload/skills/torusguard-harden/SKILL.md +81 -50
  180. package/skills/torusguard/payload/skills/torusguard-init/SKILL.md +61 -14
  181. package/skills/torusguard/payload/skills/torusguard-ocr-scan/SKILL.md +94 -0
  182. package/skills/torusguard/payload/skills/torusguard-recheck/SKILL.md +71 -18
  183. package/skills/torusguard/payload/skills/torusguard-redos/SKILL.md +91 -0
  184. package/skills/torusguard/payload/skills/torusguard-report/SKILL.md +50 -9
  185. package/skills/torusguard/payload/skills/torusguard-status/SKILL.md +63 -10
  186. package/skills/torusguard/payload/skills/torusguard-verify/SKILL.md +52 -10
  187. package/skills/torusguard/payload/skills/torusguard-web-validate/SKILL.md +53 -8
  188. package/skills/torusguard/payload/workflows/ai-guard.md +31 -0
  189. package/skills/torusguard/payload/workflows/apply.md +31 -62
  190. package/skills/torusguard/payload/workflows/audit.md +35 -55
  191. package/skills/torusguard/payload/workflows/authorize.md +27 -50
  192. package/skills/torusguard/payload/workflows/container.md +29 -0
  193. package/skills/torusguard/payload/workflows/exploit-check.md +28 -50
  194. package/skills/torusguard/payload/workflows/git-mine.md +25 -0
  195. package/skills/torusguard/payload/workflows/harden.md +28 -52
  196. package/skills/torusguard/payload/workflows/init.md +27 -56
  197. package/skills/torusguard/payload/workflows/memory.md +18 -23
  198. package/skills/torusguard/payload/workflows/ocr-scan.md +25 -0
  199. package/skills/torusguard/payload/workflows/recheck.md +28 -46
  200. package/skills/torusguard/payload/workflows/redos.md +27 -0
  201. package/skills/torusguard/payload/workflows/report.md +39 -62
  202. package/skills/torusguard/payload/workflows/status.md +31 -55
  203. package/skills/torusguard/payload/workflows/torusguard-audit.md +35 -55
  204. package/skills/torusguard/payload/workflows/verify.md +29 -49
  205. package/skills/torusguard/payload/workflows/web-validate.md +22 -45
  206. package/skills/torusguard/references/csharp-security.md +41 -0
  207. package/skills/torusguard/references/go-security.md +41 -0
  208. package/skills/torusguard/references/java-security.md +40 -0
  209. package/skills/torusguard/references/polyglot-security-matrix.md +25 -0
  210. package/skills/torusguard/references/rust-security.md +40 -0
  211. package/skills/torusguard-ai-guard/SKILL.md +95 -0
  212. package/skills/torusguard-apply/SKILL.md +60 -34
  213. package/skills/torusguard-audit/SKILL.md +130 -57
  214. package/skills/torusguard-authorize/SKILL.md +48 -6
  215. package/skills/torusguard-container/SKILL.md +94 -0
  216. package/skills/torusguard-exploit-check/SKILL.md +50 -6
  217. package/skills/torusguard-full/SKILL.md +62 -19
  218. package/skills/torusguard-git-mine/SKILL.md +92 -0
  219. package/skills/torusguard-harden/SKILL.md +81 -50
  220. package/skills/torusguard-init/SKILL.md +61 -14
  221. package/skills/torusguard-ocr-scan/SKILL.md +94 -0
  222. package/skills/torusguard-recheck/SKILL.md +71 -18
  223. package/skills/torusguard-redos/SKILL.md +91 -0
  224. package/skills/torusguard-report/SKILL.md +50 -9
  225. package/skills/torusguard-status/SKILL.md +63 -10
  226. package/skills/torusguard-verify/SKILL.md +52 -10
  227. package/skills/torusguard-web-validate/SKILL.md +53 -8
@@ -63,14 +63,15 @@ import unicodedata
63
63
  ANSI_REGEX = re.compile(r'\033\[[0-9;]*m')
64
64
 
65
65
  def get_visual_width(text: str) -> int:
66
- """Calculate the printable display width of a string (ANSI and emoji aware)."""
66
+ """Calculate the printable display width of a string (ANSI, emoji and variation selector aware)."""
67
67
  clean = ANSI_REGEX.sub('', text)
68
68
  width = 0
69
69
  for ch in clean:
70
+ cp = ord(ch)
71
+ if (0xFE00 <= cp <= 0xFE0F) or (0xE0100 <= cp <= 0xE01EF) or cp in (0x200B, 0x200C, 0x200D, 0x00AD):
72
+ continue
70
73
  ea = unicodedata.east_asian_width(ch)
71
- if ea in ('W', 'F'):
72
- width += 2
73
- elif ord(ch) >= 0x1F300:
74
+ if ea in ('W', 'F') or cp >= 0x1F300:
74
75
  width += 2
75
76
  else:
76
77
  width += 1
@@ -82,7 +83,7 @@ def truncate_visual(text: str, max_w: int = 67) -> str:
82
83
  return text
83
84
  out, curr_w, in_ansi, ansi_buf = [], 0, False, ''
84
85
  for ch in text:
85
- if ch == '\033':
86
+ if ch in ('\033', '\x1b'):
86
87
  in_ansi = True
87
88
  ansi_buf = ch
88
89
  continue
@@ -92,13 +93,19 @@ def truncate_visual(text: str, max_w: int = 67) -> str:
92
93
  in_ansi = False
93
94
  out.append(ansi_buf)
94
95
  continue
96
+ cp = ord(ch)
97
+ if (0xFE00 <= cp <= 0xFE0F) or (0xE0100 <= cp <= 0xE01EF) or cp in (0x200B, 0x200C, 0x200D, 0x00AD):
98
+ out.append(ch)
99
+ continue
95
100
  ea = unicodedata.east_asian_width(ch)
96
- cw = 2 if ea in ('W', 'F') or ord(ch) >= 0x1F300 else 1
101
+ cw = 2 if (ea in ('W', 'F') or cp >= 0x1F300) else 1
97
102
  if curr_w + cw > max_w - 3:
98
- out.append('...')
103
+ out.append(RESET + '...')
104
+ curr_w += 3
99
105
  break
100
106
  out.append(ch)
101
107
  curr_w += cw
108
+ out.append(RESET)
102
109
  return ''.join(out)
103
110
 
104
111
  def card_line(content: str, max_w: int = 67, border: str = "│", border_color: str = CYAN) -> str:
@@ -109,37 +116,56 @@ def card_line(content: str, max_w: int = 67, border: str = "│", border_color:
109
116
  return f" {border_color}{border}{RESET} {trunc}{pad} {border_color}{border}{RESET}"
110
117
 
111
118
  def card_border_top(title: str = "", border_color: str = CYAN, double: bool = False) -> str:
119
+ """Generate 75-column top border (single ┌ or double ╔) with optional title."""
112
120
  left = "╔" if double else "┌"
113
121
  right = "╗" if double else "┐"
114
122
  h = "═" if double else "─"
115
123
  if title:
116
124
  vis = get_visual_width(title)
117
- rem = max(0, 71 - 3 - vis - 1)
125
+ rem = max(0, 68 - vis)
118
126
  return f" {border_color}{left}{h} {BOLD}{WHITE}{title}{RESET}{border_color} {h * rem}{right}{RESET}"
119
127
  return f" {border_color}{left}{h * 71}{right}{RESET}"
120
128
 
121
129
  def card_border_bottom(border_color: str = CYAN, double: bool = False) -> str:
130
+ """Generate 75-column bottom border (single └ or double ╚)."""
122
131
  left = "╚" if double else "└"
123
132
  right = "╝" if double else "┘"
124
133
  h = "═" if double else "─"
125
134
  return f" {border_color}{left}{h * 71}{right}{RESET}"
126
135
 
127
- def card_divider(border_color: str = CYAN, double: bool = False) -> str:
136
+ def card_divider(title: str = "", border_color: str = CYAN, double: bool = False) -> str:
137
+ """Generate 75-column divider (single ├ or double ╠) with optional title."""
128
138
  left = "╠" if double else "├"
129
139
  right = "╣" if double else "┤"
130
140
  h = "═" if double else "─"
141
+ if title:
142
+ vis = get_visual_width(title)
143
+ rem = max(0, 68 - vis)
144
+ return f" {border_color}{left}{h} {BOLD}{WHITE}{title}{RESET}{border_color} {h * rem}{right}{RESET}"
131
145
  return f" {border_color}{left}{h * 71}{right}{RESET}"
132
146
 
147
+ def card_header(title: str, subtitle: str = "", version: str = "v2.1.1", border_color: str = CYAN) -> str:
148
+ """Generate standardized 75-column curved header box."""
149
+ top = f" {border_color}╭{'─' * 71}╮{RESET}"
150
+ bottom = f" {border_color}╰{'─' * 71}╯{RESET}"
151
+ empty = f" {border_color}│{' ' * 71}│{RESET}"
152
+
153
+ title_vis = get_visual_width(title)
154
+ ver_vis = get_visual_width(version)
155
+ space_count = max(1, 67 - title_vis - ver_vis)
156
+ title_str = f"{BOLD}{WHITE}{title}{RESET}{' ' * space_count}{GRAY}{version}{RESET}"
157
+
158
+ lines = [top, empty, card_line(title_str, max_w=67, border_color=border_color)]
159
+ if subtitle:
160
+ lines.append(card_line(f"{DIM}{subtitle}{RESET}", max_w=67, border_color=border_color))
161
+ lines.extend([empty, bottom])
162
+ return "\n".join(lines)
163
+
133
164
  def print_header():
134
165
  """Print the branded TorusGuard header card."""
135
- print(f"""
136
- {CYAN}╭─────────────────────────────────────────────────────────────────────────╮{RESET}
137
- {CYAN}│{RESET} {CYAN}│{RESET}
138
- {CYAN}│{RESET} {BOLD}{WHITE}🛡️ T O R U S G U A R D{RESET} {GRAY}v1.4.0{RESET} {CYAN}│{RESET}
139
- {CYAN}│{RESET} {DIM}Autonomous Security Engine for AI-Built Applications{RESET} {CYAN}│{RESET}
140
- {CYAN}│{RESET} {CYAN}│{RESET}
141
- {CYAN}╰─────────────────────────────────────────────────────────────────────────╯{RESET}
142
- """)
166
+ print()
167
+ print(card_header("🛡️ T O R U S G U A R D", "Autonomous Security Engine for AI-Built Applications", version="v2.1.1"))
168
+ print()
143
169
 
144
170
 
145
171
  def print_step_1_assets(file_count):
@@ -213,14 +239,15 @@ def print_success_card():
213
239
 
214
240
  def print_already_initialized(target_root, cfg):
215
241
  """Print the already-initialized status card."""
242
+ print()
243
+ top = f" {CYAN}╭{'─' * 71}╮{RESET}"
244
+ bottom = f" {CYAN}╰{'─' * 71}╯{RESET}"
245
+ title_line = card_line(f"{BOLD}{WHITE}🛡️ TORUSGUARD WORKSPACE{RESET}{' ' * 28}{GREEN}[Active]{RESET}")
246
+ print(f"{top}\n{title_line}\n{bottom}")
216
247
  print(f"""
217
- {CYAN}╭─────────────────────────────────────────────────────────────────────────╮{RESET}
218
- {CYAN}│{RESET} {BOLD}{WHITE}🛡️ TORUSGUARD WORKSPACE{RESET} {GREEN}[Active]{RESET} {CYAN}│{RESET}
219
- {CYAN}╰─────────────────────────────────────────────────────────────────────────╯{RESET}
220
-
221
248
  {BOLD}▸ Project Root:{RESET} {GREEN}{target_root}{RESET}
222
249
  {BOLD}▸ Workspace:{RESET} {GREEN}.torusguard/{RESET} {DIM}(Already Initialized){RESET}
223
- {BOLD}▸ Version:{RESET} {CYAN}{cfg.get('version', '1.4.0')}{RESET}
250
+ {BOLD}▸ Version:{RESET} {CYAN}{cfg.get('version', '2.1.1')}{RESET}
224
251
  {BOLD}▸ Severity Floor:{RESET} {YELLOW}{cfg.get('severity_threshold', 'medium')}{RESET}
225
252
 
226
253
  {DIM}To refresh templates or re-scaffold, run:{RESET}
@@ -228,7 +255,7 @@ def print_already_initialized(target_root, cfg):
228
255
  """)
229
256
 
230
257
 
231
- def scaffold_workspace(target_root=None, force=False, full_commands=False, template=None, run_audit=False):
258
+ def scaffold_workspace(target_root=None, force=False, full_commands=False, template=None, **kwargs):
232
259
  """Scaffold the .torusguard workspace into the target project root."""
233
260
  target_root = Path(target_root or find_project_root()).resolve()
234
261
  torusguard_target = target_root / ".torusguard"
@@ -348,18 +375,13 @@ def scaffold_workspace(target_root=None, force=False, full_commands=False, templ
348
375
  "cards": []
349
376
  }, indent=2), encoding="utf-8")
350
377
 
351
- # Ensure target project root .gitignore excludes .torusguard/memory/ and report.html
378
+ # Ensure target project root .gitignore excludes .torusguard/memory/
352
379
  root_gitignore = target_root / ".gitignore"
353
380
  if root_gitignore.exists():
354
381
  try:
355
382
  gi_content = root_gitignore.read_text(encoding="utf-8")
356
- to_add = []
357
383
  if ".torusguard/memory" not in gi_content:
358
- to_add.append(".torusguard/memory/")
359
- if "report.html" not in gi_content:
360
- to_add.append("report.html")
361
- if to_add:
362
- root_gitignore.write_text(gi_content.rstrip() + "\n\n# TorusGuard local artifacts\n" + "\n".join(to_add) + "\n", encoding="utf-8")
384
+ root_gitignore.write_text(gi_content.rstrip() + "\n\n# TorusGuard security memory (local only)\n.torusguard/memory/\n", encoding="utf-8")
363
385
  except Exception:
364
386
  pass
365
387
 
@@ -379,25 +401,17 @@ def scaffold_workspace(target_root=None, force=False, full_commands=False, templ
379
401
  except Exception:
380
402
  detected_stack = None
381
403
 
382
- TEMPLATE_MAP = {
383
- "golang": {"language": "Go", "framework": "Gin/Fiber", "data_layer": "database/sql"},
384
- "go": {"language": "Go", "framework": "Gin/Fiber", "data_layer": "database/sql"},
385
- "nextjs": {"language": "TypeScript", "framework": "Next.js", "data_layer": "Prisma ORM"},
386
- "fastapi": {"language": "Python", "framework": "FastAPI", "data_layer": "SQLAlchemy"},
387
- "express": {"language": "JavaScript", "framework": "Express", "data_layer": "Mongoose"},
388
- "django": {"language": "Python", "framework": "Django", "data_layer": "Django ORM"},
389
- "react": {"language": "JavaScript/TypeScript", "framework": "React / Vite", "data_layer": "Supabase"}
390
- }
391
- if template and template.lower() in TEMPLATE_MAP:
392
- detected_stack = TEMPLATE_MAP[template.lower()]
393
-
394
404
  config_file = torusguard_target / "config" / "torusguard.json"
395
405
  if config_file.exists():
396
406
  try:
397
407
  with open(config_file, "r", encoding="utf-8") as f:
398
408
  cfg = json.load(f)
399
- if template and template.lower() in TEMPLATE_MAP:
400
- cfg["detected_stack"] = TEMPLATE_MAP[template.lower()]
409
+ if template and template.lower() in ("golang", "go"):
410
+ cfg["detected_stack"] = {
411
+ "language": "Go",
412
+ "framework": "Gin",
413
+ "data_layer": "None"
414
+ }
401
415
  elif detected_stack and detected_stack.get("framework") != "None":
402
416
  cfg["detected_stack"] = {
403
417
  "language": detected_stack.get("language"),
@@ -530,40 +544,15 @@ Parse the requested action from `$ARGUMENTS` (e.g. `audit`, `verify`, `web-valid
530
544
 
531
545
  # ── Success Card ────────────────────────────────────────────────────────
532
546
  print_success_card()
533
-
534
- # ── Optional Immediate Audit ────────────────────────────────────────────
535
- if run_audit:
536
- audit_script = torusguard_target / "scripts" / "audit_runner.py"
537
- if audit_script.is_file():
538
- print(f"\n {CYAN}▸ Running immediate baseline security audit (--audit)...{RESET}\n")
539
- try:
540
- import importlib.util
541
- spec = importlib.util.spec_from_file_location("audit_runner", str(audit_script))
542
- if spec and spec.loader:
543
- ar_mod = importlib.util.module_from_spec(spec)
544
- spec.loader.exec_module(ar_mod)
545
- if hasattr(ar_mod, "execute_audit"):
546
- ar_mod.execute_audit(target_root)
547
- except Exception as e:
548
- print(f" {YELLOW}⚠ Immediate audit notice: {e}{RESET}")
549
-
550
547
  return True
551
548
 
552
549
 
553
550
  if __name__ == "__main__":
554
551
  parser = argparse.ArgumentParser(description="TorusGuard Autonomous Workspace Bootstrapper")
555
- parser.add_argument("--target", "-t", type=str, help="Target project root directory")
552
+ parser.add_argument("--target", type=str, help="Target project root directory")
556
553
  parser.add_argument("--force", action="store_true", help="Force overwrite existing workspace")
557
554
  parser.add_argument("--full-commands", action="store_true", help="Unlock and register all 11 individual slash commands")
558
- parser.add_argument("--template", choices=["golang", "go", "nextjs", "fastapi", "express", "django", "react"], help="Pre-configure target framework stack template")
559
- parser.add_argument("--audit", action="store_true", help="Execute immediate baseline audit post-initialization")
560
555
  args = parser.parse_args()
561
556
 
562
- success = scaffold_workspace(
563
- target_root=args.target,
564
- force=args.force,
565
- full_commands=args.full_commands,
566
- template=args.template,
567
- run_audit=args.audit
568
- )
557
+ success = scaffold_workspace(target_root=args.target, force=args.force, full_commands=args.full_commands)
569
558
  sys.exit(0 if success else 1)
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "ARCHITECTURE.md": "cdc690a856e82574a6574ab6b1ad8a2d8b3b8264c36931c6212321066eed82e4",
3
3
  "TORUSGUARD.md": "c980b0ddd3778d5981f6c16c64015c60dc713b6f151fc531bc5681ecd770fb50",
4
- "rules_catalog.json": "e0b32c1bdde0f19fa390aba26a02b7e5ba1b59b251f9fffd501815b48f2d9af9",
4
+ "rules_catalog.json": "11240a887dbe457ef5fbe621dabc08ea4e3bc273b56fce85f517df7b6ad19f55",
5
5
  "agents/auditor.md": "4ba2c92982823d0886c7ae369126cd5ddd322085a85d3b7e7fa23154f8753314",
6
6
  "agents/profiler.md": "0ee9ebbddf4ebd557d454dda8472fffea471e263abeccf40298163084b7ce9a9",
7
7
  "agents/remediator.md": "f708a0e315760e8d519bd640d22bdf6b7ec61ed7de3da69bd038bd60dc3d5b47",
@@ -10,6 +10,45 @@
10
10
  "config/scope.json": "b198a86186b4c6d5e1af516bf4e3a6afa8878e622ca1d57a5bf72d294f8c6f25",
11
11
  "config/slash-commands.json": "305c1dc5b556e8d64ad9dd585dafac1a9955cf1bd5321429955b19b7a62736b6",
12
12
  "config/torusguard.json": "55dbde335997421a01c97709fd1672ad70fa921bfe8346dd57552b799db2419e",
13
+ "core/__init__.py": "2120562452ae03c84468d67246dc93376f7ebcde8e4ca767c6253bc92c35dbbf",
14
+ "core/agent_roles.py": "d7189dbf1d3ae4e330eb316bed5d399a18992295addf466f4c6552bc14ae6a34",
15
+ "core/ast_walker.py": "309564d168e6eb9e3e93aceb29a95a61872b35a4da7235ee49e79e9d3a5e7cc6",
16
+ "core/authorization.py": "2bb7f85b4639959276fc7cfd427df7edb8b1f97f8003707a0032f100953d1b30",
17
+ "core/browser_verifier.py": "e450bdbb8d5c2808a3b3ea7bc33bce2451230cbbb7ed4f17dbc7107ab0f30d56",
18
+ "core/bundle.py": "82505fba44a5ad867a4caef34e1233ebf76d4bc2e15b943e2413822602f1a95f",
19
+ "core/call_graph.py": "7e230f8b5fa7dd8f780eafbe7381f2d9538f01a880c1349c41139cce20f9094f",
20
+ "core/clustering.py": "0ffcad5e8a459084d200248de8799d466c2b53ad627b778314b09f2733df782c",
21
+ "core/confidence.py": "81c6242a1a3eaea873d39e8b212e5781a2df2316614f18a2fe6ef757561f5bb5",
22
+ "core/cross_file_taint.py": "1fa323529e5ca2fcce06167e4a59431f9f8217ad7a5097f8afbc6b9a9dc0913d",
23
+ "core/exploit_checker.py": "74a48e6e1e1b9791107b487ab5434540494946441605cf9115fa90b787bc5c5a",
24
+ "core/formatter.py": "a9d2a20e52caaf8a801f65f325b3f5bc430eb6301506973095961d4615b7e429",
25
+ "core/governance.py": "657edfa332c2f855f917545862c9d38f31468cec464d11dd2c012dcf794fb32c",
26
+ "core/identity.py": "f42d3d81c7ee8ca5d2ef08d48066abdc42d2ccbd5fe0bbd88b35d5c8174b696f",
27
+ "core/import_resolver.py": "4ac89ac405816b7de599fbabfa47556d10c1557d92f3a700bf50b90f52ba6c75",
28
+ "core/incremental.py": "8ff9d41f6667bf567d2e952f31ae330271ba1d6cf5411ab4468c355ca2fa6681",
29
+ "core/lifecycle.py": "f4406acba8464ed9111128ef545f8c576639cadda8b9de7e23ff8a90fad24f9e",
30
+ "core/models.py": "ed23b50aab2eb7ea9bc16dbb20b0bf4f978f3aae7f39f0a713f7efe08ff238b5",
31
+ "core/parallel.py": "27fcfdd3760d481ffdd4e7321a79d17ef4823dd3744687fcc9d00349c0bb1d49",
32
+ "core/parser.py": "2f01e9beb178e86002fd8dd3211cf269ab59f21e5c65aabb5e9d0e110504d1d1",
33
+ "core/rechecker.py": "2a21b788158cac79db9030db79e3a27021e7f66692c37c39e0bd3fadf483388c",
34
+ "core/replay_trace.py": "8132cb43dd4593cc96f09f014c2b3882ef5296ebc5029a921423263b07ca7a1d",
35
+ "core/rules_registry.py": "80c4f5067f151b596388ae9a4546d2f009f10342daa5221412e5c9a222b27a31",
36
+ "core/run_folder.py": "cc8702dfd3a2768e5dca74f7ac85e316f53f1acb059bad87ca3650eeeae2defa",
37
+ "core/run_manager.py": "2470ebc8b54edaab3679d909fde48f02c7530f1e12c917b7b5cd5c004062a8b6",
38
+ "core/runtime_evidence.py": "79c947a3b131c3be2f2938789d12647a0d9010bb4077bf3f33b2c7218ba9028b",
39
+ "core/runtime_validator.py": "39477ef1138e8deaa5c3859d6402e71d2c0eb6e2e39fbd3db04fe3ad8e2c798c",
40
+ "core/safety_gate.py": "349e84187930faf79baa38643712d48636de504e8613667e42ec852999efa9fb",
41
+ "core/sarif.py": "93316e7d5fa0ac3660ce18307a2ef4f9c2b2b24b0a4e40d288f94edd0ef84e6d",
42
+ "core/stack_profiler.py": "8c5166c712d7e9341d6290b2220da05662f1ba251899d6f501a9875625f5539c",
43
+ "core/symbol_table.py": "8e700e01e920e7c8a496a16e400195bb6cedd9e3624997fbb44b29124e256d74",
44
+ "core/taint.py": "f54b3e2d620d480969681847e63149b259876dbac470dc417e90407e1def925b",
45
+ "core/taint_graph.py": "2f697a4d4c44801f346f7bde0794cc70c481b4a5a28fe02add20fa845fd9a5c5",
46
+ "core/taint_rules.py": "d29893e0212a2afb21fede6c20afb6d3fe9ff89511659675f02a034ea1e87d8f",
47
+ "core/v070_reporter.py": "d9e9bebd4e158f4c1b1b50897c04c2c5f9db85919b1700b47331ecf16fe7bd63",
48
+ "core/v070_workflow.py": "57bf1468c78f47b4aa5fb5804eb3c247825daa0933bb5cf0aad4ae2394adcead",
49
+ "core/v6_reporter.py": "95fa2ec5b0e708101b62131152445039192382e409d0f40c35cdcbf96648ca26",
50
+ "core/v6_workflow.py": "3e38afafc3afdbebe8cf76ed24da00435aab27a2ac512a292983f8b1e88ebcb8",
51
+ "core/watcher.py": "b3d4856023ee2f6c65b2938d3c76c246d7c440c58cdc7b642dc27209d68a959a",
13
52
  "references/csharp-security.md": "d6e267855b08ed4fdff26f3b876f089ae1f90a7ec6546cba7e8173380d9daa9d",
14
53
  "references/django-security.md": "26ea5535ac435e61489df1e381ac62b19e81702edfe095e78c937be93fa15ea7",
15
54
  "references/drf-security.md": "c6796398317b0f264d89fff598404e126d819e69e1ea0a5129924a5eb2a7af9d",
@@ -43,6 +82,8 @@
43
82
  "rules/TG-INPUT-004-unrestricted-file-upload.md": "d665fb7ede456c24d12229cec22b30374a4dc036c3fe3a41ece22f97ab78a1f4",
44
83
  "rules/TG-INPUT-005-unsafe-template-rendering-and-escaping.md": "b6006e741a303d8ff2cd65ef417e6199e5dcf8fe7d603941244db82f6cbe1753",
45
84
  "rules/TG-INPUT-006-unsafe-file-path-traversal.md": "5edb665cd2c41b659849c96d0d4b801a6365e130be12c51733a3d6f17cfd85ed",
85
+ "rules/TG-INPUT-007-unvalidated-redirect.md": "7da41ecbd39a7c90fe90fc683df48f38b0cf5a0d7c2b027f0827830bd8f814f7",
86
+ "rules/TG-INPUT-008-insecure-deserialization.md": "5f5f85a9429d32959f890f668ff1fd75bd7ce976a7b9406c3b7235fc728989ca",
46
87
  "rules/TG-PLATFORM-001-wildcard-cors-with-credentials.md": "fb8154f5b8051e94886c956b1e7bdbc5f316739795b8fb9bb493223ca774fe25",
47
88
  "rules/TG-PLATFORM-002-missing-security-headers.md": "207f489453d6256b5d794f79be25c66e9f932ae5cb561b3e8b50d26a28f6a07a",
48
89
  "rules/TG-PLATFORM-003-production-stack-trace-exposure.md": "298c75b928c160720243e42ce5bf43397e73cf50ed472482d5ef3f7635fcb839",
@@ -100,15 +141,27 @@
100
141
  "rules/cache/TG-CACHE-001-sensitive-response-publicly-cacheable.md": "e84d9d314b1616bdda54345fdf0203732e68e375dc7e144d9e2aa7619f9cafb8",
101
142
  "rules/cache/TG-CACHE-002-missing-user-cache-isolation.md": "4e305be49dd14a34d29c9283b535a72ad6cd84c5bd52afb3f006403f2e5a6850",
102
143
  "rules/cache/TG-CACHE-003-sensitive-data-in-url.md": "235f3eed546b58aa8f04e155aeaef4e0206dd696517a7854983ab9ce8fe61030",
144
+ "rules/container/TG-CONT-001-root-user-execution.md": "8cabae14353f63dffe69067c369f55c3e99d05791ff96139cd7eeff7f7db6d3f",
145
+ "rules/container/TG-CONT-002-docker-socket-mount.md": "e375fa7c7fda1ee026b7df9c1ae2aaf21be34926c18182daf8019479db6295fa",
146
+ "rules/container/TG-CONT-003-privileged-container-mode.md": "0e500f2553b9fb0865396ac8e9f7f18526af576951c72887ee30874b2b543225",
147
+ "rules/container/TG-CONT-004-build-arg-secret-exposure.md": "91d290078698480a1bd09e6f4d2e5930dd40c877344b25c5f1be7ca705ecdbd8",
103
148
  "rules/csrf/TG-CSRF-001-missing-csrf-protection.md": "42fcf19ae244a36b3b64d03200b6d4c1acf1b265fdb2fe6a85de8dd69b3837fe",
104
149
  "rules/csrf/TG-CSRF-002-unsafe-credentialed-cross-origin-request.md": "c01a55e31e4aaaea8c9f630b514c1ad242b513ab99111534939584ae4fe1a58c",
105
150
  "rules/custom/README.md": "f2128661ad3bc4085a69ddfbabbb2211930215fc42a25e2ab2d3e7a4b749a639",
106
151
  "rules/edge/TG-EDGE-001-serverless-global-state-leak.md": "82fe764a67228c71359b340a983cb37dc8bf4521d030846e0cea433de43c52d3",
107
152
  "rules/edge/TG-EDGE-003-aws-lambda-ephemeral-cold-start.md": "2659db7d38b6689d1d3a99ad5f2504ea264b3d3a601ab38186737b12d4d42c17",
153
+ "rules/git/TG-GIT-001-historical-secret-in-git-commit.md": "4a0ad519db2ff6c2311eb872d7b015d3b3a0fef114ae821e24ec640d2ca0e99e",
154
+ "rules/git/TG-GIT-002-plaintext-credentials-in-git-config.md": "5ec5f9e25e73e37b64b8f6861772395a37a41d3c982eb15cd5d0561311a929bc",
155
+ "rules/git/TG-GIT-003-sensitive-tracked-file-gitignore-breach.md": "34f54569af1fcaeb68bc9e88f3a1baf08ab74a9024f63d8059ab22fe30b2ee91",
108
156
  "rules/graphql/TG-GQL-001-missing-query-depth-or-complexity-limits.md": "bfee2cb26c71871cc4b93e224dc56c18de0d0ea692a431f7b27a51e7e408873f",
109
157
  "rules/graphql/TG-GQL-002-resolver-missing-authorization.md": "e6429fdcf130478446a2711eac83bd64cc502aad8baa35c04de26958d23e5b0f",
110
158
  "rules/graphql/TG-GQL-003-unbounded-graphql-pagination-or-batching.md": "c2e2beb37c4d86f4ba564e1a1fd9587626df3793b9c5dc9e13d0cf0ce3bfe09a",
111
159
  "rules/graphql/TG-GQL-004-unnecessary-production-introspection.md": "54311588945abc1d79e99a0001390821ccb4434772297b2395e7081d276d6602",
160
+ "rules/rag/TG-RAG-001-untrusted-rag-context-injection.md": "3cc4c87d373293612210b865d0c936fc5c55dfa5dac2adc8f9822e639dd1102b",
161
+ "rules/rag/TG-RAG-002-autonomous-llm-tool-unsandboxed-call.md": "6935f2c4b1f254148242b6e1ce656024f1cffb5432e432c038abf63094c13ad3",
162
+ "rules/rag/TG-RAG-003-unpartitioned-vector-tenant-lookup.md": "44722ba00bfd40a0b98abb9789b77a786ac8deed017cc6543867a131b21bbe1e",
163
+ "rules/redos/TG-REDOS-001-catastrophic-exponential-backtracking.md": "2cac8e899af177c03dbe01f85ac5f3d485e88ef5a08809e3bc17f676e74d5ae5",
164
+ "rules/redos/TG-REDOS-002-unbounded-nested-quantifier.md": "5b9032ea9268831e3ecf328039083a7dca95feb330347c29f9120db1a30e2278",
112
165
  "rules/secrets/TG-SEC-005-secret-in-git-history.md": "089dbe9653b2a4df652ba049b40147434d6abc70c239ac7db81bdcb9d6579387",
113
166
  "rules/secrets/TG-SEC-006-secret-in-build-artifact.md": "ed20b1c9044149df5257ad8140bd787db7f77063b890dad9ba32efaf4d554fe5",
114
167
  "rules/secrets/TG-SEC-007-secret-in-test-or-example-fixture.md": "b3d4b9f1d0fd9656aa9a586e133209904c1f3b75a2b7e7c1ecb825a125663e6d",
@@ -143,12 +196,12 @@
143
196
  "schemas/retest.schema.json": "97c0407ca4365a524020c430912f686f698cc0de90043194621071e9fc681cc7",
144
197
  "schemas/runtime-evidence.schema.json": "929d2b094c1cd1f7f9db07be1eba5994e8002477eab3fd24140e1e973fd18cc1",
145
198
  "scripts/apply_runner.py": "b145a68a4bc10fcacb853f972aee81fa3607e32d282b2b850c5a63d8e72da890",
146
- "scripts/audit_runner.py": "bc1e06ea5153ae326c4ad1de5d0cbb9503e618186623bea7cb8bb64d7b7b05ec",
199
+ "scripts/audit_runner.py": "18ebcd46f8363169db4ff4675a5258e0b93df5b219650de95b9a5e9f51da5ff9",
147
200
  "scripts/diff_guard.py": "0dc178cdde1ac0ae1a1ea4b2eb2ce1756b2126f6156909cf55d85249f115fcbd",
148
- "scripts/finding_scorer.py": "a5315be6ee256c01c4539da3d1905ebc8d0840a356b83c55f9f6f2654a9f0c60",
201
+ "scripts/finding_scorer.py": "95c7edfe5ee4742be565914f71bb07bd077b2cf4636b769476345389dd85f3cf",
149
202
  "scripts/harden_runner.py": "5d5a40029c088ccb66790a9b0128bdefcd35883ef1dac78088ceb9531392a8f1",
150
203
  "scripts/html_reporter.py": "655c57be39e13c177db8842ef471664e5853f3e43b9f2a63e590df40ff9c16cb",
151
- "scripts/manifest_builder.py": "18db6979b341a87e9bf38fe06525365d12b07d532c0dbfd2ac3ef0f539dc1f6f",
204
+ "scripts/manifest_builder.py": "f1f9a0d63c55cf5ff45e9fd39d1b251c2bce05e777f8c1e325741d340f0128db",
152
205
  "scripts/memory_engine.py": "b715d0ca030e95eb06ad6eda99027535df8a7e37d64897c023be6a291cf13dc6",
153
206
  "scripts/monorepo_detector.py": "5603674136a5294ebfff89efeca0a546dd4a7deb1d184a2592ff21aff2131f73",
154
207
  "scripts/recheck_runner.py": "89e93fcc6843493d7e5f0bf97065dbdb40106273a00e07f903250665ca25f6fb",
@@ -161,8 +214,8 @@
161
214
  "scripts/stack_detect.py": "c05a1ade4c8692025476bf7ea080a8f07c92e5d8e9a04f94c1654386352ffbdc",
162
215
  "scripts/status_runner.py": "4c358c91950c7874bcc6a5f23f2d3fda62b0752efcf6c6b658adf02ed77c7752",
163
216
  "scripts/term_ui.py": "ca69398f85c86fe89526d6334b3ee866c890273997351113c3cc1765b7bd20c3",
164
- "skills/torusguard/SKILL.md": "4d5b8e43fa3c09e5e1079cbc3e2184654219a2c47b2272db394da749969318f8",
165
- "skills/torusguard/bootstrap.py": "3d946f388cb4befa739c9d3b1404255d9a8ea5770ebbb79e5a1b9839589e9bc7",
217
+ "skills/torusguard/SKILL.md": "15c69cb10eca1a10344b494888dce57e2baf227c3282bd54424a36ce35fb2460",
218
+ "skills/torusguard/bootstrap.py": "bd59b64acdab2c359ebaf29b3c6ba763fb4795a8ca6882a760fed23a8a1b50af",
166
219
  "skills/torusguard/references/auth-and-sessions.md": "c3e4b9600cb53fc28c993922dc880accbec5783ac90d5ee98d63b52762d19525",
167
220
  "skills/torusguard/references/business-logic-and-abuse.md": "58e87df2864d468af70c1ff39f5d540c687fa846b671457f85046ab2065fe99c",
168
221
  "skills/torusguard/references/cache-and-sensitive-responses.md": "81b4a7a08e11dafa4ec58d868c4a35f1f891d0dcdcfbcefaef81e1b9ba94f5a1",
@@ -191,35 +244,45 @@
191
244
  "skills/torusguard/references/ssrf-and-outbound-requests.md": "5ce59ebada2f227b3e0a27f612b59a47801c152d24d2d4d533bee435f32b1b05",
192
245
  "skills/torusguard/references/webhook-security.md": "8fd27cce1562a3dfda8d4fae29bef7cfd47a65c1e89c6868cdbcac161ccd2be8",
193
246
  "skills/torusguard/references/websocket-security.md": "b5315e49432184c006664436d689d426b7322fc6fbbba2899a9ea5e5bab74c92",
194
- "skills/torusguard-apply/SKILL.md": "4cdd01d8159fc5f7519a806526a119e6d67e41b8af195de018b05d6af09acb12",
195
- "skills/torusguard-audit/SKILL.md": "0065336b125cfa8ec766dcec585bce4bbac66b3b063c174b7183dffef18e090d",
196
- "skills/torusguard-authorize/SKILL.md": "8694e6cef71cbeb6605fed33dd1f24b74352541069e54de7c3f48c9676e9aa3a",
197
- "skills/torusguard-exploit-check/SKILL.md": "87e0e01f28f3efea8dbe81790abaceb845a1290c75a6a16bbd256251cd0539a9",
198
- "skills/torusguard-full/SKILL.md": "35f8b38b08fef5a09504312ef3e54921b1f8f31f197bbe2af1474bcce2e83e1c",
199
- "skills/torusguard-harden/SKILL.md": "4332761e5454a504176eebbba2d4c585bcf066c8046c014cebc0f5771379c089",
200
- "skills/torusguard-init/SKILL.md": "03e599a5dad4262396e6b1a75859f76739b0b1480d8cc64544296106da903dfc",
201
- "skills/torusguard-recheck/SKILL.md": "72a0a79b29dcc7f7ae054f00c53e005bc92778f2c6bf3ad828f6391e859d9c1c",
202
- "skills/torusguard-report/SKILL.md": "6dc62fb2c9e2986827a802b7cabf41ce41d00a47573524a4bf1642a8d8e2249e",
203
- "skills/torusguard-status/SKILL.md": "2ad72e5d317e1d6fe0606f6926b1721dc01ba98b5daa2bfaa90bdd953a67bdf7",
204
- "skills/torusguard-verify/SKILL.md": "810c31ba9adc1b410b22eb8503f266be2d51e260a9c6828fd2938e2774e5baa7",
205
- "skills/torusguard-web-validate/SKILL.md": "3e02d9734402e8fbc86a0b5c2fdac945ef4fc9d60ba1b992197b1373427ad16e",
247
+ "skills/torusguard-ai-guard/SKILL.md": "130a24d82f1b92fcc3ac2f4edc77d4d999ae629971f2131f66d6fac876f5593f",
248
+ "skills/torusguard-apply/SKILL.md": "edb21eabae4f9ad5be5976b20d217941c87b2a15edfc73383d02460ca3253fca",
249
+ "skills/torusguard-audit/SKILL.md": "b9ffc74381360656cbc78438c003fb1e67c4f0787f87627555863b474d57a8ad",
250
+ "skills/torusguard-authorize/SKILL.md": "56bcebc718bddadfd66010ebe2d23b4acf429e6230de05dd2300dab6bd383cc2",
251
+ "skills/torusguard-container/SKILL.md": "f9a2dea0b6b1e2de8ce4a189bb32b1010f1b4d6ff7a529450857b6dab20546ff",
252
+ "skills/torusguard-exploit-check/SKILL.md": "c127f1766e98e28dc967e452dff5dfec87689a26cf671ab6e62a135cd4d46e4b",
253
+ "skills/torusguard-full/SKILL.md": "6815ddde9e0e2dec24c174b08e541c80e34569836b1d94fda4ecf9577001e50c",
254
+ "skills/torusguard-git-mine/SKILL.md": "ebfb2f9955bf83b01be353c0a091396e549e5140564ab725d0479914b161e446",
255
+ "skills/torusguard-harden/SKILL.md": "14a09c770aa61e39e0ae862bb32304233975299df7e23c640983fd8551bbb0dd",
256
+ "skills/torusguard-init/SKILL.md": "6f9e9cdc1cc4f98baf2e6047c939b86a6191561c8ddea6c9246651378b00b9a8",
257
+ "skills/torusguard-ocr-scan/SKILL.md": "5b424d19383a93d757af06c4e777cd88c8cbdbcaaf1adc0c7bb38180ebc2bad8",
258
+ "skills/torusguard-recheck/SKILL.md": "a5c4539ec6d091179c8ba53792fba46f26795976f392d2305e357f25a2966c55",
259
+ "skills/torusguard-redos/SKILL.md": "b09b39bd98589613b2107c177e247f6224fb54ab2f028b4339ae01aac9d28c67",
260
+ "skills/torusguard-report/SKILL.md": "509185ea6730601cf9a44e136219cace61cd0523f8e112de03e4ef1c35e60585",
261
+ "skills/torusguard-status/SKILL.md": "e9741a20313a8304bc7565b194949a59ec7cfd4945b197517680164b3197efc0",
262
+ "skills/torusguard-verify/SKILL.md": "aeb4d3c7924253607d130e48491d83bf7b7a21707cd1dac2ba97d64f5e259fd6",
263
+ "skills/torusguard-web-validate/SKILL.md": "f1df00e10abd823d9a8c4daa1a3af7f26c5263c6c8e58e05b61b647d01a25489",
206
264
  "templates/audit-report.template.md": "71149dd05b01a74287a47781fdc71fd2d1b4b70337da303bf78767d0410a6c90",
207
265
  "templates/authorization.template.md": "81ef843d42a19412c369f383b787465ac24173c0b14c1f5f211786eab3d10e8b",
208
266
  "templates/finding-card.template.md": "8f756edbd3e4139d3da2fb96f35bd2d2b267b33b754f187b590a89584265c1e6",
209
267
  "templates/remediation-bundle.template.md": "4d85a540e3a2e74f9b21fc8a2a1072e27ca03e97cd67ca482f529cfe722acc4d",
210
- "workflows/apply.md": "67e1002fc6e9d68e0c7d871c40b6f3c3b9c3919c8e02106a579882729c0f6b9f",
211
- "workflows/audit.md": "eac9102ca88d53f71da474cd55717d431fd9c3b08c66d0760da9b53a659cf89a",
212
- "workflows/authorize.md": "28ca58cfc656e956f7cec8160f2aadc152abcde3eb5ad5588df149007afb0df8",
213
- "workflows/exploit-check.md": "41e77afe912be9266c5bc1e00fd796baff22a67973eb6e86d196d34f4d7bdfa4",
214
- "workflows/harden.md": "7d92132973ff867b99e0425e3aee3c4e91868cb5193ec601069af2e857b6697f",
215
- "workflows/init.md": "611418577ff9d5719df459f56b3fa53b91eb3717b02c4b4e5e86ed483bed3bfa",
216
- "workflows/memory.md": "8ad2ec154176e2540c2859a28eff9f7c2dbca0217aa29d0f4aa88b87c43f8bef",
217
- "workflows/recheck.md": "42eecc3ba194564d48a6a88d8003e86cafe003503e887dc565314d4aa558e8fd",
268
+ "workflows/ai-guard.md": "7d762f4e18f64864b50b64148b972085d2766aeaf13833bc1e6aeb8fddb96999",
269
+ "workflows/apply.md": "0cd0fa84627ff73ffef84aa7eed6d096b57826139c079fa63f1bd745e13b138a",
270
+ "workflows/audit.md": "9f13b0497553965d30a71ff040a0dc556d526c8bbff136952b8210685632b5d7",
271
+ "workflows/authorize.md": "386779f405c4b7de0282938db4095179ed212fd32296dff158acb3258b41aec1",
272
+ "workflows/container.md": "64936b4873e9dfde6deae8a7d10d572a3bfbbfe9ef2340d0df8a3db5e1d02ad7",
273
+ "workflows/exploit-check.md": "4dc4016b7a22f18d5c32dd6fcfa7a859df07d03300973654aea92fe5251c8a85",
274
+ "workflows/git-mine.md": "3406122bc26c16d6518a77cb5cdd823c3860c3acb2873a0b2accd936040d5ca1",
275
+ "workflows/harden.md": "8a7e0ad3efe336f087fb4ad0205aaca32509145c1c02747d425591c87616c473",
276
+ "workflows/init.md": "c5c5fe6efbe9d37037b7b558ed396a60eec96bca4f3cf8cac072a1c61b334a1d",
277
+ "workflows/memory.md": "e23ce835c4e451a720a75cfc19a70ae81550665bb49a71016a4945fa75be981f",
278
+ "workflows/ocr-scan.md": "e1cee1a4e099df29b776911ac2b4b41a699a40f41286571e85bcb105bd1e6ecb",
279
+ "workflows/recheck.md": "f57194675ed465ee5fd6e8fc731e7102becd2dd0a8f8848517c0e11d3de849cf",
218
280
  "workflows/recipes.md": "300c1fed0167e1a299fcd33c07db05630116b18a71ec2513c385862bba0f179b",
219
- "workflows/report.md": "ecbd67bfa95bde3c0f51e06aac6fad70d5989b0be82245116cd7ba367f378a4c",
220
- "workflows/status.md": "7f07e726bbb0488e48b718c2f36971634b1422bc2ddfbb381eb3e1ea67c1cfbf",
281
+ "workflows/redos.md": "f55a4f510849a5ea7e2ae4b08ecc70dff03c1bf21c7fdc664a4ff3ad0396f904",
282
+ "workflows/report.md": "7c718dfef6da1b66ba0fed300b7dfc90438fc3866af5a9b2aae4b3c3acd638e2",
283
+ "workflows/status.md": "021a962ae4e6fc81383db2ef42d28dcfc1b3e546c9a10a7a15b9910e531cf0c2",
221
284
  "workflows/torusguard-apply.md": "67e1002fc6e9d68e0c7d871c40b6f3c3b9c3919c8e02106a579882729c0f6b9f",
222
- "workflows/torusguard-audit.md": "eac9102ca88d53f71da474cd55717d431fd9c3b08c66d0760da9b53a659cf89a",
285
+ "workflows/torusguard-audit.md": "9f13b0497553965d30a71ff040a0dc556d526c8bbff136952b8210685632b5d7",
223
286
  "workflows/torusguard-authorize.md": "28ca58cfc656e956f7cec8160f2aadc152abcde3eb5ad5588df149007afb0df8",
224
287
  "workflows/torusguard-exploit-check.md": "41e77afe912be9266c5bc1e00fd796baff22a67973eb6e86d196d34f4d7bdfa4",
225
288
  "workflows/torusguard-harden.md": "7d92132973ff867b99e0425e3aee3c4e91868cb5193ec601069af2e857b6697f",
@@ -231,6 +294,6 @@
231
294
  "workflows/torusguard-verify.md": "6412e123a9346240e5ba898a0da73d3409d9a215d6e8f202ab2eb5719b663731",
232
295
  "workflows/torusguard-web-validate.md": "3b2a3d02b69469539b4a48ed3bd355362927cc21470dbcdeccba564a9e68a371",
233
296
  "workflows/torusguard.md": "4b5da6d38dae6be277bd52782121cdb181a75f1400068041310ca69deae89589",
234
- "workflows/verify.md": "6412e123a9346240e5ba898a0da73d3409d9a215d6e8f202ab2eb5719b663731",
235
- "workflows/web-validate.md": "3b2a3d02b69469539b4a48ed3bd355362927cc21470dbcdeccba564a9e68a371"
297
+ "workflows/verify.md": "dd2579fe7d6e31ba47a4094edfbf4ab04be0745da7dc79e104b0547395c715d1",
298
+ "workflows/web-validate.md": "08441b01d15fd16f6697a95244632ea1465193631ecfb0746fe0c58895ff1c2b"
236
299
  }
@@ -0,0 +1,146 @@
1
+ """
2
+ TorusGuard Core Architecture & Security Workflow Engine (v0.7.0)
3
+
4
+ Tiered architectural layers:
5
+ - Tier 1: Canonical Data Models, Lifecycle State Machine & Reporting (v0.5 base)
6
+ - Tier 2: Governed Remediation, Clustering, Patch Policy & SARIF Export (v0.6 engine)
7
+ - Tier 3: Authorized Runtime Validation, Exploitability Confirmation & Multi-Agent Roles (v0.7 engine)
8
+ """
9
+
10
+ # ==============================================================================
11
+ # Tier 1: Canonical Data Models, Lifecycle & Provenance (v0.5 base)
12
+ # ==============================================================================
13
+ from .models import (
14
+ Finding,
15
+ Evidence,
16
+ Remediation,
17
+ FrameworkPattern,
18
+ AffectedComponent,
19
+ ReproductionMethod,
20
+ RetestRecord,
21
+ NotesRecord,
22
+ FindingTimestamps,
23
+ ProvenanceChain,
24
+ ConfidenceScore,
25
+ ConfidenceFactors,
26
+ ConfidenceBand,
27
+ SeverityLevel,
28
+ SeverityInfo,
29
+ RemediationPriority,
30
+ FindingStatus,
31
+ LifecycleStage,
32
+ TaxonomyCategory,
33
+ EvidenceType,
34
+ AuditReport,
35
+ mask_sensitive_data,
36
+ )
37
+ from .lifecycle import FindingLifecycleManager, LifecycleTransitionError
38
+ from .formatter import ReportFormatter
39
+ from .run_folder import RunFolder
40
+
41
+ # ==============================================================================
42
+ # Tier 2: Governed Remediation, Clustering, Patch Policy & SARIF (v0.6 engine)
43
+ # ==============================================================================
44
+ from .identity import IdentityEngine, FindingFingerprint
45
+ from .clustering import ClusteringEngine, RootCauseCluster
46
+ from .bundle import BundleManager, RemediationBundle
47
+ from .governance import PatchGovernor, PatchPolicyDecision, HIGH_RISK_KEYWORDS, SENSITIVE_CATEGORIES
48
+ from .rechecker import TargetedRechecker, TargetedRecheckResult, RecheckOutcome
49
+ from .run_manager import RunManager
50
+ from .sarif import SarifExporter
51
+ from .v6_reporter import V6Reporter
52
+ from .v6_workflow import V6Workflow
53
+ from .stack_profiler import StackProfiler, StackProfile
54
+
55
+ # ==============================================================================
56
+ # Tier 3: Authorized Runtime Validation & Exploitability Confirmation (v0.7 engine)
57
+ # ==============================================================================
58
+ from .authorization import AuthorizationManager, AuthorizationRecord, TargetScope, AuthorizationError
59
+ from .safety_gate import SafetyGate, SafetyDecision, SafetyReviewLevel
60
+ from .runtime_evidence import EvidenceCollector, RuntimeEvidenceItem, RedactionEngine
61
+ from .runtime_validator import WebValidator, SessionState
62
+ from .exploit_checker import ExploitChecker, ExploitCheckResult, ExploitabilityStatus
63
+ from .browser_verifier import BrowserVerifier, BrowserAction
64
+ from .agent_roles import RoleOrchestrator, RoleHandoff, AgentRole
65
+ from .replay_trace import ReplayManager, ReplayTrace, ReplayStep
66
+ from .v070_reporter import V070Reporter
67
+ from .v070_workflow import V070Workflow
68
+
69
+ __version__ = "0.7.0"
70
+
71
+ __all__ = [
72
+ # Tier 1: Canonical Models & Lifecycle
73
+ "Finding",
74
+ "Evidence",
75
+ "Remediation",
76
+ "FrameworkPattern",
77
+ "AffectedComponent",
78
+ "ReproductionMethod",
79
+ "RetestRecord",
80
+ "NotesRecord",
81
+ "FindingTimestamps",
82
+ "ProvenanceChain",
83
+ "ConfidenceScore",
84
+ "ConfidenceFactors",
85
+ "ConfidenceBand",
86
+ "SeverityLevel",
87
+ "SeverityInfo",
88
+ "RemediationPriority",
89
+ "FindingStatus",
90
+ "LifecycleStage",
91
+ "TaxonomyCategory",
92
+ "EvidenceType",
93
+ "AuditReport",
94
+ "mask_sensitive_data",
95
+ "FindingLifecycleManager",
96
+ "LifecycleTransitionError",
97
+ "ReportFormatter",
98
+ "RunFolder",
99
+ # Tier 2: Governed Remediation & v0.6 Engine
100
+ "IdentityEngine",
101
+ "FindingFingerprint",
102
+ "ClusteringEngine",
103
+ "RootCauseCluster",
104
+ "BundleManager",
105
+ "RemediationBundle",
106
+ "PatchGovernor",
107
+ "PatchPolicyDecision",
108
+ "HIGH_RISK_KEYWORDS",
109
+ "SENSITIVE_CATEGORIES",
110
+ "TargetedRechecker",
111
+ "TargetedRecheckResult",
112
+ "RecheckOutcome",
113
+ "RunManager",
114
+ "SarifExporter",
115
+ "V6Reporter",
116
+ "V6Workflow",
117
+ "StackProfiler",
118
+ "StackProfile",
119
+ # Tier 3: Authorized Runtime Validation & v0.7 Engine
120
+ "AuthorizationManager",
121
+ "AuthorizationRecord",
122
+ "TargetScope",
123
+ "AuthorizationError",
124
+ "SafetyGate",
125
+ "SafetyDecision",
126
+ "SafetyReviewLevel",
127
+ "EvidenceCollector",
128
+ "RuntimeEvidenceItem",
129
+ "RedactionEngine",
130
+ "WebValidator",
131
+ "SessionState",
132
+ "ExploitChecker",
133
+ "ExploitCheckResult",
134
+ "ExploitabilityStatus",
135
+ "BrowserVerifier",
136
+ "BrowserAction",
137
+ "RoleOrchestrator",
138
+ "RoleHandoff",
139
+ "AgentRole",
140
+ "ReplayManager",
141
+ "ReplayTrace",
142
+ "ReplayStep",
143
+ "V070Reporter",
144
+ "V070Workflow",
145
+ ]
146
+