torusguard 1.3.6 → 1.4.0

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 (81) hide show
  1. package/.torusguard/.manifest.json +9 -8
  2. package/.torusguard/runs/report-latest.html +3529 -364
  3. package/.torusguard/runs/run-20260918-105940-audit/manifest.json +2 -1
  4. package/.torusguard/runs/run-20260918-105940-audit/remediation.md +7 -0
  5. package/.torusguard/runs/run-20260919-145701-audit/findings.json +1 -0
  6. package/.torusguard/runs/run-20260919-145701-audit/findings.md +8 -0
  7. package/.torusguard/runs/run-20260919-145701-audit/manifest.json +12 -0
  8. package/.torusguard/runs/run-20260919-145701-audit/summary.md +5 -0
  9. package/.torusguard/runs/run-20260919-151729-audit/findings.json +1 -0
  10. package/.torusguard/runs/run-20260919-151729-audit/findings.md +8 -0
  11. package/.torusguard/runs/run-20260919-151729-audit/manifest.json +13 -0
  12. package/.torusguard/runs/run-20260919-151729-audit/remediation.md +7 -0
  13. package/.torusguard/runs/run-20260919-151729-audit/summary.md +5 -0
  14. package/.torusguard/runs/run-20260919-152340-audit/findings.json +1 -0
  15. package/.torusguard/runs/run-20260919-152340-audit/findings.md +8 -0
  16. package/.torusguard/runs/run-20260919-152340-audit/manifest.json +12 -0
  17. package/.torusguard/runs/run-20260919-152340-audit/summary.md +5 -0
  18. package/.torusguard/runs/run-20260919-152345-audit/findings.json +1 -0
  19. package/.torusguard/runs/run-20260919-152345-audit/findings.md +8 -0
  20. package/.torusguard/runs/run-20260919-152345-audit/manifest.json +12 -0
  21. package/.torusguard/runs/run-20260919-152345-audit/summary.md +5 -0
  22. package/.torusguard/runs/run-20260919-153500-audit/findings.json +1 -0
  23. package/.torusguard/runs/run-20260919-153500-audit/findings.md +8 -0
  24. package/.torusguard/runs/run-20260919-153500-audit/manifest.json +12 -0
  25. package/.torusguard/runs/run-20260919-153500-audit/summary.md +5 -0
  26. package/.torusguard/scripts/__pycache__/apply_runner.cpython-314.pyc +0 -0
  27. package/.torusguard/scripts/__pycache__/audit_runner.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__/recipes_runner.cpython-314.pyc +0 -0
  32. package/.torusguard/scripts/__pycache__/report_sync.cpython-314.pyc +0 -0
  33. package/.torusguard/scripts/apply_runner.py +101 -8
  34. package/.torusguard/scripts/audit_runner.py +116 -11
  35. package/.torusguard/scripts/harden_runner.py +122 -68
  36. package/.torusguard/scripts/html_reporter.py +1170 -253
  37. package/.torusguard/scripts/manifest_builder.py +2 -0
  38. package/.torusguard/scripts/recheck_runner.py +2 -1
  39. package/.torusguard/scripts/recipes_runner.py +91 -8
  40. package/.torusguard/scripts/report_sync.py +134 -7
  41. package/.torusguard/scripts/status_runner.py +267 -0
  42. package/README.md +108 -80
  43. package/bin/torusguard.js +190 -20
  44. package/package.json +6 -2
  45. package/skills/torusguard/__pycache__/bootstrap.cpython-314.pyc +0 -0
  46. package/skills/torusguard/bootstrap.py +45 -6
  47. package/skills/torusguard/payload/.manifest.json +29 -14
  48. package/skills/torusguard/payload/scripts/__pycache__/audit_runner.cpython-314.pyc +0 -0
  49. package/skills/torusguard/payload/scripts/__pycache__/html_reporter.cpython-314.pyc +0 -0
  50. package/skills/torusguard/payload/scripts/__pycache__/report_sync.cpython-314.pyc +0 -0
  51. package/skills/torusguard/payload/scripts/__pycache__/sarif_exporter.cpython-314.pyc +0 -0
  52. package/skills/torusguard/payload/scripts/__pycache__/term_ui.cpython-314.pyc +0 -0
  53. package/skills/torusguard/payload/scripts/apply_runner.py +101 -8
  54. package/skills/torusguard/payload/scripts/audit_runner.py +116 -11
  55. package/skills/torusguard/payload/scripts/harden_runner.py +122 -68
  56. package/skills/torusguard/payload/scripts/html_reporter.py +1170 -253
  57. package/skills/torusguard/payload/scripts/manifest_builder.py +2 -0
  58. package/skills/torusguard/payload/scripts/recheck_runner.py +2 -1
  59. package/skills/torusguard/payload/scripts/recipes_runner.py +91 -8
  60. package/skills/torusguard/payload/scripts/report_sync.py +134 -7
  61. package/skills/torusguard/payload/scripts/status_runner.py +267 -0
  62. package/skills/torusguard/payload/workflows/apply.md +9 -1
  63. package/skills/torusguard/payload/workflows/audit.md +8 -2
  64. package/skills/torusguard/payload/workflows/harden.md +6 -1
  65. package/skills/torusguard/payload/workflows/init.md +7 -1
  66. package/skills/torusguard/payload/workflows/recipes.md +55 -0
  67. package/skills/torusguard/payload/workflows/report.md +59 -55
  68. package/skills/torusguard/payload/workflows/status.md +4 -1
  69. package/skills/torusguard/payload/workflows/torusguard-apply.md +110 -0
  70. package/skills/torusguard/payload/workflows/torusguard-audit.md +105 -0
  71. package/skills/torusguard/payload/workflows/torusguard-authorize.md +96 -0
  72. package/skills/torusguard/payload/workflows/torusguard-exploit-check.md +98 -0
  73. package/skills/torusguard/payload/workflows/torusguard-harden.md +104 -0
  74. package/skills/torusguard/payload/workflows/torusguard-init.md +106 -0
  75. package/skills/torusguard/payload/workflows/torusguard-recheck.md +101 -0
  76. package/skills/torusguard/payload/workflows/torusguard-recipes.md +55 -0
  77. package/skills/torusguard/payload/workflows/torusguard-report.md +105 -0
  78. package/skills/torusguard/payload/workflows/torusguard-status.md +103 -0
  79. package/skills/torusguard/payload/workflows/torusguard-verify.md +100 -0
  80. package/skills/torusguard/payload/workflows/torusguard-web-validate.md +96 -0
  81. package/skills/torusguard/payload/workflows/torusguard.md +19 -0
@@ -0,0 +1,100 @@
1
+ ---
2
+ description: Evidence sufficiency verification, live disk line match audit, and finding score refinement.
3
+ tools: Read, Grep, Glob, Bash, Write
4
+ version: 1.3.6
5
+ agent: validator
6
+ lifecycle-phase: Phase 3a (Evidence Verification)
7
+ required-skills:
8
+ - torusguard-verify
9
+ scripts-binding:
10
+ - .torusguard/scripts/report_sync.py
11
+ - .torusguard/scripts/finding_scorer.py
12
+ ---
13
+
14
+ # /torusguard verify — Evidence Verification & Score Refinement
15
+
16
+ $ARGUMENTS
17
+
18
+ ---
19
+
20
+ ## Objective
21
+ Evidence sufficiency verification, live disk line match audit, and finding score refinement.
22
+
23
+ ---
24
+
25
+ ## Mandatory Pre-Flight Context Inspection
26
+
27
+ Inspect finding records and evidence integrity before verification:
28
+ 1. **Latest Run Records (`.torusguard/runs/`):** Locate most recent audit run directory.
29
+ 2. **Finding Files:** Confirm `findings.md` or `findings.json` exists in the target run folder.
30
+ 3. **Live File Drift:** Assert cited source files have not been edited or relocated on disk.
31
+ 4. **Scoring Model Calibration:** Ensure `finding_scorer.py` evaluates all 5 rubric dimensions.
32
+ 5. **Role Boundary:** Enforce validator role; do not apply code modifications during verification.
33
+
34
+ ---
35
+
36
+ ## When to Use /torusguard verify
37
+
38
+ | Trigger Scenario | Recommended Action |
39
+ | :--- | :--- |
40
+ | Auditing whether static findings are valid code flaws | Run `/torusguard verify` |
41
+ | Upgrading Medium confidence finding to Confirmed | Run `/torusguard verify` |
42
+ | No audit run executed yet | Run `/torusguard audit` first |
43
+ | Running live network requests against endpoints | Run `/torusguard web-validate` |
44
+ | Generating patch after verification | Run `/torusguard harden` |
45
+
46
+ ---
47
+
48
+ ## Living Report Invariant
49
+ - Confirmed evidence sufficiency transitions findings in `security_report.md` to `VERIFIED 🟠`.
50
+ - False positives transition to `FALSE POSITIVE ⚪`.
51
+
52
+ ## Execution Steps
53
+
54
+ 1. **Locate Target Findings:** Load active findings from latest run directory.
55
+ 2. **Live Disk Line Match:** Read current code at cited line ranges; verify AST snippet matches.
56
+ 3. **Audit Evidence Sufficiency:** Assess whether taint path is unbroken and caller context is exposed.
57
+ 4. **Refine Confidence Scores:**
58
+ ```bash
59
+ python .torusguard/scripts/finding_scorer.py --run <run_dir> --verify
60
+ ```
61
+ 5. **Classify Status:** Assign verified state (`Confirmed`, `Plausible`, or `False Positive / Disputed`).
62
+ 6. **Emit Verification Ledger:** Write `verified-evidence.md` into the active run folder.
63
+
64
+ ---
65
+
66
+ ## Failure Recovery
67
+
68
+ - **Missing Run Folder:** Run `/torusguard audit` first to produce a valid run baseline.
69
+ - **Line Drift Detected:** Flag line mismatch; scan nearby lines (±25) for relocated AST sink.
70
+ - **Malformed Finding JSON:** Repair JSON structure using finding schema before scoring.
71
+ - **Halt Trigger:** Abort if cited files are completely deleted from disk.
72
+
73
+ ---
74
+
75
+ ## Hallucination Guard
76
+
77
+ - ❌ Never confirm a finding if the cited sink has already been sanitized by middleware.
78
+ - ❌ Never bump confidence score without documenting unbroken taint source-to-sink flow.
79
+ - ✅ Always anchor line matches to live disk reads using `view_file`.
80
+
81
+ ---
82
+
83
+ ## Output Card Format
84
+
85
+ ```markdown
86
+ ### 🧪 TorusGuard Evidence Verification
87
+ - **Run ID:** `run-YYYYMMDD-HHMMSS-audit`
88
+ - **Findings Evaluated:** [Count] findings
89
+ - **Confirmed Real:** [Count] verified flaws
90
+ - **Downgraded / False Positives:** [Count] filtered out
91
+ - **Refined Mean Score:** [Score]/100
92
+ - **Ledger:** `.torusguard/runs/<run_id>/verified-evidence.md`
93
+ ```
94
+
95
+ ---
96
+
97
+ ## Next Steps
98
+
99
+ 1. Run `/torusguard web-validate` if live endpoint probing is required.
100
+ 2. Run `/torusguard harden` to build surgical patch bundles for verified flaws.
@@ -0,0 +1,96 @@
1
+ ---
2
+ description: Authorized HTTP probing, token redaction, transparent audit header injection, and replay trace capture.
3
+ tools: Read, Grep, Glob, Bash, Write
4
+ version: 1.3.6
5
+ agent: validator
6
+ lifecycle-phase: Phase 3b (Runtime Web Validation)
7
+ required-skills:
8
+ - torusguard-web-validate
9
+ scripts-binding:
10
+ - .torusguard/scripts/report_sync.py
11
+ - .torusguard/scripts/safety_gate.py
12
+ ---
13
+
14
+ # /torusguard web-validate — Bounded HTTP Probing & Session Capture
15
+
16
+ $ARGUMENTS
17
+
18
+ ---
19
+
20
+ ## Objective
21
+ Authorized HTTP probing, token redaction, transparent audit header injection, and replay capture.
22
+
23
+ ---
24
+
25
+ ## Mandatory Pre-Flight Context Inspection
26
+
27
+ Inspect authorization parameters and safety limits before sending HTTP requests:
28
+ 1. **Active Scope (`.torusguard/config/scope.json`):** Assert target host and path are authorized with valid TTL.
29
+ 2. **Safety Gate Classification:** Test proposed endpoint against `.torusguard/scripts/safety_gate.py`.
30
+ 3. **Sensitive Route Guard:** Ensure destructive endpoints (`DELETE`, account drops) are never called automatically.
31
+ 4. **Token Redaction Pipeline:** Ensure bearer tokens and session cookies are masked (`Bearer [REDACTED]`).
32
+ 5. **Request Budget:** Enforce maximum cap of 50 requests per validation session.
33
+
34
+ ---
35
+
36
+ ## When to Use /torusguard web-validate
37
+
38
+ | Trigger Scenario | Recommended Action |
39
+ | :--- | :--- |
40
+ | Testing live route accessibility and security headers | Run `/torusguard web-validate` |
41
+ | Verifying cookie security flags (`HttpOnly`, `Secure`, `SameSite`) | Run `/torusguard web-validate` |
42
+ | Checking CORS headers and authentication barriers | Run `/torusguard web-validate` |
43
+ | Pure static source code analysis | Run `/torusguard audit` |
44
+ | Confirming exploitable attack vectors | Run `/torusguard exploit-check` |
45
+
46
+ ---
47
+
48
+ ## Execution Steps
49
+
50
+ 1. **Verify Legal Scope:** Check target URL against `.torusguard/config/scope.json`.
51
+ 2. **Invoke Safety Gate:**
52
+ ```bash
53
+ python .torusguard/scripts/safety_gate.py check --url <target_url> --method GET
54
+ ```
55
+ 3. **Dispatch Non-Destructive Probe:** Send bounded HTTP request with audit header `X-TorusGuard-AuthID`.
56
+ 4. **Redact Sensitive Headers:** Sanitize auth tokens and credentials in request and response objects.
57
+ 5. **Write Replay Artifacts:**
58
+ Record sanitized trace in `.torusguard/runs/<run_id>/requests.json` and emit `web-validation.md`.
59
+
60
+ ---
61
+
62
+ ## Failure Recovery
63
+
64
+ - **Target Offline:** Verify local dev server is active and accessible on designated host port.
65
+ - **Safety Gate Rejection (Manual Only):** Halt probe immediately; report endpoint requires human manual test.
66
+ - **Rate Limit / 429:** Back off exponentially (1s, 2s, 4s); stop session if 429 persists.
67
+ - **Halt Trigger:** Abort if target domain deviates from authorized allowlist in `scope.json`.
68
+
69
+ ---
70
+
71
+ ## Hallucination Guard
72
+
73
+ - ❌ Never dispatch HTTP requests outside domains explicitly listed in `.torusguard/config/scope.json`.
74
+ - ❌ Never write raw Authorization headers or plaintext secrets to disk.
75
+ - ✅ Always include transparent audit headers (`X-TorusGuard-AuthID`).
76
+
77
+ ---
78
+
79
+ ## Output Card Format
80
+
81
+ ```markdown
82
+ ### 🌐 TorusGuard Web Validation
83
+ - **Target Host:** [Host URL]
84
+ - **Endpoints Probed:** [Count] routes tested
85
+ - **Security Headers:** [CSP / HSTS / CORS status]
86
+ - **Cookie Security:** [HttpOnly / Secure / SameSite status]
87
+ - **Replay Trace:** `.torusguard/runs/<run_id>/replay.json`
88
+ - **Status:** COMPLETED — non-destructive probe finished
89
+ ```
90
+
91
+ ---
92
+
93
+ ## Next Steps
94
+
95
+ 1. Run `/torusguard exploit-check` to confirm if reachable flaws constitute verified exploits.
96
+ 2. Run `/torusguard harden` to build surgical remediation diffs.
@@ -0,0 +1,19 @@
1
+ ---
2
+ description: TorusGuard Autonomous Security Command Engine — run static security audits, authorized runtime web validation, governed remediation, and SARIF exports.
3
+ version: 1.3.6
4
+ tools: Read, Grep, Glob, Bash, Edit, Write
5
+ agent: auditor
6
+ ---
7
+
8
+ # /torusguard — Autonomous Application Security Guardrails
9
+
10
+ $ARGUMENTS
11
+
12
+ ## Objective
13
+ Execute TorusGuard security workflows across polyglot codebases (Python, TypeScript, Go, Rust, Java, C#, PHP, and 16+ ecosystems) using either AI chat slash commands or dedicated terminal CLI commands.
14
+
15
+ ## Execution
16
+ Parse the requested action from `$ARGUMENTS` (e.g. `audit`, `verify`, `web-validate`, `exploit-check`, `harden`, `apply`, `rollback`, `recheck`, `recipes`, `report`, `status`, `init`):
17
+ 1. **If action is omitted or 'status':** View `.torusguard/workflows/status.md` and report posture (or run `npx torusguard status`).
18
+ 2. **If action is specified:** Load the dedicated workflow from `.torusguard/workflows/<action>.md` and matching skill from `skills/torusguard-<action>/SKILL.md` (or run equivalent CLI command: `npx torusguard <action>`).
19
+ 3. Follow the phase execution steps defined in the workflow.