torusguard 1.3.6 → 2.0.0-alpha

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 (110) hide show
  1. package/.torusguard/.manifest.json +9 -8
  2. package/.torusguard/auth.json +5 -0
  3. package/.torusguard/rules_catalog.json +242 -518
  4. package/.torusguard/runs/report-latest.html +3529 -364
  5. package/.torusguard/runs/run-20260918-105940-audit/manifest.json +2 -1
  6. package/.torusguard/runs/run-20260918-105940-audit/remediation.md +7 -0
  7. package/.torusguard/runs/run-20260919-145701-audit/findings.json +1 -0
  8. package/.torusguard/runs/run-20260919-145701-audit/findings.md +8 -0
  9. package/.torusguard/runs/run-20260919-145701-audit/manifest.json +12 -0
  10. package/.torusguard/runs/run-20260919-145701-audit/summary.md +5 -0
  11. package/.torusguard/runs/run-20260919-151729-audit/findings.json +1 -0
  12. package/.torusguard/runs/run-20260919-151729-audit/findings.md +8 -0
  13. package/.torusguard/runs/run-20260919-151729-audit/manifest.json +13 -0
  14. package/.torusguard/runs/run-20260919-151729-audit/remediation.md +7 -0
  15. package/.torusguard/runs/run-20260919-151729-audit/summary.md +5 -0
  16. package/.torusguard/runs/run-20260919-152340-audit/findings.json +1 -0
  17. package/.torusguard/runs/run-20260919-152340-audit/findings.md +8 -0
  18. package/.torusguard/runs/run-20260919-152340-audit/manifest.json +12 -0
  19. package/.torusguard/runs/run-20260919-152340-audit/summary.md +5 -0
  20. package/.torusguard/runs/run-20260919-152345-audit/findings.json +1 -0
  21. package/.torusguard/runs/run-20260919-152345-audit/findings.md +8 -0
  22. package/.torusguard/runs/run-20260919-152345-audit/manifest.json +12 -0
  23. package/.torusguard/runs/run-20260919-152345-audit/summary.md +5 -0
  24. package/.torusguard/runs/run-20260919-153500-audit/findings.json +1 -0
  25. package/.torusguard/runs/run-20260919-153500-audit/findings.md +8 -0
  26. package/.torusguard/runs/run-20260919-153500-audit/manifest.json +12 -0
  27. package/.torusguard/runs/run-20260919-153500-audit/summary.md +5 -0
  28. package/.torusguard/scripts/__pycache__/apply_runner.cpython-314.pyc +0 -0
  29. package/.torusguard/scripts/__pycache__/audit_runner.cpython-314.pyc +0 -0
  30. package/.torusguard/scripts/__pycache__/harden_runner.cpython-314.pyc +0 -0
  31. package/.torusguard/scripts/__pycache__/html_reporter.cpython-314.pyc +0 -0
  32. package/.torusguard/scripts/__pycache__/manifest_builder.cpython-314.pyc +0 -0
  33. package/.torusguard/scripts/__pycache__/recipes_runner.cpython-314.pyc +0 -0
  34. package/.torusguard/scripts/__pycache__/report_sync.cpython-314.pyc +0 -0
  35. package/.torusguard/scripts/apply_runner.py +101 -8
  36. package/.torusguard/scripts/audit_runner.py +116 -11
  37. package/.torusguard/scripts/harden_runner.py +122 -68
  38. package/.torusguard/scripts/html_reporter.py +1170 -253
  39. package/.torusguard/scripts/manifest_builder.py +2 -0
  40. package/.torusguard/scripts/recheck_runner.py +2 -1
  41. package/.torusguard/scripts/recipes_runner.py +91 -8
  42. package/.torusguard/scripts/report_sync.py +134 -7
  43. package/.torusguard/scripts/status_runner.py +267 -0
  44. package/.torusguard/snapshots/20260921-182638/go.mod.bak +11 -0
  45. package/.torusguard/snapshots/20260921-185213/file.go.bak +5 -0
  46. package/README.md +314 -364
  47. package/bin/torusguard.js +190 -20
  48. package/package.json +6 -2
  49. package/skills/torusguard/__pycache__/bootstrap.cpython-314.pyc +0 -0
  50. package/skills/torusguard/bootstrap.py +45 -6
  51. package/skills/torusguard/payload/.manifest.json +29 -14
  52. package/skills/torusguard/payload/TORUSGUARD.md +145 -145
  53. package/skills/torusguard/payload/agents/auditor.md +41 -41
  54. package/skills/torusguard/payload/agents/profiler.md +49 -49
  55. package/skills/torusguard/payload/agents/remediator.md +41 -41
  56. package/skills/torusguard/payload/agents/reviewer.md +39 -39
  57. package/skills/torusguard/payload/agents/validator.md +46 -46
  58. package/skills/torusguard/payload/config/scope.json +24 -24
  59. package/skills/torusguard/payload/references/csharp-security.md +41 -41
  60. package/skills/torusguard/payload/references/go-security.md +41 -41
  61. package/skills/torusguard/payload/references/java-security.md +40 -40
  62. package/skills/torusguard/payload/references/polyglot-security-matrix.md +25 -25
  63. package/skills/torusguard/payload/references/rust-security.md +40 -40
  64. package/skills/torusguard/payload/rules/custom/.gitkeep +1 -1
  65. package/skills/torusguard/payload/rules/custom/README.md +30 -30
  66. package/skills/torusguard/payload/scripts/__pycache__/audit_runner.cpython-314.pyc +0 -0
  67. package/skills/torusguard/payload/scripts/__pycache__/html_reporter.cpython-314.pyc +0 -0
  68. package/skills/torusguard/payload/scripts/__pycache__/report_sync.cpython-314.pyc +0 -0
  69. package/skills/torusguard/payload/scripts/__pycache__/sarif_exporter.cpython-314.pyc +0 -0
  70. package/skills/torusguard/payload/scripts/__pycache__/term_ui.cpython-314.pyc +0 -0
  71. package/skills/torusguard/payload/scripts/apply_runner.py +101 -8
  72. package/skills/torusguard/payload/scripts/audit_runner.py +116 -11
  73. package/skills/torusguard/payload/scripts/harden_runner.py +122 -68
  74. package/skills/torusguard/payload/scripts/html_reporter.py +1170 -253
  75. package/skills/torusguard/payload/scripts/manifest_builder.py +2 -0
  76. package/skills/torusguard/payload/scripts/recheck_runner.py +2 -1
  77. package/skills/torusguard/payload/scripts/recipes_runner.py +91 -8
  78. package/skills/torusguard/payload/scripts/report_sync.py +134 -7
  79. package/skills/torusguard/payload/scripts/rules_sync.py +321 -321
  80. package/skills/torusguard/payload/scripts/safety_gate.py +64 -64
  81. package/skills/torusguard/payload/scripts/status_runner.py +267 -0
  82. package/skills/torusguard/payload/skills/torusguard/references/csharp-security.md +41 -41
  83. package/skills/torusguard/payload/skills/torusguard/references/go-security.md +41 -41
  84. package/skills/torusguard/payload/skills/torusguard/references/java-security.md +40 -40
  85. package/skills/torusguard/payload/skills/torusguard/references/polyglot-security-matrix.md +25 -25
  86. package/skills/torusguard/payload/skills/torusguard/references/rust-security.md +40 -40
  87. package/skills/torusguard/payload/templates/audit-report.template.md +54 -54
  88. package/skills/torusguard/payload/templates/authorization.template.md +34 -34
  89. package/skills/torusguard/payload/templates/finding-card.template.md +32 -32
  90. package/skills/torusguard/payload/templates/remediation-bundle.template.md +35 -35
  91. package/skills/torusguard/payload/workflows/apply.md +9 -1
  92. package/skills/torusguard/payload/workflows/audit.md +8 -2
  93. package/skills/torusguard/payload/workflows/harden.md +6 -1
  94. package/skills/torusguard/payload/workflows/init.md +7 -1
  95. package/skills/torusguard/payload/workflows/recipes.md +55 -0
  96. package/skills/torusguard/payload/workflows/report.md +59 -55
  97. package/skills/torusguard/payload/workflows/status.md +4 -1
  98. package/skills/torusguard/payload/workflows/torusguard-apply.md +110 -0
  99. package/skills/torusguard/payload/workflows/torusguard-audit.md +105 -0
  100. package/skills/torusguard/payload/workflows/torusguard-authorize.md +96 -0
  101. package/skills/torusguard/payload/workflows/torusguard-exploit-check.md +98 -0
  102. package/skills/torusguard/payload/workflows/torusguard-harden.md +104 -0
  103. package/skills/torusguard/payload/workflows/torusguard-init.md +106 -0
  104. package/skills/torusguard/payload/workflows/torusguard-recheck.md +101 -0
  105. package/skills/torusguard/payload/workflows/torusguard-recipes.md +55 -0
  106. package/skills/torusguard/payload/workflows/torusguard-report.md +105 -0
  107. package/skills/torusguard/payload/workflows/torusguard-status.md +103 -0
  108. package/skills/torusguard/payload/workflows/torusguard-verify.md +100 -0
  109. package/skills/torusguard/payload/workflows/torusguard-web-validate.md +96 -0
  110. package/skills/torusguard/payload/workflows/torusguard.md +19 -0
@@ -1,25 +1,25 @@
1
- # TorusGuard Universal Polyglot Security Matrix
2
-
3
- > **Loaded When:** Any language or framework is detected. Maps universal security invariants across major programming language ecosystems.
4
-
5
- ---
6
-
7
- ## 🛡️ Cross-Language Invariant Mappings
8
-
9
- | Rule Family | Python | TypeScript / Node.js | Go | Rust | Java / Kotlin | C# / .NET |
10
- |---|---|---|---|---|---|---|
11
- | **TG-SEC (Secrets)** | `os.environ["KEY"]` | `process.env.KEY` | `os.Getenv("KEY")` | `std::env::var("KEY")` | `System.getenv("KEY")` | `Environment.GetEnvironmentVariable()` |
12
- | **TG-DB (SQL Injection)** | `%s` / ORM bound | `$1` / Prisma / Drizzle | `?` / `$1` / GORM `?` | `sqlx::query!` / Diesel | Named parameters `:param` | `@p0` / `FromSqlInterpolated` |
13
- | **TG-DB-004 (Tenant Scope)** | `.filter(tenant=...)` | `where: { tenantId }` | `.Where("tenant_id = ?", tid)` | `filter(tenant_id.eq(tid))` | `WHERE e.tenantId = :tid` | `.Where(x => x.TenantId == tid)` |
14
- | **TG-AUTH (Access Control)** | `@login_required` / Depends | Middleware auth / Guards | Middleware handlers | Tower layer / extractors | `@PreAuthorize` / Spring Sec | `[Authorize]` attributes |
15
- | **TG-CSRF (Request Forgery)** | CSRF Middleware | SameSite / csurf | Gorilla CSRF | Anti-CSRF token middleware | Spring Security CSRF | `[ValidateAntiForgeryToken]` |
16
- | **TG-DIFF (Bypass Comments)** | No `# nosec` | No `// nosec` | No `/* nosec */` | No `#![allow(unsafe)]` | No `@SuppressWarnings` | No pragma disable |
17
- | **TG-DIFF (TLS Verification)** | No `verify=False` | No `rejectUnauthorized:false` | No `InsecureSkipVerify: true` | No `danger_accept_invalid_certs`| No `TrustAllStrategy` | No `DangerousAcceptAny...` |
18
-
19
- ---
20
-
21
- ## 🚀 Polyglot Hardening Rules of Thumb
22
-
23
- 1. **Parameterize Everything:** Never concatenate raw user input into SQL, shell commands, LDAP filters, or template strings, regardless of language.
24
- 2. **Fail Closed on Auth:** Default all endpoints to authenticated; explicitly mark public routes rather than remembering to protect private ones.
25
- 3. **Strict Bounds:** Keep remediation diffs minimal ($\le 35$ additions, $\le 25$ deletions) to ensure auditability across all codebases.
1
+ # TorusGuard Universal Polyglot Security Matrix
2
+
3
+ > **Loaded When:** Any language or framework is detected. Maps universal security invariants across major programming language ecosystems.
4
+
5
+ ---
6
+
7
+ ## 🛡️ Cross-Language Invariant Mappings
8
+
9
+ | Rule Family | Python | TypeScript / Node.js | Go | Rust | Java / Kotlin | C# / .NET |
10
+ |---|---|---|---|---|---|---|
11
+ | **TG-SEC (Secrets)** | `os.environ["KEY"]` | `process.env.KEY` | `os.Getenv("KEY")` | `std::env::var("KEY")` | `System.getenv("KEY")` | `Environment.GetEnvironmentVariable()` |
12
+ | **TG-DB (SQL Injection)** | `%s` / ORM bound | `$1` / Prisma / Drizzle | `?` / `$1` / GORM `?` | `sqlx::query!` / Diesel | Named parameters `:param` | `@p0` / `FromSqlInterpolated` |
13
+ | **TG-DB-004 (Tenant Scope)** | `.filter(tenant=...)` | `where: { tenantId }` | `.Where("tenant_id = ?", tid)` | `filter(tenant_id.eq(tid))` | `WHERE e.tenantId = :tid` | `.Where(x => x.TenantId == tid)` |
14
+ | **TG-AUTH (Access Control)** | `@login_required` / Depends | Middleware auth / Guards | Middleware handlers | Tower layer / extractors | `@PreAuthorize` / Spring Sec | `[Authorize]` attributes |
15
+ | **TG-CSRF (Request Forgery)** | CSRF Middleware | SameSite / csurf | Gorilla CSRF | Anti-CSRF token middleware | Spring Security CSRF | `[ValidateAntiForgeryToken]` |
16
+ | **TG-DIFF (Bypass Comments)** | No `# nosec` | No `// nosec` | No `/* nosec */` | No `#![allow(unsafe)]` | No `@SuppressWarnings` | No pragma disable |
17
+ | **TG-DIFF (TLS Verification)** | No `verify=False` | No `rejectUnauthorized:false` | No `InsecureSkipVerify: true` | No `danger_accept_invalid_certs`| No `TrustAllStrategy` | No `DangerousAcceptAny...` |
18
+
19
+ ---
20
+
21
+ ## 🚀 Polyglot Hardening Rules of Thumb
22
+
23
+ 1. **Parameterize Everything:** Never concatenate raw user input into SQL, shell commands, LDAP filters, or template strings, regardless of language.
24
+ 2. **Fail Closed on Auth:** Default all endpoints to authenticated; explicitly mark public routes rather than remembering to protect private ones.
25
+ 3. **Strict Bounds:** Keep remediation diffs minimal ($\le 35$ additions, $\le 25$ deletions) to ensure auditability across all codebases.
@@ -1,40 +1,40 @@
1
- # TorusGuard Skill Reference: Rust Security
2
-
3
- > **Loaded When:** A project is identified as a Rust application (`Cargo.toml` or `.rs` files detected).
4
-
5
- ---
6
-
7
- ## 🛡️ Key Inspection Areas & Rules
8
-
9
- ### 1. Memory Safety & Unsafe Blocks
10
- * `TG-INPUT-003`: Audit and restrict `unsafe { ... }` blocks. Must include a `// SAFETY:` rationale comment.
11
- * Never disable standard borrow checker lints via `#![allow(unsafe_code)]`.
12
-
13
- ### 2. Database & SQL Queries
14
- * `TG-INPUT-002`: Use compile-time checked `sqlx::query!` or Diesel query builder methods.
15
- * `TG-DB-004`: Enforce tenant filtering in queries (`filter(tenant_id.eq(current_tenant_id))`).
16
-
17
- ### 3. Outbound Requests & TLS
18
- * `TG-DIFF-001`: Prohibit `danger_accept_invalid_certs(true)` in `reqwest::ClientBuilder`.
19
- * `TG-SSRF-001`: Enforce IP allowlists before dispatching network calls.
20
-
21
- ---
22
-
23
- ## 🛠️ Safe Patterns Summary
24
-
25
- ```rust
26
- // Safe sqlx Parameterized Query
27
- let user = sqlx::query_as!(
28
- User,
29
- "SELECT id, email FROM users WHERE id = $1 AND tenant_id = $2",
30
- user_id,
31
- current_tenant_id
32
- )
33
- .fetch_one(&pool)
34
- .await?;
35
-
36
- // Safe reqwest Client (Strict TLS)
37
- let client = reqwest::Client::builder()
38
- .timeout(std::time::Duration::from_secs(10))
39
- .build()?;
40
- ```
1
+ # TorusGuard Skill Reference: Rust Security
2
+
3
+ > **Loaded When:** A project is identified as a Rust application (`Cargo.toml` or `.rs` files detected).
4
+
5
+ ---
6
+
7
+ ## 🛡️ Key Inspection Areas & Rules
8
+
9
+ ### 1. Memory Safety & Unsafe Blocks
10
+ * `TG-INPUT-003`: Audit and restrict `unsafe { ... }` blocks. Must include a `// SAFETY:` rationale comment.
11
+ * Never disable standard borrow checker lints via `#![allow(unsafe_code)]`.
12
+
13
+ ### 2. Database & SQL Queries
14
+ * `TG-INPUT-002`: Use compile-time checked `sqlx::query!` or Diesel query builder methods.
15
+ * `TG-DB-004`: Enforce tenant filtering in queries (`filter(tenant_id.eq(current_tenant_id))`).
16
+
17
+ ### 3. Outbound Requests & TLS
18
+ * `TG-DIFF-001`: Prohibit `danger_accept_invalid_certs(true)` in `reqwest::ClientBuilder`.
19
+ * `TG-SSRF-001`: Enforce IP allowlists before dispatching network calls.
20
+
21
+ ---
22
+
23
+ ## 🛠️ Safe Patterns Summary
24
+
25
+ ```rust
26
+ // Safe sqlx Parameterized Query
27
+ let user = sqlx::query_as!(
28
+ User,
29
+ "SELECT id, email FROM users WHERE id = $1 AND tenant_id = $2",
30
+ user_id,
31
+ current_tenant_id
32
+ )
33
+ .fetch_one(&pool)
34
+ .await?;
35
+
36
+ // Safe reqwest Client (Strict TLS)
37
+ let client = reqwest::Client::builder()
38
+ .timeout(std::time::Duration::from_secs(10))
39
+ .build()?;
40
+ ```
@@ -1,54 +1,54 @@
1
- # TorusGuard Security Audit & Runtime Verification Report
2
-
3
- > **TorusGuard Version:** `{{torusguard_version}}`
4
- > **Target:** `{{target_name}}`
5
- > **Run ID:** `{{run_id}}`
6
- > **Timestamp:** `{{timestamp}}`
7
-
8
- ---
9
-
10
- ## Detected Stack
11
- - **Language:** {{stack_language}}
12
- - **Framework:** {{stack_framework}}
13
- - **Data Layer:** {{stack_data_layer}}
14
- - **Dependency Files:** {{stack_dependency_files}}
15
- - **Detection Confidence:** {{stack_confidence}}
16
-
17
- ---
18
-
19
- ## Executive Posture
20
- **Posture:** {{posture_indicator}}
21
- **Average Confidence Score:** `{{avg_confidence_score}}/100`
22
-
23
- ### Finding Summary
24
- | Severity | Count | Confirmed | Needs Review | Remediated |
25
- | :--- | :---: | :---: | :---: | :---: |
26
- | 🔴 **Critical** | {{critical_count}} | {{critical_confirmed}} | {{critical_review}} | {{critical_fixed}} |
27
- | 🟠 **High** | {{high_count}} | {{high_confirmed}} | {{high_review}} | {{high_fixed}} |
28
- | 🟡 **Medium** | {{medium_count}} | {{medium_confirmed}} | {{medium_review}} | {{medium_fixed}} |
29
- | 🔵 **Low** | {{low_count}} | {{low_confirmed}} | {{low_review}} | {{low_fixed}} |
30
-
31
- ---
32
-
33
- ## Root-Cause Clusters
34
- {{cluster_summary_table}}
35
-
36
- ---
37
-
38
- ## Detailed Findings
39
- {{finding_cards_section}}
40
-
41
- ---
42
-
43
- ## Governance & Safety Audit Statement
44
- This execution complied with TorusGuard v0.8.0 governance rules:
45
- - **Authorization Gate:** {{authorization_status}}
46
- - **Patch Governance (Ponytail):** Additions $\le 35$, Deletions $\le 25$.
47
- - **Token Redaction:** All captured authorization headers, bearer tokens, and passwords were redacted.
48
-
49
- ---
50
-
51
- ## Prioritized Next Steps
52
- 1. **Remediate Confirmed Sinks:** Run `/torusguard harden` to package remediation bundles.
53
- 2. **Apply Governed Fixes:** Run `/torusguard apply <bundle_id>` to apply targeted fixes.
54
- 3. **Verify Fixes:** Run `/torusguard recheck` to ensure no regressions exist.
1
+ # TorusGuard Security Audit & Runtime Verification Report
2
+
3
+ > **TorusGuard Version:** `{{torusguard_version}}`
4
+ > **Target:** `{{target_name}}`
5
+ > **Run ID:** `{{run_id}}`
6
+ > **Timestamp:** `{{timestamp}}`
7
+
8
+ ---
9
+
10
+ ## Detected Stack
11
+ - **Language:** {{stack_language}}
12
+ - **Framework:** {{stack_framework}}
13
+ - **Data Layer:** {{stack_data_layer}}
14
+ - **Dependency Files:** {{stack_dependency_files}}
15
+ - **Detection Confidence:** {{stack_confidence}}
16
+
17
+ ---
18
+
19
+ ## Executive Posture
20
+ **Posture:** {{posture_indicator}}
21
+ **Average Confidence Score:** `{{avg_confidence_score}}/100`
22
+
23
+ ### Finding Summary
24
+ | Severity | Count | Confirmed | Needs Review | Remediated |
25
+ | :--- | :---: | :---: | :---: | :---: |
26
+ | 🔴 **Critical** | {{critical_count}} | {{critical_confirmed}} | {{critical_review}} | {{critical_fixed}} |
27
+ | 🟠 **High** | {{high_count}} | {{high_confirmed}} | {{high_review}} | {{high_fixed}} |
28
+ | 🟡 **Medium** | {{medium_count}} | {{medium_confirmed}} | {{medium_review}} | {{medium_fixed}} |
29
+ | 🔵 **Low** | {{low_count}} | {{low_confirmed}} | {{low_review}} | {{low_fixed}} |
30
+
31
+ ---
32
+
33
+ ## Root-Cause Clusters
34
+ {{cluster_summary_table}}
35
+
36
+ ---
37
+
38
+ ## Detailed Findings
39
+ {{finding_cards_section}}
40
+
41
+ ---
42
+
43
+ ## Governance & Safety Audit Statement
44
+ This execution complied with TorusGuard v0.8.0 governance rules:
45
+ - **Authorization Gate:** {{authorization_status}}
46
+ - **Patch Governance (Ponytail):** Additions $\le 35$, Deletions $\le 25$.
47
+ - **Token Redaction:** All captured authorization headers, bearer tokens, and passwords were redacted.
48
+
49
+ ---
50
+
51
+ ## Prioritized Next Steps
52
+ 1. **Remediate Confirmed Sinks:** Run `/torusguard harden` to package remediation bundles.
53
+ 2. **Apply Governed Fixes:** Run `/torusguard apply <bundle_id>` to apply targeted fixes.
54
+ 3. **Verify Fixes:** Run `/torusguard recheck` to ensure no regressions exist.
@@ -1,34 +1,34 @@
1
- # TorusGuard Target Authorization Record
2
-
3
- **Authorization ID:** `{{authorization_id}}`
4
- **Generated At:** `{{timestamp}}`
5
- **Valid Until:** `{{valid_until}}`
6
-
7
- ---
8
-
9
- ## 1. Target Identification
10
- - **Project / Application:** `{{target_name}}`
11
- - **Target URL / Hosts:** `{{target_hosts}}`
12
- - **Scope Type:** `{{scope_type}}`
13
-
14
- ---
15
-
16
- ## 2. Permitted Boundaries
17
- - **Allowed Path Prefixes:**
18
- {{allowed_path_prefixes_list}}
19
-
20
- - **Explicitly Forbidden / Excluded Paths:**
21
- {{forbidden_paths_list}}
22
-
23
- - **Max Navigation Depth:** `{{max_depth}}`
24
- - **Max Request Budget:** `{{max_requests}}`
25
- - **Allow State-Changing Methods:** `{{allow_state_changing_methods}}`
26
-
27
- ---
28
-
29
- ## 3. Owner Confirmation & Legal Statement
30
- > [!IMPORTANT]
31
- > The target application owner has confirmed that this testing environment is authorized for non-destructive, bounded runtime security validation.
32
-
33
- - **Authorized By:** `{{authorized_by}}`
34
- - **Confirmation Status:** `Owner Confirmed`
1
+ # TorusGuard Target Authorization Record
2
+
3
+ **Authorization ID:** `{{authorization_id}}`
4
+ **Generated At:** `{{timestamp}}`
5
+ **Valid Until:** `{{valid_until}}`
6
+
7
+ ---
8
+
9
+ ## 1. Target Identification
10
+ - **Project / Application:** `{{target_name}}`
11
+ - **Target URL / Hosts:** `{{target_hosts}}`
12
+ - **Scope Type:** `{{scope_type}}`
13
+
14
+ ---
15
+
16
+ ## 2. Permitted Boundaries
17
+ - **Allowed Path Prefixes:**
18
+ {{allowed_path_prefixes_list}}
19
+
20
+ - **Explicitly Forbidden / Excluded Paths:**
21
+ {{forbidden_paths_list}}
22
+
23
+ - **Max Navigation Depth:** `{{max_depth}}`
24
+ - **Max Request Budget:** `{{max_requests}}`
25
+ - **Allow State-Changing Methods:** `{{allow_state_changing_methods}}`
26
+
27
+ ---
28
+
29
+ ## 3. Owner Confirmation & Legal Statement
30
+ > [!IMPORTANT]
31
+ > The target application owner has confirmed that this testing environment is authorized for non-destructive, bounded runtime security validation.
32
+
33
+ - **Authorized By:** `{{authorized_by}}`
34
+ - **Confirmation Status:** `Owner Confirmed`
@@ -1,32 +1,32 @@
1
- ### [{{rule_id}}] {{finding_title}}
2
-
3
- **Severity:** `{{severity_badge}}` | **Auditable Confidence:** `{{confidence_score}}/100 {{confidence_band_badge}}`
4
- **Finding ID:** `{{finding_id}}` | **Fingerprint:** `{{fingerprint_hash}}`
5
- **Target Location:** `{{file_path}}:{{line_number}}` (`{{code_symbol}}`)
6
- **Lifecycle Status:** `{{lifecycle_status}}` | **Exploitability:** `{{exploitability_status}}`
7
-
8
- ---
9
-
10
- #### 1. Provenance Chain
11
- - **Detection Rule:** `{{rule_id}}` (CWE-{{cwe_id}})
12
- - **Triggering Input:** `{{triggering_source}}`
13
- - **Sink Path:** `{{sink_expression}}`
14
-
15
- #### 2. Raw Verified Evidence
16
- ```{{code_language}}
17
- {{raw_evidence_snippet}}
18
- ```
19
- > **Evidence Checksum (SHA-256):** `{{evidence_sha256}}`
20
-
21
- #### 3. Objective Facts vs AI Interpretation
22
- - **Verified Facts:** {{raw_facts_summary}}
23
- - **AI Risk Analysis:** {{ai_interpretation}}
24
-
25
- #### 4. Remediation Diff (Minimal Churn)
26
- ```diff
27
- {{remediation_diff_preview}}
28
- ```
29
-
30
- #### 5. Retest & Verification
31
- - **Verification Method:** {{verification_method}}
32
- - **Current Retest Status:** `{{retest_status}}`
1
+ ### [{{rule_id}}] {{finding_title}}
2
+
3
+ **Severity:** `{{severity_badge}}` | **Auditable Confidence:** `{{confidence_score}}/100 {{confidence_band_badge}}`
4
+ **Finding ID:** `{{finding_id}}` | **Fingerprint:** `{{fingerprint_hash}}`
5
+ **Target Location:** `{{file_path}}:{{line_number}}` (`{{code_symbol}}`)
6
+ **Lifecycle Status:** `{{lifecycle_status}}` | **Exploitability:** `{{exploitability_status}}`
7
+
8
+ ---
9
+
10
+ #### 1. Provenance Chain
11
+ - **Detection Rule:** `{{rule_id}}` (CWE-{{cwe_id}})
12
+ - **Triggering Input:** `{{triggering_source}}`
13
+ - **Sink Path:** `{{sink_expression}}`
14
+
15
+ #### 2. Raw Verified Evidence
16
+ ```{{code_language}}
17
+ {{raw_evidence_snippet}}
18
+ ```
19
+ > **Evidence Checksum (SHA-256):** `{{evidence_sha256}}`
20
+
21
+ #### 3. Objective Facts vs AI Interpretation
22
+ - **Verified Facts:** {{raw_facts_summary}}
23
+ - **AI Risk Analysis:** {{ai_interpretation}}
24
+
25
+ #### 4. Remediation Diff (Minimal Churn)
26
+ ```diff
27
+ {{remediation_diff_preview}}
28
+ ```
29
+
30
+ #### 5. Retest & Verification
31
+ - **Verification Method:** {{verification_method}}
32
+ - **Current Retest Status:** `{{retest_status}}`
@@ -1,35 +1,35 @@
1
- # Remediation Bundle: `{{bundle_id}}`
2
-
3
- **Cluster ID:** `{{cluster_id}}`
4
- **Target Rule:** `{{rule_id}}` (`{{rule_title}}`)
5
- **Affected Files:** `{{affected_files}}`
6
-
7
- ---
8
-
9
- ## 1. Problem Statement & Risk
10
- {{problem_statement}}
11
-
12
- **Adversarial Abuse & Practical Impact:**
13
- {{risk_explanation}}
14
-
15
- ---
16
-
17
- ## 2. Governed Minimal Patch Plan
18
- - **Max Additions Boundary:** $\le 35$ lines (Proposed: `+{{additions_count}}`)
19
- - **Max Deletions Boundary:** $\le 25$ lines (Proposed: `-{{deletions_count}}`)
20
- - **Governance Review Level:** `{{governance_review_level}}`
21
-
22
- ### Framework-Native Diff
23
- ```diff
24
- {{candidate_patch_diff}}
25
- ```
26
-
27
- ---
28
-
29
- ## 3. Verification & Retest Method
30
- {{verification_method}}
31
-
32
- ---
33
-
34
- ## 4. Residual Risk & Edge Cases
35
- {{residual_risk_notes}}
1
+ # Remediation Bundle: `{{bundle_id}}`
2
+
3
+ **Cluster ID:** `{{cluster_id}}`
4
+ **Target Rule:** `{{rule_id}}` (`{{rule_title}}`)
5
+ **Affected Files:** `{{affected_files}}`
6
+
7
+ ---
8
+
9
+ ## 1. Problem Statement & Risk
10
+ {{problem_statement}}
11
+
12
+ **Adversarial Abuse & Practical Impact:**
13
+ {{risk_explanation}}
14
+
15
+ ---
16
+
17
+ ## 2. Governed Minimal Patch Plan
18
+ - **Max Additions Boundary:** $\le 35$ lines (Proposed: `+{{additions_count}}`)
19
+ - **Max Deletions Boundary:** $\le 25$ lines (Proposed: `-{{deletions_count}}`)
20
+ - **Governance Review Level:** `{{governance_review_level}}`
21
+
22
+ ### Framework-Native Diff
23
+ ```diff
24
+ {{candidate_patch_diff}}
25
+ ```
26
+
27
+ ---
28
+
29
+ ## 3. Verification & Retest Method
30
+ {{verification_method}}
31
+
32
+ ---
33
+
34
+ ## 4. Residual Risk & Edge Cases
35
+ {{residual_risk_notes}}
@@ -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.6
4
+ version: 1.4.0
5
5
  agent: remediator
6
6
  lifecycle-phase: Phase 5 (Patch Application)
7
7
  required-skills:
@@ -22,6 +22,14 @@ $ARGUMENTS
22
22
  ## Objective
23
23
  Governed patch application with pre-apply rollback snapshots and Human Gate authorization.
24
24
 
25
+ Supported CLI flags:
26
+ - `npx torusguard apply [--target <dir>]` : Apply candidate patches with confirmation prompt
27
+ - `npx torusguard apply --diff` : Preview unified diffs without modifying files on disk
28
+ - `npx torusguard apply --selective` : Interactively review and approve patches one by one
29
+ - `npx torusguard apply --verify` : Trigger immediate differential AST recheck post-apply
30
+ - `npx torusguard apply --list-snapshots` : List available historical pre-apply backup snapshots
31
+ - `npx torusguard apply --yes` / `-y` : Non-interactive auto-approval mode
32
+
25
33
  ---
26
34
 
27
35
  ## Mandatory Pre-Flight Context Inspection
@@ -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.6
4
+ version: 1.4.0
5
5
  agent: auditor
6
6
  lifecycle-phase: Phase 2 (Static Audit & Clustering)
7
7
  required-skills:
@@ -20,7 +20,13 @@ $ARGUMENTS
20
20
  ---
21
21
 
22
22
  ## Objective
23
- Static security AST scanning, stable fingerprinting, root-cause clustering, and 0-100 scoring.
23
+ Static security AST scanning, stable fingerprinting, root-cause clustering, throughput telemetry, and 0-100 scoring.
24
+
25
+ Supported CLI flags:
26
+ - `npx torusguard audit [--target <dir>]` : Specify project root directory
27
+ - `npx torusguard audit --watch` / `-w` : Continuous watch mode, re-scanning on file change
28
+ - `npx torusguard audit --sarif` : Automatically export OASIS SARIF v2.1.0 log
29
+ - `npx torusguard audit --severity <critical|high|medium|low>` : Floor filter for findings
24
30
 
25
31
  ---
26
32
 
@@ -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.6
4
+ version: 1.4.0
5
5
  agent: remediator
6
6
  lifecycle-phase: Phase 4 (Remediation Formulation)
7
7
  required-skills:
@@ -22,6 +22,11 @@ $ARGUMENTS
22
22
  ## Objective
23
23
  Governed remediation formulation under strict Ponytail Protocol bounds (<=35 add, <=25 del).
24
24
 
25
+ Supported CLI flags:
26
+ - `npx torusguard harden [--target <dir>]` : Specify project root directory
27
+ - `npx torusguard harden --dry-run` : Preview candidate patches without modifying disk files
28
+ - `npx torusguard harden --severity <critical|high|medium|low>` : Filter findings by minimum severity floor
29
+
25
30
  ---
26
31
 
27
32
  ## Mandatory Pre-Flight Context Inspection
@@ -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.6
4
+ version: 1.4.0
5
5
  agent: profiler
6
6
  lifecycle-phase: Phase 0 (Baseline Setup)
7
7
  required-skills:
@@ -20,6 +20,12 @@ $ARGUMENTS
20
20
  ## Objective
21
21
  Baseline project discovery, workspace scaffolding, stack detection, and security rule activation.
22
22
 
23
+ Supported CLI flags:
24
+ - `npx torusguard init [--target <dir>]` : Scaffold workspace into specified root directory
25
+ - `npx torusguard init --template <golang|nextjs|fastapi|express|django|react>` : Guide stack configuration explicitly
26
+ - `npx torusguard init --audit` : Run immediate baseline audit post-initialization
27
+ - `npx torusguard init --force` : Force overwrite existing workspace and re-scaffold baseline
28
+
23
29
  ---
24
30
 
25
31
  ## Mandatory Pre-Flight Context Inspection
@@ -0,0 +1,55 @@
1
+ ---
2
+ description: Explore, search, export, and project distilled Golden Fix Recipes in persistent security memory.
3
+ tools: Read, Grep, Glob, Bash, Write
4
+ version: 1.4.0
5
+ agent: remediator
6
+ lifecycle-phase: Phase 6 (Memory & Recipes)
7
+ required-skills:
8
+ - torusguard-recipes
9
+ scripts-binding:
10
+ - .torusguard/scripts/recipes_runner.py
11
+ - .torusguard/scripts/memory_engine.py
12
+ ---
13
+
14
+ # /torusguard recipes — Golden Fix Recipe Explorer & Memory Distillation
15
+
16
+ $ARGUMENTS
17
+
18
+ ---
19
+
20
+ ## Objective
21
+ Inspect, search, export, and project reusable, verified Ponytail remediation code snippets distilled from passing security patches and persistent memory patterns.
22
+
23
+ ---
24
+
25
+ ## Command Flags & Arguments
26
+
27
+ | Mode | Command Syntax | Description |
28
+ | :--- | :--- | :--- |
29
+ | **List Recipes** | `npx torusguard recipes` | List all distilled golden fix recipes with verification counts and churn |
30
+ | **Search Filter** | `npx torusguard recipes --search <query>` | Filter recipes by keyword, rule family (e.g. `TG-SEC`), or language |
31
+ | **Inspect Detail** | `npx torusguard recipes --detail <id>` | View complete unified diff snippet for a specific recipe |
32
+ | **Export Catalog** | `npx torusguard recipes --export <file>` | Export recipes to `.json` or `.md` catalog format |
33
+ | **Apply Preview** | `npx torusguard recipes --apply <id>` | Project recipe diff onto codebase for manual review |
34
+ | **Target Directory** | `npx torusguard recipes --target <dir>` | Specify custom project root directory |
35
+
36
+ ---
37
+
38
+ ## Execution Steps
39
+
40
+ 1. **Query Memory Patterns:** Read `.torusguard/memory/patterns.json` for verified `golden_fix_recipe` entries.
41
+ 2. **Apply Filter / Search:** Match `--search` query against rule IDs, titles, diffs, and target file types.
42
+ 3. **Render 75-Column Cards:** Format recipe cards showing verified counts, rule family, and Ponytail additions/deletions.
43
+ 4. **Export / Apply:** If requested, write export file or render projected patch snippet.
44
+
45
+ ---
46
+
47
+ ## Output Card Format
48
+
49
+ ```markdown
50
+ ### 🛡️ TorusGuard Golden Fix Recipes
51
+ - **Total Distilled:** [Count] verified recipes
52
+ - **Filter:** [Query or None]
53
+ - **Ponytail Bounds:** All recipes strictly <= 35 additions, <= 25 deletions
54
+ - **Storage:** `.torusguard/memory/patterns.json`
55
+ ```