torusguard 1.3.2 → 1.3.4
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.
- package/.torusguard/runs/report-latest.html +3 -3
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-db-004-115-9a059e/metadata.json +15 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-db-004-115-9a059e/minimal_patch_plan.md +21 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-db-004-115-9a059e/patch.diff +9 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-db-004-119-61557c/metadata.json +15 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-db-004-119-61557c/minimal_patch_plan.md +21 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-db-004-119-61557c/patch.diff +9 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-db-004-265-996ca3/metadata.json +15 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-db-004-265-996ca3/minimal_patch_plan.md +21 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-db-004-265-996ca3/patch.diff +9 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-db-004-503-d11cf8/metadata.json +15 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-db-004-503-d11cf8/minimal_patch_plan.md +21 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-db-004-503-d11cf8/patch.diff +9 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-db-004-79-91f41f/metadata.json +15 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-db-004-79-91f41f/minimal_patch_plan.md +21 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-db-004-79-91f41f/patch.diff +9 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-input-002-107-516a40/metadata.json +15 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-input-002-107-516a40/minimal_patch_plan.md +21 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-input-002-107-516a40/patch.diff +9 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-input-002-128-7809a1/metadata.json +15 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-input-002-128-7809a1/minimal_patch_plan.md +21 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-input-002-128-7809a1/patch.diff +9 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-input-002-256-c8a22e/metadata.json +15 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-input-002-256-c8a22e/minimal_patch_plan.md +21 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-input-002-256-c8a22e/patch.diff +9 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-input-003-53-d167b4/metadata.json +15 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-input-003-53-d167b4/minimal_patch_plan.md +21 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-input-003-53-d167b4/patch.diff +9 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-platform-001-183-47fd5e/metadata.json +15 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-platform-001-183-47fd5e/minimal_patch_plan.md +21 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-platform-001-183-47fd5e/patch.diff +9 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-sec-001-209-4f6424/metadata.json +15 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-sec-001-209-4f6424/minimal_patch_plan.md +21 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-sec-001-209-4f6424/patch.diff +9 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-sec-001-257-89bf34/metadata.json +15 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-sec-001-257-89bf34/minimal_patch_plan.md +21 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-sec-001-257-89bf34/patch.diff +9 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-sec-001-341-ce228c/metadata.json +15 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-sec-001-341-ce228c/minimal_patch_plan.md +21 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-sec-001-341-ce228c/patch.diff +9 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-sec-001-355-7b190b/metadata.json +15 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-sec-001-355-7b190b/minimal_patch_plan.md +21 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-sec-001-355-7b190b/patch.diff +9 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-sec-001-64-5af31a/metadata.json +15 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-sec-001-64-5af31a/minimal_patch_plan.md +21 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-sec-001-64-5af31a/patch.diff +9 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-sec-001-9-f51467/metadata.json +15 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-sec-001-9-f51467/minimal_patch_plan.md +21 -0
- package/.torusguard/runs/run-20260910-120238-audit/bundles/bnd-tg-sec-001-9-f51467/patch.diff +9 -0
- package/.torusguard/runs/run-20260910-120238-audit/findings.json +1520 -0
- package/.torusguard/runs/run-20260910-120238-audit/findings.md +560 -0
- package/.torusguard/runs/run-20260910-120238-audit/manifest.json +13 -0
- package/.torusguard/runs/run-20260910-120238-audit/recheck.md +86 -0
- package/.torusguard/runs/run-20260910-120238-audit/remediation.md +262 -0
- package/.torusguard/runs/run-20260910-120238-audit/summary.md +5 -0
- package/.torusguard/runs/run-20260910-121238-audit/findings.json +794 -0
- package/.torusguard/runs/run-20260910-121238-audit/findings.md +344 -0
- package/.torusguard/runs/run-20260910-121238-audit/manifest.json +12 -0
- package/.torusguard/runs/run-20260910-121238-audit/summary.md +5 -0
- package/.torusguard/runs/run-20260910-130454-audit/findings.json +893 -0
- package/.torusguard/runs/run-20260910-130454-audit/findings.md +386 -0
- package/.torusguard/runs/run-20260910-130454-audit/manifest.json +12 -0
- package/.torusguard/runs/run-20260910-130454-audit/summary.md +5 -0
- package/.torusguard/runs/run-20260910-130519-audit/findings.json +563 -0
- package/.torusguard/runs/run-20260910-130519-audit/findings.md +246 -0
- package/.torusguard/runs/run-20260910-130519-audit/manifest.json +12 -0
- package/.torusguard/runs/run-20260910-130519-audit/summary.md +5 -0
- package/.torusguard/scripts/__pycache__/audit_runner.cpython-311.pyc +0 -0
- package/.torusguard/scripts/__pycache__/diff_guard.cpython-311.pyc +0 -0
- package/.torusguard/scripts/__pycache__/html_reporter.cpython-311.pyc +0 -0
- package/.torusguard/scripts/__pycache__/rules_sync.cpython-311.pyc +0 -0
- package/.torusguard/scripts/__pycache__/stack_detect.cpython-311.pyc +0 -0
- package/.torusguard/scripts/__pycache__/term_ui.cpython-311.pyc +0 -0
- package/.torusguard/scripts/apply_runner.py +138 -100
- package/.torusguard/scripts/audit_runner.py +219 -116
- package/.torusguard/scripts/harden_runner.py +144 -64
- package/.torusguard/scripts/html_reporter.py +8 -3
- package/.torusguard/scripts/recheck_runner.py +80 -63
- package/.torusguard/scripts/recipes_runner.py +38 -31
- package/.torusguard/scripts/stack_detect.py +608 -584
- package/.torusguard/scripts/term_ui.py +162 -0
- package/.torusguard/skills/torusguard/SKILL.md +61 -31
- package/.torusguard/skills/torusguard-apply/SKILL.md +80 -46
- package/.torusguard/skills/torusguard-audit/SKILL.md +83 -70
- package/.torusguard/skills/torusguard-authorize/SKILL.md +5 -4
- package/.torusguard/skills/torusguard-exploit-check/SKILL.md +6 -5
- package/.torusguard/skills/torusguard-full/SKILL.md +1 -1
- package/.torusguard/skills/torusguard-harden/SKILL.md +94 -63
- package/.torusguard/skills/torusguard-init/SKILL.md +64 -52
- package/.torusguard/skills/torusguard-recheck/SKILL.md +77 -53
- package/.torusguard/skills/torusguard-report/SKILL.md +72 -54
- package/.torusguard/skills/torusguard-status/SKILL.md +58 -42
- package/.torusguard/skills/torusguard-verify/SKILL.md +8 -7
- package/.torusguard/skills/torusguard-web-validate/SKILL.md +8 -7
- package/README.md +4 -3
- package/bin/torusguard.js +544 -437
- package/package.json +1 -1
- package/skills/torusguard/SKILL.md +61 -31
- package/skills/torusguard/payload/scripts/apply_runner.py +138 -100
- package/skills/torusguard/payload/scripts/audit_runner.py +219 -116
- package/skills/torusguard/payload/scripts/harden_runner.py +144 -64
- package/skills/torusguard/payload/scripts/html_reporter.py +8 -3
- package/skills/torusguard/payload/scripts/recheck_runner.py +80 -63
- package/skills/torusguard/payload/scripts/recipes_runner.py +38 -31
- package/skills/torusguard/payload/scripts/stack_detect.py +608 -584
- package/skills/torusguard/payload/scripts/term_ui.py +162 -0
- package/skills/torusguard/payload/skills/torusguard/SKILL.md +61 -31
- package/skills/torusguard/payload/skills/torusguard-apply/SKILL.md +80 -46
- package/skills/torusguard/payload/skills/torusguard-audit/SKILL.md +83 -70
- package/skills/torusguard/payload/skills/torusguard-authorize/SKILL.md +5 -4
- package/skills/torusguard/payload/skills/torusguard-exploit-check/SKILL.md +6 -5
- package/skills/torusguard/payload/skills/torusguard-full/SKILL.md +1 -1
- package/skills/torusguard/payload/skills/torusguard-harden/SKILL.md +94 -63
- package/skills/torusguard/payload/skills/torusguard-init/SKILL.md +64 -52
- package/skills/torusguard/payload/skills/torusguard-recheck/SKILL.md +77 -53
- package/skills/torusguard/payload/skills/torusguard-report/SKILL.md +72 -54
- package/skills/torusguard/payload/skills/torusguard-status/SKILL.md +58 -42
- package/skills/torusguard/payload/skills/torusguard-verify/SKILL.md +8 -7
- package/skills/torusguard/payload/skills/torusguard-web-validate/SKILL.md +8 -7
- package/skills/torusguard-apply/SKILL.md +80 -46
- package/skills/torusguard-audit/SKILL.md +83 -70
- package/skills/torusguard-authorize/SKILL.md +5 -4
- package/skills/torusguard-exploit-check/SKILL.md +6 -5
- package/skills/torusguard-full/SKILL.md +1 -1
- package/skills/torusguard-harden/SKILL.md +94 -63
- package/skills/torusguard-init/SKILL.md +64 -52
- package/skills/torusguard-recheck/SKILL.md +77 -53
- package/skills/torusguard-report/SKILL.md +72 -54
- package/skills/torusguard-status/SKILL.md +58 -42
- package/skills/torusguard-verify/SKILL.md +8 -7
- package/skills/torusguard-web-validate/SKILL.md +8 -7
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
"""
|
|
3
|
-
TorusGuard Golden Fix Recipe Explorer (v1.3.
|
|
3
|
+
TorusGuard Golden Fix Recipe Explorer (v1.3.3)
|
|
4
4
|
Inspect, list, and export reusable, verified AST remediation code snippets
|
|
5
5
|
distilled from passing security patches and persistent memory patterns.
|
|
6
|
+
Standardized 75-column terminal UI formatting.
|
|
6
7
|
|
|
7
8
|
Pure Python 3.10+ standard library (zero external dependencies).
|
|
8
9
|
"""
|
|
@@ -10,11 +11,19 @@ Pure Python 3.10+ standard library (zero external dependencies).
|
|
|
10
11
|
import sys
|
|
11
12
|
import json
|
|
12
13
|
import argparse
|
|
13
|
-
import unicodedata
|
|
14
|
-
import re
|
|
15
14
|
from pathlib import Path
|
|
16
15
|
from typing import Dict, List, Any, Optional
|
|
17
16
|
|
|
17
|
+
# Ensure scripts dir is in sys.path for term_ui import
|
|
18
|
+
scripts_dir = Path(__file__).resolve().parent
|
|
19
|
+
if str(scripts_dir) not in sys.path:
|
|
20
|
+
sys.path.insert(0, str(scripts_dir))
|
|
21
|
+
|
|
22
|
+
try:
|
|
23
|
+
import term_ui
|
|
24
|
+
except ImportError:
|
|
25
|
+
term_ui = None
|
|
26
|
+
|
|
18
27
|
# Windows console UTF-8 support
|
|
19
28
|
if sys.stdout and hasattr(sys.stdout, "reconfigure"):
|
|
20
29
|
try:
|
|
@@ -22,7 +31,7 @@ if sys.stdout and hasattr(sys.stdout, "reconfigure"):
|
|
|
22
31
|
except Exception:
|
|
23
32
|
pass
|
|
24
33
|
|
|
25
|
-
# ───
|
|
34
|
+
# ─── Formatting Helpers ────────────────────────────────────────────────────────
|
|
26
35
|
BOLD = "\033[1m"
|
|
27
36
|
DIM = "\033[2m"
|
|
28
37
|
RESET = "\033[0m"
|
|
@@ -33,25 +42,25 @@ WHITE = "\033[97m"
|
|
|
33
42
|
GRAY = "\033[90m"
|
|
34
43
|
RED = "\033[31m"
|
|
35
44
|
|
|
36
|
-
|
|
45
|
+
def box_line(content: str, width: int = 67, border: str = "│", border_color: str = CYAN) -> str:
|
|
46
|
+
if term_ui:
|
|
47
|
+
return term_ui.format_box_line(content, width=width, border=border, border_color=border_color)
|
|
48
|
+
return f" {border_color}{border}{RESET} {content}"
|
|
49
|
+
|
|
50
|
+
def box_header(title: str, subtitle: str = "", version: str = "v1.3.3", border_color: str = CYAN) -> str:
|
|
51
|
+
if term_ui:
|
|
52
|
+
return term_ui.card_header(title, subtitle, version, border_color)
|
|
53
|
+
return f"=== {title} ({version}) ==="
|
|
37
54
|
|
|
38
|
-
def
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
ea = unicodedata.east_asian_width(ch)
|
|
43
|
-
if ea in ('W', 'F'):
|
|
44
|
-
width += 2
|
|
45
|
-
elif ord(ch) >= 0x1F300:
|
|
46
|
-
width += 2
|
|
47
|
-
else:
|
|
48
|
-
width += 1
|
|
49
|
-
return width
|
|
55
|
+
def border_top(title: str = "", border_color: str = CYAN, double: bool = False) -> str:
|
|
56
|
+
if term_ui:
|
|
57
|
+
return term_ui.card_border_top(title, border_color=border_color, double=double)
|
|
58
|
+
return "┌" + "─" * 71 + "┐"
|
|
50
59
|
|
|
51
|
-
def
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return
|
|
60
|
+
def border_bottom(border_color: str = CYAN, double: bool = False) -> str:
|
|
61
|
+
if term_ui:
|
|
62
|
+
return term_ui.card_border_bottom(border_color=border_color, double=double)
|
|
63
|
+
return "└" + "─" * 71 + "┘"
|
|
55
64
|
|
|
56
65
|
|
|
57
66
|
def list_recipes(target_root: Path, detail_id: Optional[str] = None, json_output: bool = False) -> None:
|
|
@@ -70,19 +79,16 @@ def list_recipes(target_root: Path, detail_id: Optional[str] = None, json_output
|
|
|
70
79
|
return
|
|
71
80
|
|
|
72
81
|
# Header Card
|
|
73
|
-
print(
|
|
74
|
-
print(
|
|
75
|
-
print(
|
|
76
|
-
print(format_box_line(f"{DIM}Distilled Ponytail Fixes (<= 35 add, <= 25 del) in Persistent Memory{RESET}", border_color=CYAN))
|
|
77
|
-
print(f" {CYAN}│ │{RESET}")
|
|
78
|
-
print(f" {CYAN}╰─────────────────────────────────────────────────────────────────────────╯{RESET}\n")
|
|
82
|
+
print()
|
|
83
|
+
print(box_header("🛡️ TORUSGUARD GOLDEN FIX RECIPES", "Distilled Ponytail Fixes (<= 35 add, <= 25 del) in Persistent Memory", "v1.3.3"))
|
|
84
|
+
print()
|
|
79
85
|
|
|
80
86
|
if not recipes:
|
|
81
87
|
print(f" {YELLOW}ℹ No golden fix recipes captured yet.{RESET}")
|
|
82
88
|
print(f" Run {CYAN}npx torusguard harden{RESET} followed by {CYAN}npx torusguard apply{RESET} to distill verified recipes.\n")
|
|
83
89
|
return
|
|
84
90
|
|
|
85
|
-
print(f"
|
|
91
|
+
print(border_top(f"Active Distilled Recipes ({len(recipes)})"))
|
|
86
92
|
for idx, r in enumerate(recipes, 1):
|
|
87
93
|
rule_id = r.get("rule_id", "TG-SEC")
|
|
88
94
|
rec_id = r.get("recipe_id", f"recipe-{idx}")
|
|
@@ -93,9 +99,10 @@ def list_recipes(target_root: Path, detail_id: Optional[str] = None, json_output
|
|
|
93
99
|
adds = metrics.get("additions", 0)
|
|
94
100
|
dels = metrics.get("deletions", 0)
|
|
95
101
|
|
|
96
|
-
print(
|
|
97
|
-
print(
|
|
98
|
-
print(
|
|
102
|
+
print(box_line(f"{GREEN}[{rule_id}]{RESET} {WHITE}{rec_id}{RESET} (Verified {verified}x · +{adds}/-{dels} Ponytail)"))
|
|
103
|
+
print(box_line(f" └─ {DIM}{desc}{RESET}"))
|
|
104
|
+
print(border_bottom())
|
|
105
|
+
print()
|
|
99
106
|
|
|
100
107
|
if detail_id:
|
|
101
108
|
target_rec = next((r for r in recipes if r.get("recipe_id") == detail_id), None)
|