torusguard 1.3.5 → 1.3.6

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 (152) hide show
  1. package/.torusguard/.manifest.json +35 -35
  2. package/.torusguard/runs/report-latest.html +2685 -303
  3. package/.torusguard/runs/results-latest.sarif +20 -0
  4. package/.torusguard/runs/run-20260918-104221-audit/findings.json +1 -0
  5. package/.torusguard/runs/run-20260918-104221-audit/findings.md +8 -0
  6. package/.torusguard/runs/run-20260918-104221-audit/manifest.json +12 -0
  7. package/.torusguard/runs/run-20260918-104221-audit/summary.md +5 -0
  8. package/.torusguard/runs/run-20260918-104236-audit/findings.json +2314 -0
  9. package/.torusguard/runs/run-20260918-104236-audit/findings.md +960 -0
  10. package/.torusguard/runs/run-20260918-104236-audit/manifest.json +12 -0
  11. package/.torusguard/runs/run-20260918-104236-audit/summary.md +5 -0
  12. package/.torusguard/runs/run-20260918-105723-audit/findings.json +2382 -0
  13. package/.torusguard/runs/run-20260918-105723-audit/findings.md +960 -0
  14. package/.torusguard/runs/run-20260918-105723-audit/manifest.json +12 -0
  15. package/.torusguard/runs/run-20260918-105723-audit/summary.md +5 -0
  16. package/.torusguard/runs/run-20260918-105731-audit/findings.json +1 -0
  17. package/.torusguard/runs/run-20260918-105731-audit/findings.md +8 -0
  18. package/.torusguard/runs/run-20260918-105731-audit/manifest.json +12 -0
  19. package/.torusguard/runs/run-20260918-105731-audit/summary.md +5 -0
  20. package/.torusguard/runs/run-20260918-105940-audit/findings.json +1 -0
  21. package/.torusguard/runs/run-20260918-105940-audit/findings.md +8 -0
  22. package/.torusguard/runs/run-20260918-105940-audit/manifest.json +12 -0
  23. package/.torusguard/runs/run-20260918-105940-audit/summary.md +5 -0
  24. package/.torusguard/scripts/__pycache__/apply_runner.cpython-314.pyc +0 -0
  25. package/.torusguard/scripts/__pycache__/audit_runner.cpython-314.pyc +0 -0
  26. package/.torusguard/scripts/__pycache__/diff_guard.cpython-314.pyc +0 -0
  27. package/.torusguard/scripts/__pycache__/finding_scorer.cpython-314.pyc +0 -0
  28. package/.torusguard/scripts/__pycache__/harden_runner.cpython-314.pyc +0 -0
  29. package/.torusguard/scripts/__pycache__/html_reporter.cpython-314.pyc +0 -0
  30. package/.torusguard/scripts/__pycache__/manifest_builder.cpython-314.pyc +0 -0
  31. package/.torusguard/scripts/__pycache__/memory_engine.cpython-314.pyc +0 -0
  32. package/.torusguard/scripts/__pycache__/monorepo_detector.cpython-314.pyc +0 -0
  33. package/.torusguard/scripts/__pycache__/recheck_runner.cpython-314.pyc +0 -0
  34. package/.torusguard/scripts/__pycache__/report_sync.cpython-314.pyc +0 -0
  35. package/.torusguard/scripts/__pycache__/run_manager.cpython-314.pyc +0 -0
  36. package/.torusguard/scripts/__pycache__/sarif_exporter.cpython-314.pyc +0 -0
  37. package/.torusguard/scripts/__pycache__/stack_detect.cpython-314.pyc +0 -0
  38. package/.torusguard/scripts/__pycache__/term_ui.cpython-314.pyc +0 -0
  39. package/.torusguard/scripts/apply_runner.py +11 -5
  40. package/.torusguard/scripts/audit_runner.py +222 -15
  41. package/.torusguard/scripts/harden_runner.py +3 -3
  42. package/.torusguard/scripts/html_reporter.py +2668 -648
  43. package/.torusguard/scripts/recheck_runner.py +3 -3
  44. package/.torusguard/scripts/recipes_runner.py +3 -3
  45. package/.torusguard/scripts/report_sync.py +370 -74
  46. package/.torusguard/scripts/sarif_exporter.py +48 -8
  47. package/.torusguard/scripts/stack_detect.py +44 -2
  48. package/.torusguard/scripts/term_ui.py +1 -1
  49. package/.torusguard/skills/torusguard/SKILL.md +75 -72
  50. package/.torusguard/skills/torusguard-apply/SKILL.md +84 -80
  51. package/.torusguard/skills/torusguard-audit/SKILL.md +87 -83
  52. package/.torusguard/skills/torusguard-authorize/SKILL.md +7 -2
  53. package/.torusguard/skills/torusguard-exploit-check/SKILL.md +7 -2
  54. package/.torusguard/skills/torusguard-full/SKILL.md +7 -2
  55. package/.torusguard/skills/torusguard-harden/SKILL.md +98 -94
  56. package/.torusguard/skills/torusguard-init/SKILL.md +68 -64
  57. package/.torusguard/skills/torusguard-recheck/SKILL.md +81 -77
  58. package/.torusguard/skills/torusguard-report/SKILL.md +93 -72
  59. package/.torusguard/skills/torusguard-status/SKILL.md +62 -58
  60. package/.torusguard/skills/torusguard-verify/SKILL.md +7 -2
  61. package/.torusguard/skills/torusguard-web-validate/SKILL.md +7 -2
  62. package/.torusguard/workflows/apply.md +1 -1
  63. package/.torusguard/workflows/audit.md +1 -1
  64. package/.torusguard/workflows/authorize.md +1 -1
  65. package/.torusguard/workflows/exploit-check.md +1 -1
  66. package/.torusguard/workflows/harden.md +1 -1
  67. package/.torusguard/workflows/init.md +1 -1
  68. package/.torusguard/workflows/memory.md +1 -1
  69. package/.torusguard/workflows/recheck.md +1 -1
  70. package/.torusguard/workflows/report.md +1 -1
  71. package/.torusguard/workflows/status.md +1 -1
  72. package/.torusguard/workflows/verify.md +1 -1
  73. package/.torusguard/workflows/web-validate.md +1 -1
  74. package/README.md +14 -8
  75. package/bin/torusguard.js +56 -20
  76. package/package.json +1 -1
  77. package/skills/torusguard/SKILL.md +1 -1
  78. package/skills/torusguard/bootstrap.py +7 -2
  79. package/skills/torusguard/payload/.manifest.json +35 -35
  80. package/skills/torusguard/payload/scripts/__pycache__/apply_runner.cpython-314.pyc +0 -0
  81. package/skills/torusguard/payload/scripts/__pycache__/audit_runner.cpython-311.pyc +0 -0
  82. package/skills/torusguard/payload/scripts/__pycache__/audit_runner.cpython-314.pyc +0 -0
  83. package/skills/torusguard/payload/scripts/__pycache__/diff_guard.cpython-311.pyc +0 -0
  84. package/skills/torusguard/payload/scripts/__pycache__/diff_guard.cpython-314.pyc +0 -0
  85. package/skills/torusguard/payload/scripts/__pycache__/finding_scorer.cpython-311.pyc +0 -0
  86. package/skills/torusguard/payload/scripts/__pycache__/finding_scorer.cpython-314.pyc +0 -0
  87. package/skills/torusguard/payload/scripts/__pycache__/harden_runner.cpython-314.pyc +0 -0
  88. package/skills/torusguard/payload/scripts/__pycache__/html_reporter.cpython-311.pyc +0 -0
  89. package/skills/torusguard/payload/scripts/__pycache__/html_reporter.cpython-314.pyc +0 -0
  90. package/skills/torusguard/payload/scripts/__pycache__/manifest_builder.cpython-314.pyc +0 -0
  91. package/skills/torusguard/payload/scripts/__pycache__/memory_engine.cpython-311.pyc +0 -0
  92. package/skills/torusguard/payload/scripts/__pycache__/memory_engine.cpython-314.pyc +0 -0
  93. package/skills/torusguard/payload/scripts/__pycache__/monorepo_detector.cpython-311.pyc +0 -0
  94. package/skills/torusguard/payload/scripts/__pycache__/monorepo_detector.cpython-314.pyc +0 -0
  95. package/skills/torusguard/payload/scripts/__pycache__/recheck_runner.cpython-314.pyc +0 -0
  96. package/skills/torusguard/payload/scripts/__pycache__/report_sync.cpython-311.pyc +0 -0
  97. package/skills/torusguard/payload/scripts/__pycache__/report_sync.cpython-314.pyc +0 -0
  98. package/skills/torusguard/payload/scripts/__pycache__/rules_sync.cpython-311.pyc +0 -0
  99. package/skills/torusguard/payload/scripts/__pycache__/run_manager.cpython-311.pyc +0 -0
  100. package/skills/torusguard/payload/scripts/__pycache__/run_manager.cpython-314.pyc +0 -0
  101. package/skills/torusguard/payload/scripts/__pycache__/sarif_exporter.cpython-314.pyc +0 -0
  102. package/skills/torusguard/payload/scripts/__pycache__/stack_detect.cpython-311.pyc +0 -0
  103. package/skills/torusguard/payload/scripts/__pycache__/stack_detect.cpython-314.pyc +0 -0
  104. package/skills/torusguard/payload/scripts/__pycache__/term_ui.cpython-311.pyc +0 -0
  105. package/skills/torusguard/payload/scripts/__pycache__/term_ui.cpython-314.pyc +0 -0
  106. package/skills/torusguard/payload/scripts/apply_runner.py +11 -5
  107. package/skills/torusguard/payload/scripts/audit_runner.py +222 -15
  108. package/skills/torusguard/payload/scripts/harden_runner.py +3 -3
  109. package/skills/torusguard/payload/scripts/html_reporter.py +2668 -648
  110. package/skills/torusguard/payload/scripts/recheck_runner.py +3 -3
  111. package/skills/torusguard/payload/scripts/recipes_runner.py +3 -3
  112. package/skills/torusguard/payload/scripts/report_sync.py +370 -74
  113. package/skills/torusguard/payload/scripts/sarif_exporter.py +48 -8
  114. package/skills/torusguard/payload/scripts/stack_detect.py +44 -2
  115. package/skills/torusguard/payload/scripts/term_ui.py +1 -1
  116. package/skills/torusguard/payload/skills/torusguard/SKILL.md +1 -1
  117. package/skills/torusguard/payload/skills/torusguard-apply/SKILL.md +1 -1
  118. package/skills/torusguard/payload/skills/torusguard-audit/SKILL.md +1 -1
  119. package/skills/torusguard/payload/skills/torusguard-authorize/SKILL.md +1 -1
  120. package/skills/torusguard/payload/skills/torusguard-exploit-check/SKILL.md +1 -1
  121. package/skills/torusguard/payload/skills/torusguard-full/SKILL.md +1 -1
  122. package/skills/torusguard/payload/skills/torusguard-harden/SKILL.md +1 -1
  123. package/skills/torusguard/payload/skills/torusguard-init/SKILL.md +1 -1
  124. package/skills/torusguard/payload/skills/torusguard-recheck/SKILL.md +1 -1
  125. package/skills/torusguard/payload/skills/torusguard-report/SKILL.md +40 -23
  126. package/skills/torusguard/payload/skills/torusguard-status/SKILL.md +1 -1
  127. package/skills/torusguard/payload/skills/torusguard-verify/SKILL.md +1 -1
  128. package/skills/torusguard/payload/skills/torusguard-web-validate/SKILL.md +1 -1
  129. package/skills/torusguard/payload/workflows/apply.md +1 -1
  130. package/skills/torusguard/payload/workflows/audit.md +1 -1
  131. package/skills/torusguard/payload/workflows/authorize.md +1 -1
  132. package/skills/torusguard/payload/workflows/exploit-check.md +1 -1
  133. package/skills/torusguard/payload/workflows/harden.md +1 -1
  134. package/skills/torusguard/payload/workflows/init.md +1 -1
  135. package/skills/torusguard/payload/workflows/memory.md +1 -1
  136. package/skills/torusguard/payload/workflows/recheck.md +1 -1
  137. package/skills/torusguard/payload/workflows/report.md +1 -1
  138. package/skills/torusguard/payload/workflows/status.md +1 -1
  139. package/skills/torusguard/payload/workflows/verify.md +1 -1
  140. package/skills/torusguard/payload/workflows/web-validate.md +1 -1
  141. package/skills/torusguard-apply/SKILL.md +1 -1
  142. package/skills/torusguard-audit/SKILL.md +1 -1
  143. package/skills/torusguard-authorize/SKILL.md +1 -1
  144. package/skills/torusguard-exploit-check/SKILL.md +1 -1
  145. package/skills/torusguard-full/SKILL.md +1 -1
  146. package/skills/torusguard-harden/SKILL.md +1 -1
  147. package/skills/torusguard-init/SKILL.md +1 -1
  148. package/skills/torusguard-recheck/SKILL.md +1 -1
  149. package/skills/torusguard-report/SKILL.md +40 -23
  150. package/skills/torusguard-status/SKILL.md +1 -1
  151. package/skills/torusguard-verify/SKILL.md +1 -1
  152. package/skills/torusguard-web-validate/SKILL.md +1 -1
@@ -9,6 +9,7 @@ import sys
9
9
  import json
10
10
  import hashlib
11
11
  import argparse
12
+ from pathlib import Path
12
13
  from typing import List, Dict, Any
13
14
 
14
15
  def generate_sarif(findings: List[Dict[str, Any]], run_id: str = "default", category: str = "torusguard/static") -> Dict[str, Any]:
@@ -76,7 +77,7 @@ def generate_sarif(findings: List[Dict[str, Any]], run_id: str = "default", cate
76
77
  "tool": {
77
78
  "driver": {
78
79
  "name": "TorusGuard",
79
- "semanticVersion": "1.3.5",
80
+ "semanticVersion": "1.3.6",
80
81
  "informationUri": "https://github.com/githubmofo/TorusGuard",
81
82
  "rules": list(rules_map.values())
82
83
  }
@@ -95,22 +96,61 @@ def main():
95
96
  parser = argparse.ArgumentParser(description="TorusGuard SARIF v2.1.0 Exporter")
96
97
  parser.add_argument("--input", "-i", help="Path to findings JSON file")
97
98
  parser.add_argument("--output", "-o", help="Output path for sarif.json")
98
- parser.add_argument("--run-id", default="run-default", help="Unique execution Run ID")
99
+ parser.add_argument("--root", "-r", help="Project root override")
100
+ parser.add_argument("--run-id", default=None, help="Unique execution Run ID")
101
+ parser.add_argument("--stdout", action="store_true", help="Print SARIF JSON to stdout")
99
102
  args = parser.parse_args()
100
103
 
104
+ root = Path(args.root).resolve() if args.root else Path.cwd().resolve()
101
105
  findings = []
106
+ run_id = args.run_id or "run-default"
107
+
102
108
  if args.input:
103
- with open(args.input, "r", encoding="utf-8") as f:
104
- findings = json.load(f)
109
+ in_path = Path(args.input)
110
+ if not in_path.is_absolute():
111
+ in_path = (root / in_path).resolve()
112
+ if in_path.is_file():
113
+ with open(in_path, "r", encoding="utf-8") as f:
114
+ findings = json.load(f)
115
+ else:
116
+ # Auto-discover latest audit run findings
117
+ runs_dir = root / ".torusguard" / "runs"
118
+ if runs_dir.is_dir():
119
+ run_folders = sorted(
120
+ [d for d in runs_dir.iterdir() if d.is_dir() and (d / "findings.json").is_file()],
121
+ key=lambda p: p.stat().st_mtime,
122
+ reverse=True
123
+ )
124
+ if run_folders:
125
+ latest_run = run_folders[0]
126
+ run_id = args.run_id or latest_run.name
127
+ findings_file = latest_run / "findings.json"
128
+ try:
129
+ with open(findings_file, "r", encoding="utf-8") as f:
130
+ findings = json.load(f)
131
+ except Exception:
132
+ findings = []
105
133
 
106
- sarif = generate_sarif(findings, run_id=args.run_id)
134
+ sarif = generate_sarif(findings, run_id=run_id)
107
135
 
108
136
  if args.output:
109
- with open(args.output, "w", encoding="utf-8") as f:
137
+ out_path = Path(args.output)
138
+ if not out_path.is_absolute():
139
+ out_path = (root / out_path).resolve()
140
+ out_path.parent.mkdir(parents=True, exist_ok=True)
141
+ with open(out_path, "w", encoding="utf-8") as f:
110
142
  json.dump(sarif, f, indent=2)
111
- print(f"SARIF log written to: {args.output}")
112
- else:
143
+ print(f"[SUCCESS] SARIF log written to: {out_path}")
144
+ elif args.stdout:
113
145
  print(json.dumps(sarif, indent=2))
146
+ else:
147
+ # Default to writing in .torusguard/runs/results-latest.sarif
148
+ default_sarif = root / ".torusguard" / "runs" / "results-latest.sarif"
149
+ default_sarif.parent.mkdir(parents=True, exist_ok=True)
150
+ with open(default_sarif, "w", encoding="utf-8") as f:
151
+ json.dump(sarif, f, indent=2)
152
+ print(f"[SUCCESS] SARIF log written to: {default_sarif}")
153
+
114
154
 
115
155
  if __name__ == "__main__":
116
156
  main()
@@ -221,6 +221,24 @@ def detect_stack(project_root: Path) -> dict[str, Any]:
221
221
  "indicator": "Flask application instantiation"
222
222
  })
223
223
  profile["recommended_references"].append("flask-security.md")
224
+ elif "tornado" in content or "tornado.web" in content:
225
+ add_to_list(profile, "languages_found", "Python")
226
+ profile["ecosystem_family"] = "python"
227
+ add_to_list(profile, "frameworks_found", "Tornado")
228
+ profile["confidence"] = "Confirmed"
229
+ profile["detection_evidence"].append({
230
+ "file": str(py_file.relative_to(project_root)),
231
+ "indicator": "Tornado application"
232
+ })
233
+ elif "starlette" in content:
234
+ add_to_list(profile, "languages_found", "Python")
235
+ profile["ecosystem_family"] = "python"
236
+ add_to_list(profile, "frameworks_found", "Starlette")
237
+ profile["confidence"] = "Confirmed"
238
+ profile["detection_evidence"].append({
239
+ "file": str(py_file.relative_to(project_root)),
240
+ "indicator": "Starlette application"
241
+ })
224
242
 
225
243
  if "sqlalchemy" in content:
226
244
  add_to_list(profile, "data_layers_found", "SQLAlchemy")
@@ -286,11 +304,27 @@ def detect_stack(project_root: Path) -> dict[str, Any]:
286
304
  profile["confidence"] = "Confirmed"
287
305
  profile["detection_evidence"].append({"file": "package.json", "indicator": "express dependency"})
288
306
  profile["recommended_references"].append("express-security.md")
307
+ elif "fastify" in deps:
308
+ add_to_list(profile, "frameworks_found", "Fastify")
309
+ profile["confidence"] = "Confirmed"
310
+ profile["detection_evidence"].append({"file": "package.json", "indicator": "fastify dependency"})
311
+ elif "koa" in deps:
312
+ add_to_list(profile, "frameworks_found", "Koa")
313
+ profile["confidence"] = "Confirmed"
314
+ profile["detection_evidence"].append({"file": "package.json", "indicator": "koa dependency"})
315
+ elif "@remix-run/react" in deps or "@remix-run/node" in deps:
316
+ add_to_list(profile, "frameworks_found", "Remix")
317
+ profile["confidence"] = "Confirmed"
318
+ profile["detection_evidence"].append({"file": "package.json", "indicator": "Remix dependency"})
289
319
  elif "react" in deps:
290
320
  add_to_list(profile, "frameworks_found", "React / Vite")
291
321
  profile["confidence"] = "Confirmed"
292
322
  profile["detection_evidence"].append({"file": "package.json", "indicator": "react dependency"})
293
323
  profile["recommended_references"].append("react-vite-security.md")
324
+ elif "vite" in deps:
325
+ add_to_list(profile, "frameworks_found", "Vite")
326
+ profile["confidence"] = "Confirmed"
327
+ profile["detection_evidence"].append({"file": "package.json", "indicator": "vite dependency"})
294
328
 
295
329
  # ORM / Data layer detection
296
330
  if "@prisma/client" in deps or "prisma" in deps:
@@ -433,6 +467,8 @@ def detect_stack(project_root: Path) -> dict[str, Any]:
433
467
 
434
468
  if "Microsoft.NET.Sdk.Web" in csproj_content or "Microsoft.AspNetCore" in csproj_content or "Swashbuckle" in csproj_content:
435
469
  add_to_list(profile, "frameworks_found", "ASP.NET Core")
470
+ if list(project_root.glob("**/*.razor")) or "Microsoft.AspNetCore.Components" in csproj_content or "blazor" in csproj_content.lower():
471
+ add_to_list(profile, "frameworks_found", "Blazor")
436
472
  if "Microsoft.EntityFrameworkCore" in csproj_content:
437
473
  add_to_list(profile, "data_layers_found", "Entity Framework Core")
438
474
  elif "Dapper" in csproj_content:
@@ -442,11 +478,17 @@ def detect_stack(project_root: Path) -> dict[str, Any]:
442
478
  # G. PHP Ecosystem
443
479
  # -------------------------------------------------------------------------
444
480
  composer_json = project_root / "composer.json"
445
- if composer_json.is_file():
481
+ is_wordpress = (project_root / "wp-config.php").is_file() or (project_root / "wp-load.php").is_file() or (project_root / "wp-content").is_dir()
482
+ if composer_json.is_file() or is_wordpress:
446
483
  add_to_list(profile, "languages_found", "PHP")
447
484
  profile["ecosystem_family"] = "php"
448
485
  profile["confidence"] = "Confirmed"
449
- profile["detection_evidence"].append({"file": "composer.json", "indicator": "PHP Composer manifest"})
486
+ if is_wordpress:
487
+ add_to_list(profile, "frameworks_found", "WordPress")
488
+ add_to_list(profile, "data_layers_found", "MySQL / wpdb")
489
+ profile["detection_evidence"].append({"file": "wp-config.php" if (project_root / "wp-config.php").is_file() else "wp-content", "indicator": "WordPress installation"})
490
+ if composer_json.is_file():
491
+ profile["detection_evidence"].append({"file": "composer.json", "indicator": "PHP Composer manifest"})
450
492
  profile["recommended_rules"].extend(["TG-SEC-*", "TG-INPUT-001", "TG-INPUT-002", "TG-PLATFORM-*"])
451
493
  profile["recommended_references"].append("polyglot-security-matrix.md")
452
494
 
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env python3
2
2
  """
3
- TorusGuard Unified Terminal UI Engine (v1.3.5)
3
+ TorusGuard Unified Terminal UI Engine (v1.3.6)
4
4
  Provides mathematically exact 75-column card formatting, ANSI-stripping,
5
5
  Unicode/emoji visual width calculation, and visual truncation with ellipsis.
6
6
  Pure Python 3.10+ standard library (zero external dependencies).
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: torusguard
3
3
  description: Universal autonomous security engine: 74 canonical rules across 18 families, polyglot stack detection across 16+ languages, Ponytail remediation bounds (<=35 add, <=25 del), standardized 75-column terminal UI, SARIF v2.1.0 exports, and persistent security memory context.
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  ---
6
6
 
7
7
  # TorusGuard Master Security Engine & Command Router
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: torusguard-apply
3
3
  description: Apply governed remediation patches to disk with pre-apply rollback snapshots and Human Gate validation via CLI or AI Agent.
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  workflow: .torusguard/workflows/apply.md
6
6
  tools: Read, Grep, Glob, Write, replace_file_content, run_command
7
7
  scripts-binding:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: torusguard-audit
3
3
  description: Static AST security scanning, line-shift invariant fingerprinting, root-cause clustering, and 0-100 confidence scoring via CLI or AI Agent.
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  workflow: .torusguard/workflows/audit.md
6
6
  tools: Read, Grep, Glob, Write, run_command
7
7
  scripts-binding:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: torusguard-authorize
3
3
  description: Register and validate runtime target authorization boundaries — scope boundaries, ownership proofs, TTL expiration, and Safety Gate enforcement.
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  workflow: .torusguard/workflows/authorize.md
6
6
  tools: Read, Grep, Glob, Write, run_command
7
7
  scripts-binding:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: torusguard-exploit-check
3
3
  description: Safe, non-destructive confirmation of exploitability using inert canary tokens and sentinels.
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  workflow: .torusguard/workflows/exploit-check.md
6
6
  tools: Read, Grep, Glob, Bash, Write, run_command
7
7
  scripts-binding:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: torusguard-full
3
3
  description: Master 7-stage security pipeline orchestrator — coordinates discovery, authorization, static audit, runtime validation, governed remediation, recheck, and reporting.
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  workflow: .torusguard/workflows/audit.md
6
6
  tools: Read, Grep, Glob, Bash, Edit, Write, run_command
7
7
  scripts-binding:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: torusguard-harden
3
3
  description: Package surgical remediation bundles conforming to the Ponytail Protocol (<= 35 additions, <= 25 deletions) via CLI or AI Agent.
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  workflow: .torusguard/workflows/harden.md
6
6
  tools: Read, Grep, Glob, Write, run_command
7
7
  scripts-binding:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: torusguard-init
3
3
  description: Initialize TorusGuard workspace — detect project stack, activate tailored TG-* security rules, and generate SECURITY.md baseline via CLI or AI Agent.
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  workflow: .torusguard/workflows/init.md
6
6
  tools: Read, Grep, Glob, Write, run_command
7
7
  scripts-binding:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: torusguard-recheck
3
3
  description: Execute targeted differential AST re-scan against modified files, verify fix closure, and assert zero regressions via CLI or AI Agent.
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  workflow: .torusguard/workflows/recheck.md
6
6
  tools: Read, Grep, Glob, Write, run_command
7
7
  scripts-binding:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: torusguard-report
3
3
  description: Generate executive posture reports, export OASIS SARIF v2.1.0 logs, and render dark-mode HTML dashboards via CLI or AI Agent.
4
- version: 1.3.5
4
+ version: 2.2.0
5
5
  workflow: .torusguard/workflows/report.md
6
6
  tools: Read, Grep, Glob, Write, run_command
7
7
  scripts-binding:
@@ -15,61 +15,78 @@ scripts-binding:
15
15
  # TorusGuard Report — Posture Reporting & SARIF / HTML Export
16
16
 
17
17
  ## Objective
18
- Aggregate findings, verification traces, and recheck results into an auditable executive security report, export schema-compliant OASIS SARIF v2.1.0 logs for CI/CD pipelines, and render zero-dependency single-file visual HTML posture reports.
18
+ Aggregate findings, verification traces, and recheck results into an auditable executive security report, export schema-compliant OASIS SARIF v2.1.0 logs for CI/CD pipelines, and render zero-dependency single-file visual HTML posture reports with full dual-mode parity.
19
19
 
20
20
  ---
21
21
 
22
- ## Two Execution Modes
22
+ ## Execution Steps
23
23
 
24
24
  ### Mode A: Automated CLI Execution
25
25
  Run the report engine from your terminal:
26
26
  ```bash
27
- # Generate visual dark-mode HTML dashboard
27
+ # Generate visual dark-mode HTML dashboard (defaults to report.html at project root)
28
28
  npx torusguard report --html
29
29
 
30
30
  # Export OASIS SARIF v2.1.0 for GitHub Code Scanning / CI
31
31
  npx torusguard report --sarif
32
32
 
33
- # Generate both HTML and SARIF for latest run
33
+ # Generate both HTML and SARIF in a single pass
34
34
  npx torusguard report --html --sarif
35
35
 
36
- # Generate report for a specific project directory
37
- npx torusguard report ./examples/vulnerable-react-express --html
36
+ # Custom HTML output location
37
+ npx torusguard report --html --out ./docs/security-audit.html
38
38
 
39
- # Target a specific run ID
40
- npx torusguard report --run run-20260910-121618-audit --html
39
+ # Target a specific subproject / monorepo package
40
+ npx torusguard report --target ./apps/api --html
41
41
  ```
42
+
42
43
  **Under the Hood:**
43
- - Invokes `python .torusguard/scripts/html_reporter.py` to compile self-contained, offline-ready HTML reports with dynamic filtering, posture gauge, and cluster summaries at `.torusguard/runs/<run_id>/report.html`.
44
- - Invokes `python .torusguard/scripts/sarif_exporter.py` to produce OASIS SARIF v2.1.0 logs at `.torusguard/runs/<run_id>/results.sarif`.
44
+ - Invokes `python .torusguard/scripts/html_reporter.py` to compile self-contained, offline-ready HTML reports with dynamic filtering, posture gauge, directory attack surface heatmap, and golden recipe explorer at `report.html` (workspace root) and mirrors to `.torusguard/runs/report-latest.html`.
45
+ - Invokes `python .torusguard/scripts/sarif_exporter.py` to produce OASIS SARIF v2.1.0 logs at `.torusguard/runs/results-latest.sarif`.
45
46
  - Finalizes `manifest.json` metrics and updates historical posture scoring.
46
- - Displays 75-column terminal cards.
47
+ - Displays standardized 75-column terminal cards adhering to visual width invariants.
47
48
 
48
49
  ### Mode B: In-Session AI Chat Agent Reporting
49
50
  When generating security posture summaries in AI chat:
50
51
  1. **Aggregate Run Data:** Inspect `findings.json`, `remediation.md`, and `recheck.md` from the active run.
51
- 2. **Calculate Posture Score:** Compute posture score ($0$–$100$) based on severity weighting (Critical: 25, High: 15, Medium: 5, Low: 2).
52
+ 2. **Calculate Posture Score:** Compute posture score ($0$–$100$) based on severity weighting (Critical: 25, High: 15, Medium: 5, Low: 2). Clean repositories earn 100/100 across 74 defended invariants.
52
53
  3. **Format Executive Card:** Present finding counts, closed vulnerabilities, remaining risks, and compliance posture.
53
- 4. **Export Artifacts:** Verify that `report.html` and `results.sarif` are serialized to disk.
54
+ 4. **Export Artifacts:** Verify that `report.html` and `results-latest.sarif` are serialized to disk.
55
+ 5. **Keep Living Ledger in Lockstep:** Ensure `security_report.md` reflects all findings and verified closures.
56
+
57
+ ---
58
+
59
+ ## Zero-CDN & Offline Guarantee
60
+ - Zero external `<script>` or `<link>` tags. All styles, fonts, SVG icons, and scripts are embedded directly inside `report.html`.
61
+ - Full offline inspection: can be opened directly via `file:///` without an active internet connection.
62
+ - In-browser artifact downloads (SARIF v2.1.0 and CSV) use native `URL.createObjectURL(new Blob(...))` with zero network calls.
54
63
 
55
64
  ---
56
65
 
57
- ## SARIF v2.1.0 Specification
66
+ ## SARIF v2.1.0 Output Specification
58
67
  - **Schema:** `https://docs.oasis-open.org/sarif/sarif/v2.1.0/cos02/schemas/sarif-schema-2.1.0.json`
59
- - **Tool Driver:** `name: TorusGuard`, `semanticVersion: 1.3.5`, full rules catalog in `driver.rules`.
68
+ - **Tool Driver:** `name: TorusGuard`, `semanticVersion: 1.3.6`, full rules catalog in `driver.rules`.
60
69
  - **Automation Details:** `automationDetails.id: "torusguard/static"` to avoid collisions in multi-scanner CI/CD pipelines.
61
70
  - **Fingerprints:** `partialFingerprints.primaryLocationLineHash` with SHA-256 context hash.
62
71
 
63
72
  ---
64
73
 
65
- ## Output Card Format
74
+ ## Safety Constraints
75
+ - Never display raw secrets, tokens, or credentials in terminal outputs or emitted reports.
76
+ - Enforce read-only state for `report` actions — never modify source code during report generation.
77
+ - Ensure atomic writes with fallback retry to prevent corrupt reports during concurrent browser viewing.
78
+ - Respect monorepo target boundaries when `--target` is specified.
79
+
80
+ ---
81
+
82
+ ## Output Format
66
83
  ```markdown
67
- ### 📊 TorusGuard Security Posture Report Emitted
68
- - **Run ID:** `run-20260910-121618-audit`
69
- - **Posture Score:** 85 / 100 (HIGH SECURITY)
70
- - **Findings Summary:** 3 Evaluated · 2 Confirmed Fixed · 1 Unresolved
71
- - **HTML Dashboard:** `.torusguard/runs/<run_id>/report.html` (View in browser)
72
- - **SARIF v2.1.0 Export:** `.torusguard/runs/<run_id>/results.sarif` (Ready for CI)
84
+ ### 🛡️ TorusGuard Security Posture Report Emitted
85
+ - **Posture Score:** 100 / 100 (OPTIMAL DEFENSE)
86
+ - **Invariants Defended:** 74 Defended · 0 Harmed (74 Rules)
87
+ - **HTML Dashboard:** `report.html` (View in browser)
88
+ - **SARIF v2.1.0 Export:** `.torusguard/runs/results-latest.sarif` (Ready for CI)
89
+ - **Living Ledger:** `security_report.md` (Synchronized in lockstep)
73
90
  ```
74
91
 
75
92
  ## Living Report Ground Truth
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: torusguard-status
3
3
  description: Display current TorusGuard security posture, active configuration, rules catalog, and run history via CLI or AI Agent.
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  workflow: .torusguard/workflows/status.md
6
6
  tools: Read, Grep, Glob, run_command, Write
7
7
  scripts-binding:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: torusguard-verify
3
3
  description: Verify finding evidence sufficiency, audit live code line matches, and calibrate 0–100 confidence scores.
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  workflow: .torusguard/workflows/verify.md
6
6
  tools: Read, Grep, Glob, Write, run_command
7
7
  scripts-binding:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: torusguard-web-validate
3
3
  description: Execute authorized HTTP probing against local/staging web applications — session capture, transparent audit headers, and secret redaction.
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  workflow: .torusguard/workflows/web-validate.md
6
6
  tools: Read, Grep, Glob, Bash, Write, run_command
7
7
  scripts-binding:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  description: Governed patch application with pre-apply rollback snapshots and Human Gate authorization.
3
3
  tools: Read, Grep, Glob, Bash, Edit, Write
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  agent: remediator
6
6
  lifecycle-phase: Phase 5 (Patch Application)
7
7
  required-skills:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  description: Static security AST scanning, stable line-shift invariant fingerprinting, root-cause clustering, and 0-100 confidence scoring.
3
3
  tools: Read, Grep, Glob, Bash, Write
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  agent: auditor
6
6
  lifecycle-phase: Phase 2 (Static Audit & Clustering)
7
7
  required-skills:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  description: Legal scope definition, target ownership proof verification, and safety boundary enforcement for runtime validation.
3
3
  tools: Read, Grep, Glob, Bash, Write
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  agent: reviewer
6
6
  lifecycle-phase: Phase 1 (Authorization Gate)
7
7
  required-skills:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  description: Safe, bounded, single-step exploitability confirmation across 5 standard verification statuses.
3
3
  tools: Read, Grep, Glob, Bash, Write
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  agent: validator
6
6
  lifecycle-phase: Phase 3c (Exploitability Check)
7
7
  required-skills:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  description: Governed remediation formulation under strict Ponytail Protocol bounds (<= 35 additions, <= 25 deletions) and bundle packaging.
3
3
  tools: Read, Grep, Glob, Bash, Write
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  agent: remediator
6
6
  lifecycle-phase: Phase 4 (Remediation Formulation)
7
7
  required-skills:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  description: Baseline project discovery, workspace scaffolding, stack detection, and framework-tailored security rule activation.
3
3
  tools: Read, Grep, Glob, Bash, Write
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  agent: profiler
6
6
  lifecycle-phase: Phase 0 (Baseline Setup)
7
7
  required-skills:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  description: TorusGuard Adaptive Security Memory Engine — view memory stats, export/import intelligence, apply TTL decay, and manage false positives.
3
3
  tools: Read, Grep, Glob, Bash
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  agent: reviewer
6
6
  lifecycle-phase: Intelligence / Memory
7
7
  required-skills:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  description: Targeted differential AST re-scan, fix closure verification, and regression state machine transitions.
3
3
  tools: Read, Grep, Glob, Bash, Write
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  agent: reviewer
6
6
  lifecycle-phase: Phase 6 (Targeted Recheck & Verification)
7
7
  required-skills:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  description: Executive posture reporting, cluster analysis, signed compliance audit, and OASIS SARIF v2.1.0 structured export.
3
3
  tools: Read, Grep, Glob, Bash, Write
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  agent: reviewer
6
6
  lifecycle-phase: Phase 7 (Reporting & SARIF Export)
7
7
  required-skills:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  description: Read-only diagnostic overview of workspace security posture, active configuration, rules catalog, and run history.
3
3
  tools: Read, Grep, Glob, Bash
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  agent: reviewer
6
6
  lifecycle-phase: System / Diagnostics
7
7
  required-skills:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  description: Evidence sufficiency verification, live disk line match audit, and finding score refinement.
3
3
  tools: Read, Grep, Glob, Bash, Write
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  agent: validator
6
6
  lifecycle-phase: Phase 3a (Evidence Verification)
7
7
  required-skills:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  description: Authorized HTTP probing, token redaction, transparent audit header injection, and replay trace capture.
3
3
  tools: Read, Grep, Glob, Bash, Write
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  agent: validator
6
6
  lifecycle-phase: Phase 3b (Runtime Web Validation)
7
7
  required-skills:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: torusguard-apply
3
3
  description: Apply governed remediation patches to disk with pre-apply rollback snapshots and Human Gate validation via CLI or AI Agent.
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  workflow: .torusguard/workflows/apply.md
6
6
  tools: Read, Grep, Glob, Write, replace_file_content, run_command
7
7
  scripts-binding:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: torusguard-audit
3
3
  description: Static AST security scanning, line-shift invariant fingerprinting, root-cause clustering, and 0-100 confidence scoring via CLI or AI Agent.
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  workflow: .torusguard/workflows/audit.md
6
6
  tools: Read, Grep, Glob, Write, run_command
7
7
  scripts-binding:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: torusguard-authorize
3
3
  description: Register and validate runtime target authorization boundaries — scope boundaries, ownership proofs, TTL expiration, and Safety Gate enforcement.
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  workflow: .torusguard/workflows/authorize.md
6
6
  tools: Read, Grep, Glob, Write, run_command
7
7
  scripts-binding:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: torusguard-exploit-check
3
3
  description: Safe, non-destructive confirmation of exploitability using inert canary tokens and sentinels.
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  workflow: .torusguard/workflows/exploit-check.md
6
6
  tools: Read, Grep, Glob, Bash, Write, run_command
7
7
  scripts-binding:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: torusguard-full
3
3
  description: Master 7-stage security pipeline orchestrator — coordinates discovery, authorization, static audit, runtime validation, governed remediation, recheck, and reporting.
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  workflow: .torusguard/workflows/audit.md
6
6
  tools: Read, Grep, Glob, Bash, Edit, Write, run_command
7
7
  scripts-binding:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: torusguard-harden
3
3
  description: Package surgical remediation bundles conforming to the Ponytail Protocol (<= 35 additions, <= 25 deletions) via CLI or AI Agent.
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  workflow: .torusguard/workflows/harden.md
6
6
  tools: Read, Grep, Glob, Write, run_command
7
7
  scripts-binding:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: torusguard-init
3
3
  description: Initialize TorusGuard workspace — detect project stack, activate tailored TG-* security rules, and generate SECURITY.md baseline via CLI or AI Agent.
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  workflow: .torusguard/workflows/init.md
6
6
  tools: Read, Grep, Glob, Write, run_command
7
7
  scripts-binding:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: torusguard-recheck
3
3
  description: Execute targeted differential AST re-scan against modified files, verify fix closure, and assert zero regressions via CLI or AI Agent.
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  workflow: .torusguard/workflows/recheck.md
6
6
  tools: Read, Grep, Glob, Write, run_command
7
7
  scripts-binding: