torusguard 0.9.2
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/.manifest.json +95 -0
- package/.torusguard/ARCHITECTURE.md +168 -0
- package/.torusguard/TORUSGUARD.md +145 -0
- package/.torusguard/agents/auditor.md +41 -0
- package/.torusguard/agents/profiler.md +49 -0
- package/.torusguard/agents/remediator.md +41 -0
- package/.torusguard/agents/reviewer.md +39 -0
- package/.torusguard/agents/validator.md +46 -0
- package/.torusguard/config/scope.json +24 -0
- package/.torusguard/config/slash-commands.json +102 -0
- package/.torusguard/config/torusguard.json +30 -0
- package/.torusguard/references/django-security.md +43 -0
- package/.torusguard/references/drf-security.md +20 -0
- package/.torusguard/references/express-security.md +103 -0
- package/.torusguard/references/fastapi-security.md +20 -0
- package/.torusguard/references/firebase-security.md +78 -0
- package/.torusguard/references/flask-security.md +20 -0
- package/.torusguard/references/nextjs-security.md +96 -0
- package/.torusguard/references/react-vite-security.md +97 -0
- package/.torusguard/references/sqlalchemy-security.md +16 -0
- package/.torusguard/references/supabase-security.md +84 -0
- package/.torusguard/rules/README.md +62 -0
- package/.torusguard/rules/TORUSGUARD.md +145 -0
- package/.torusguard/rules/active/.gitkeep +0 -0
- package/.torusguard/rules/active/TG-DIFF-001.md +20 -0
- package/.torusguard/rules/active/TG-DIFF-002.md +20 -0
- package/.torusguard/rules/active/TG-DIFF-003.md +19 -0
- package/.torusguard/runs/.gitkeep +0 -0
- package/.torusguard/schemas/authorization.schema.json +81 -0
- package/.torusguard/schemas/confidence.schema.json +72 -0
- package/.torusguard/schemas/evidence.schema.json +66 -0
- package/.torusguard/schemas/finding.schema.json +164 -0
- package/.torusguard/schemas/provenance.schema.json +46 -0
- package/.torusguard/schemas/remediation.schema.json +59 -0
- package/.torusguard/schemas/retest.schema.json +53 -0
- package/.torusguard/schemas/runtime-evidence.schema.json +72 -0
- package/.torusguard/scripts/__pycache__/diff_guard.cpython-311.pyc +0 -0
- package/.torusguard/scripts/__pycache__/monorepo_detector.cpython-311.pyc +0 -0
- package/.torusguard/scripts/diff_guard.py +171 -0
- package/.torusguard/scripts/finding_scorer.py +86 -0
- package/.torusguard/scripts/manifest_builder.py +130 -0
- package/.torusguard/scripts/monorepo_detector.py +164 -0
- package/.torusguard/scripts/run_manager.py +89 -0
- package/.torusguard/scripts/safety_gate.py +64 -0
- package/.torusguard/scripts/sarif_exporter.py +116 -0
- package/.torusguard/scripts/stack_detect.py +152 -0
- package/.torusguard/skills/torusguard/SKILL.md +37 -0
- package/.torusguard/skills/torusguard/bootstrap.py +158 -0
- package/.torusguard/skills/torusguard/references/auth-and-sessions.md +56 -0
- package/.torusguard/skills/torusguard/references/business-logic-and-abuse.md +23 -0
- package/.torusguard/skills/torusguard/references/cache-and-sensitive-responses.md +10 -0
- package/.torusguard/skills/torusguard/references/client-code-exposure.md +55 -0
- package/.torusguard/skills/torusguard/references/csrf-and-cross-origin.md +11 -0
- package/.torusguard/skills/torusguard/references/dependency-and-supply-chain.md +22 -0
- package/.torusguard/skills/torusguard/references/django-security.md +43 -0
- package/.torusguard/skills/torusguard/references/drf-security.md +20 -0
- package/.torusguard/skills/torusguard/references/fastapi-security.md +20 -0
- package/.torusguard/skills/torusguard/references/flask-security.md +20 -0
- package/.torusguard/skills/torusguard/references/frontend-no-db.md +53 -0
- package/.torusguard/skills/torusguard/references/graphql-security.md +12 -0
- package/.torusguard/skills/torusguard/references/input-and-injection.md +51 -0
- package/.torusguard/skills/torusguard/references/mass-assignment-and-property-auth.md +22 -0
- package/.torusguard/skills/torusguard/references/platform-hardening.md +56 -0
- package/.torusguard/skills/torusguard/references/python-dependencies.md +16 -0
- package/.torusguard/skills/torusguard/references/python-security-overview.md +12 -0
- package/.torusguard/skills/torusguard/references/rate-limit-and-abuse.md +57 -0
- package/.torusguard/skills/torusguard/references/secrets-and-config.md +64 -0
- package/.torusguard/skills/torusguard/references/sqlalchemy-security.md +16 -0
- package/.torusguard/skills/torusguard/references/ssrf-and-outbound-requests.md +46 -0
- package/.torusguard/skills/torusguard/references/webhook-security.md +15 -0
- package/.torusguard/skills/torusguard/references/websocket-security.md +12 -0
- package/.torusguard/skills/torusguard-apply/SKILL.md +46 -0
- package/.torusguard/skills/torusguard-audit/SKILL.md +70 -0
- package/.torusguard/skills/torusguard-authorize/SKILL.md +47 -0
- package/.torusguard/skills/torusguard-exploit-check/SKILL.md +64 -0
- package/.torusguard/skills/torusguard-full/SKILL.md +70 -0
- package/.torusguard/skills/torusguard-harden/SKILL.md +63 -0
- package/.torusguard/skills/torusguard-init/SKILL.md +52 -0
- package/.torusguard/skills/torusguard-recheck/SKILL.md +53 -0
- package/.torusguard/skills/torusguard-report/SKILL.md +54 -0
- package/.torusguard/skills/torusguard-status/SKILL.md +42 -0
- package/.torusguard/skills/torusguard-verify/SKILL.md +55 -0
- package/.torusguard/skills/torusguard-web-validate/SKILL.md +64 -0
- package/.torusguard/templates/audit-report.template.md +54 -0
- package/.torusguard/templates/authorization.template.md +34 -0
- package/.torusguard/templates/finding-card.template.md +32 -0
- package/.torusguard/templates/remediation-bundle.template.md +35 -0
- package/.torusguard/workflows/apply.md +95 -0
- package/.torusguard/workflows/audit.md +93 -0
- package/.torusguard/workflows/authorize.md +95 -0
- package/.torusguard/workflows/exploit-check.md +97 -0
- package/.torusguard/workflows/harden.md +93 -0
- package/.torusguard/workflows/init.md +95 -0
- package/.torusguard/workflows/recheck.md +95 -0
- package/.torusguard/workflows/report.md +95 -0
- package/.torusguard/workflows/status.md +95 -0
- package/.torusguard/workflows/verify.md +95 -0
- package/.torusguard/workflows/web-validate.md +95 -0
- package/LICENSE +21 -0
- package/README.md +319 -0
- package/bin/torusguard.js +110 -0
- package/install.py +98 -0
- package/package.json +48 -0
- package/skills/torusguard/SKILL.md +41 -0
- package/skills/torusguard/__pycache__/bootstrap.cpython-311.pyc +0 -0
- package/skills/torusguard/bootstrap.py +256 -0
- package/skills/torusguard/payload/.manifest.json +95 -0
- package/skills/torusguard/payload/ARCHITECTURE.md +168 -0
- package/skills/torusguard/payload/TORUSGUARD.md +145 -0
- package/skills/torusguard/payload/agents/auditor.md +41 -0
- package/skills/torusguard/payload/agents/profiler.md +49 -0
- package/skills/torusguard/payload/agents/remediator.md +41 -0
- package/skills/torusguard/payload/agents/reviewer.md +39 -0
- package/skills/torusguard/payload/agents/validator.md +46 -0
- package/skills/torusguard/payload/config/scope.json +24 -0
- package/skills/torusguard/payload/config/slash-commands.json +102 -0
- package/skills/torusguard/payload/config/torusguard.json +30 -0
- package/skills/torusguard/payload/references/django-security.md +43 -0
- package/skills/torusguard/payload/references/drf-security.md +20 -0
- package/skills/torusguard/payload/references/express-security.md +103 -0
- package/skills/torusguard/payload/references/fastapi-security.md +20 -0
- package/skills/torusguard/payload/references/firebase-security.md +78 -0
- package/skills/torusguard/payload/references/flask-security.md +20 -0
- package/skills/torusguard/payload/references/nextjs-security.md +96 -0
- package/skills/torusguard/payload/references/react-vite-security.md +97 -0
- package/skills/torusguard/payload/references/sqlalchemy-security.md +16 -0
- package/skills/torusguard/payload/references/supabase-security.md +84 -0
- package/skills/torusguard/payload/rules/README.md +62 -0
- package/skills/torusguard/payload/rules/TORUSGUARD.md +145 -0
- package/skills/torusguard/payload/rules/active/.gitkeep +0 -0
- package/skills/torusguard/payload/rules/active/TG-DIFF-001.md +20 -0
- package/skills/torusguard/payload/rules/active/TG-DIFF-002.md +20 -0
- package/skills/torusguard/payload/rules/active/TG-DIFF-003.md +19 -0
- package/skills/torusguard/payload/schemas/authorization.schema.json +81 -0
- package/skills/torusguard/payload/schemas/confidence.schema.json +72 -0
- package/skills/torusguard/payload/schemas/evidence.schema.json +66 -0
- package/skills/torusguard/payload/schemas/finding.schema.json +164 -0
- package/skills/torusguard/payload/schemas/provenance.schema.json +46 -0
- package/skills/torusguard/payload/schemas/remediation.schema.json +59 -0
- package/skills/torusguard/payload/schemas/retest.schema.json +53 -0
- package/skills/torusguard/payload/schemas/runtime-evidence.schema.json +72 -0
- package/skills/torusguard/payload/scripts/diff_guard.py +171 -0
- package/skills/torusguard/payload/scripts/finding_scorer.py +86 -0
- package/skills/torusguard/payload/scripts/manifest_builder.py +130 -0
- package/skills/torusguard/payload/scripts/monorepo_detector.py +164 -0
- package/skills/torusguard/payload/scripts/run_manager.py +89 -0
- package/skills/torusguard/payload/scripts/safety_gate.py +64 -0
- package/skills/torusguard/payload/scripts/sarif_exporter.py +116 -0
- package/skills/torusguard/payload/scripts/stack_detect.py +152 -0
- package/skills/torusguard/payload/skills/torusguard/SKILL.md +37 -0
- package/skills/torusguard/payload/skills/torusguard/bootstrap.py +158 -0
- package/skills/torusguard/payload/skills/torusguard/references/auth-and-sessions.md +56 -0
- package/skills/torusguard/payload/skills/torusguard/references/business-logic-and-abuse.md +23 -0
- package/skills/torusguard/payload/skills/torusguard/references/cache-and-sensitive-responses.md +10 -0
- package/skills/torusguard/payload/skills/torusguard/references/client-code-exposure.md +55 -0
- package/skills/torusguard/payload/skills/torusguard/references/csrf-and-cross-origin.md +11 -0
- package/skills/torusguard/payload/skills/torusguard/references/dependency-and-supply-chain.md +22 -0
- package/skills/torusguard/payload/skills/torusguard/references/django-security.md +43 -0
- package/skills/torusguard/payload/skills/torusguard/references/drf-security.md +20 -0
- package/skills/torusguard/payload/skills/torusguard/references/fastapi-security.md +20 -0
- package/skills/torusguard/payload/skills/torusguard/references/flask-security.md +20 -0
- package/skills/torusguard/payload/skills/torusguard/references/frontend-no-db.md +53 -0
- package/skills/torusguard/payload/skills/torusguard/references/graphql-security.md +12 -0
- package/skills/torusguard/payload/skills/torusguard/references/input-and-injection.md +51 -0
- package/skills/torusguard/payload/skills/torusguard/references/mass-assignment-and-property-auth.md +22 -0
- package/skills/torusguard/payload/skills/torusguard/references/platform-hardening.md +56 -0
- package/skills/torusguard/payload/skills/torusguard/references/python-dependencies.md +16 -0
- package/skills/torusguard/payload/skills/torusguard/references/python-security-overview.md +12 -0
- package/skills/torusguard/payload/skills/torusguard/references/rate-limit-and-abuse.md +57 -0
- package/skills/torusguard/payload/skills/torusguard/references/secrets-and-config.md +64 -0
- package/skills/torusguard/payload/skills/torusguard/references/sqlalchemy-security.md +16 -0
- package/skills/torusguard/payload/skills/torusguard/references/ssrf-and-outbound-requests.md +46 -0
- package/skills/torusguard/payload/skills/torusguard/references/webhook-security.md +15 -0
- package/skills/torusguard/payload/skills/torusguard/references/websocket-security.md +12 -0
- package/skills/torusguard/payload/skills/torusguard-apply/SKILL.md +46 -0
- package/skills/torusguard/payload/skills/torusguard-audit/SKILL.md +70 -0
- package/skills/torusguard/payload/skills/torusguard-authorize/SKILL.md +47 -0
- package/skills/torusguard/payload/skills/torusguard-exploit-check/SKILL.md +64 -0
- package/skills/torusguard/payload/skills/torusguard-full/SKILL.md +70 -0
- package/skills/torusguard/payload/skills/torusguard-harden/SKILL.md +63 -0
- package/skills/torusguard/payload/skills/torusguard-init/SKILL.md +52 -0
- package/skills/torusguard/payload/skills/torusguard-recheck/SKILL.md +53 -0
- package/skills/torusguard/payload/skills/torusguard-report/SKILL.md +54 -0
- package/skills/torusguard/payload/skills/torusguard-status/SKILL.md +42 -0
- package/skills/torusguard/payload/skills/torusguard-verify/SKILL.md +55 -0
- package/skills/torusguard/payload/skills/torusguard-web-validate/SKILL.md +64 -0
- package/skills/torusguard/payload/templates/audit-report.template.md +54 -0
- package/skills/torusguard/payload/templates/authorization.template.md +34 -0
- package/skills/torusguard/payload/templates/finding-card.template.md +32 -0
- package/skills/torusguard/payload/templates/remediation-bundle.template.md +35 -0
- package/skills/torusguard/payload/workflows/apply.md +95 -0
- package/skills/torusguard/payload/workflows/audit.md +93 -0
- package/skills/torusguard/payload/workflows/authorize.md +95 -0
- package/skills/torusguard/payload/workflows/exploit-check.md +97 -0
- package/skills/torusguard/payload/workflows/harden.md +93 -0
- package/skills/torusguard/payload/workflows/init.md +95 -0
- package/skills/torusguard/payload/workflows/recheck.md +95 -0
- package/skills/torusguard/payload/workflows/report.md +95 -0
- package/skills/torusguard/payload/workflows/status.md +95 -0
- package/skills/torusguard/payload/workflows/verify.md +95 -0
- package/skills/torusguard/payload/workflows/web-validate.md +95 -0
- package/skills/torusguard/references/auth-and-sessions.md +56 -0
- package/skills/torusguard/references/business-logic-and-abuse.md +23 -0
- package/skills/torusguard/references/cache-and-sensitive-responses.md +10 -0
- package/skills/torusguard/references/client-code-exposure.md +55 -0
- package/skills/torusguard/references/csrf-and-cross-origin.md +11 -0
- package/skills/torusguard/references/dependency-and-supply-chain.md +22 -0
- package/skills/torusguard/references/django-security.md +43 -0
- package/skills/torusguard/references/drf-security.md +20 -0
- package/skills/torusguard/references/fastapi-security.md +20 -0
- package/skills/torusguard/references/flask-security.md +20 -0
- package/skills/torusguard/references/frontend-no-db.md +53 -0
- package/skills/torusguard/references/graphql-security.md +12 -0
- package/skills/torusguard/references/input-and-injection.md +51 -0
- package/skills/torusguard/references/mass-assignment-and-property-auth.md +22 -0
- package/skills/torusguard/references/platform-hardening.md +56 -0
- package/skills/torusguard/references/python-dependencies.md +16 -0
- package/skills/torusguard/references/python-security-overview.md +12 -0
- package/skills/torusguard/references/rate-limit-and-abuse.md +57 -0
- package/skills/torusguard/references/secrets-and-config.md +64 -0
- package/skills/torusguard/references/sqlalchemy-security.md +16 -0
- package/skills/torusguard/references/ssrf-and-outbound-requests.md +46 -0
- package/skills/torusguard/references/webhook-security.md +15 -0
- package/skills/torusguard/references/websocket-security.md +12 -0
- package/skills/torusguard-apply/SKILL.md +46 -0
- package/skills/torusguard-audit/SKILL.md +70 -0
- package/skills/torusguard-authorize/SKILL.md +47 -0
- package/skills/torusguard-exploit-check/SKILL.md +64 -0
- package/skills/torusguard-full/SKILL.md +70 -0
- package/skills/torusguard-harden/SKILL.md +63 -0
- package/skills/torusguard-init/SKILL.md +52 -0
- package/skills/torusguard-recheck/SKILL.md +53 -0
- package/skills/torusguard-report/SKILL.md +54 -0
- package/skills/torusguard-status/SKILL.md +42 -0
- package/skills/torusguard-verify/SKILL.md +55 -0
- package/skills/torusguard-web-validate/SKILL.md +64 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: torusguard-full
|
|
3
|
+
description: Master 7-stage security pipeline orchestrator — coordinates discovery, authorization, static audit, runtime validation, governed remediation, recheck, and reporting.
|
|
4
|
+
version: 0.9.2
|
|
5
|
+
workflow: .torusguard/workflows/audit.md
|
|
6
|
+
tools: Read, Grep, Glob, Bash, Edit, Write
|
|
7
|
+
scripts-binding:
|
|
8
|
+
- .torusguard/scripts/stack_detect.py
|
|
9
|
+
- .torusguard/scripts/safety_gate.py
|
|
10
|
+
- .torusguard/scripts/finding_scorer.py
|
|
11
|
+
- .torusguard/scripts/run_manager.py
|
|
12
|
+
- .torusguard/scripts/sarif_exporter.py
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# TorusGuard Full — Master 7-Stage Pipeline Orchestrator
|
|
16
|
+
|
|
17
|
+
## Objective
|
|
18
|
+
Execute the full, closed-loop TorusGuard security lifecycle from stack discovery through static scanning, runtime validation, Ponytail remediation, differential re-check, and SARIF export under strict governance.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 7-Stage Security Pipeline
|
|
23
|
+
0. Init (Baseline) ──► 1. Authorize (Scope) ──► 2. Audit (AST Scan) ──► 3. Validate (Evidence/Exploit) ──► 4. Harden (Ponytail Patch) ──► 5. Apply (Backup & Edit) ──► 6. Recheck (Regression) ──► 7. Report (SARIF)
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Specialist Skill Routing
|
|
28
|
+
- **Phase 0:** `torusguard-init` (`profiler`)
|
|
29
|
+
- **Phase 1:** `torusguard-authorize` (`reviewer`)
|
|
30
|
+
- **Phase 2:** `torusguard-audit` (`auditor`)
|
|
31
|
+
- **Phase 3:** `torusguard-verify` / `torusguard-exploit-check` (`validator`)
|
|
32
|
+
- **Phase 4:** `torusguard-harden` (`remediator`)
|
|
33
|
+
- **Phase 5:** `torusguard-apply` (`remediator`)
|
|
34
|
+
- **Phase 6:** `torusguard-recheck` (`reviewer`)
|
|
35
|
+
- **Phase 7:** `torusguard-report` (`reviewer`)
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Pipeline Execution Instructions
|
|
40
|
+
1. **Init:** Detect stack via `stack_detect.py` and activate rules in `.torusguard/rules/active/`.
|
|
41
|
+
2. **Authorize:** Verify target ownership and TTL in `.torusguard/config/scope.json`.
|
|
42
|
+
3. **Audit:** Scan ASTs; assign fingerprints; cluster root causes; compute confidence scores.
|
|
43
|
+
4. **Validate:** Audit evidence sufficiency; optionally send bounded probe canary.
|
|
44
|
+
5. **Harden:** Formulate surgical diffs bound by Ponytail limits ($\le 35$ add, $\le 25$ del).
|
|
45
|
+
6. **Apply:** Save `.bak` snapshot in `pre_apply/`; obtain Human Gate; apply patch.
|
|
46
|
+
7. **Recheck:** Re-scan modified files; assert findings are `Fixed` with zero regressions.
|
|
47
|
+
8. **Report:** Export OASIS SARIF v2.1.0 and emit signed markdown summary.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Confidence Scoring Rubric
|
|
52
|
+
Evaluates Evidence (35 pts), Reproduction (25 pts), Corroboration (15 pts), Environment (15 pts), and Review Status (10 pts) into 4 bands: Confirmed (90–100), High (70–89), Medium (50–69), Needs Review (<50).
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Safety & Governance
|
|
57
|
+
- Human Gate mandatory before code modifications in Phase 5.
|
|
58
|
+
- Enforce Ponytail line bounds ($\le 35$ additions, $\le 25$ deletions).
|
|
59
|
+
- Never dispatch network probes outside authorized scope in `scope.json`.
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Output Format
|
|
64
|
+
```markdown
|
|
65
|
+
🏆 [TorusGuard] 7-Stage Security Pipeline Complete
|
|
66
|
+
- Run ID: run-YYYYMMDD-HHMMSS | Status: SECURE / AUDITED
|
|
67
|
+
- Findings: <Total> (<Fixed> Fixed · <Open> Remaining)
|
|
68
|
+
- SARIF Log: `.torusguard/runs/<run_id>/results.sarif`
|
|
69
|
+
- Report: `.torusguard/runs/<run_id>/report.md`
|
|
70
|
+
```
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: torusguard-harden
|
|
3
|
+
description: Package surgical remediation bundles conforming to the Ponytail Protocol (<= 35 additions, <= 25 deletions).
|
|
4
|
+
version: 0.9.2
|
|
5
|
+
workflow: .torusguard/workflows/harden.md
|
|
6
|
+
tools: Read, Grep, Glob, Write
|
|
7
|
+
scripts-binding:
|
|
8
|
+
- .torusguard/scripts/run_manager.py
|
|
9
|
+
- .torusguard/scripts/diff_guard.py
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# TorusGuard Harden — Governed Remediation & Bundle Packaging
|
|
13
|
+
|
|
14
|
+
## Objective
|
|
15
|
+
Formulate minimal, surgical code fixes bound by the Ponytail Protocol ($\le 35$ additions, $\le 25$ deletions), packaging unified diffs into auditable 4-artifact remediation bundles ready for review.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## The Ponytail Protocol
|
|
20
|
+
- **Limits:** Additions $\le 35$, Deletions $\le 25$ lines per bundle.
|
|
21
|
+
- **Invariants:** Zero full-file rewrites; preserve public APIs and tests.
|
|
22
|
+
- **Overflow:** Partition into sequential sub-bundles.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Bundle Directory Structure
|
|
27
|
+
```
|
|
28
|
+
.torusguard/runs/<run_id>/remediation/<finding_id>/
|
|
29
|
+
├── patch.diff # Standard unified diff with line numbers
|
|
30
|
+
├── plan.md # Rationale and root-cause breakdown
|
|
31
|
+
├── verification.md # Test instructions proving fix works
|
|
32
|
+
└── rollback.md # Command or steps to revert patch
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Execution Steps
|
|
38
|
+
|
|
39
|
+
1. **Select Finding:** Choose prioritized verified flaw from active run's `findings.md`.
|
|
40
|
+
2. **Read AST Context:** View target file surrounding lines (±15) using `view_file`.
|
|
41
|
+
3. **Formulate Minimal Fix:** Parameterize SQL, add tenant filters, insert validation schemas.
|
|
42
|
+
4. **Validate Line Churn:** Assert additions $\le 35$ and deletions $\le 25$.
|
|
43
|
+
5. **Package Bundle:** Write 4 artifacts (`patch.diff`, `plan.md`, `verification.md`, `rollback.md`).
|
|
44
|
+
6. **Flag Sensitive Paths:** Mark changes touching auth or billing with `Requires Sensitive-Path Sign-Off`.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Safety Constraints
|
|
49
|
+
- Dry-run only; do NOT apply modifications to source code during harden.
|
|
50
|
+
- Keep surrounding formatting and comments intact.
|
|
51
|
+
- Never touch files outside the targeted vulnerable sink.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Output Format
|
|
56
|
+
```markdown
|
|
57
|
+
🛠️ [TorusGuard] Remediation Bundle Packaged
|
|
58
|
+
- Finding Target: <Finding ID> | File: <Path>
|
|
59
|
+
- Line Churn: +<Additions> / -<Deletions> (Ponytail: PASS)
|
|
60
|
+
- Sensitive Path: <Yes/No>
|
|
61
|
+
- Bundle Path: `.torusguard/runs/<run_id>/remediation/<finding_id>/`
|
|
62
|
+
Next: Run `/torusguard apply` to review diff and apply with rollback backup.
|
|
63
|
+
```
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: torusguard-init
|
|
3
|
+
description: Initialize TorusGuard workspace — detect project stack, activate tailored TG-* security rules, and generate SECURITY.md baseline.
|
|
4
|
+
version: 0.9.2
|
|
5
|
+
workflow: .torusguard/workflows/init.md
|
|
6
|
+
tools: Read, Grep, Glob, Write
|
|
7
|
+
scripts-binding:
|
|
8
|
+
- .torusguard/scripts/stack_detect.py
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# TorusGuard Init — Project Stack Discovery & Rule Activation
|
|
12
|
+
|
|
13
|
+
## Objective
|
|
14
|
+
Auto-detect repository technology stack via indicators or `stack_detect.py`, activate framework-tailored `TG-*` security rules into `.torusguard/rules/active/`, and provision `torusguard.json` and `SECURITY.md`.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Pre-Flight Check
|
|
19
|
+
1. Verify `.torusguard/` layout (`config/`, `rules/active/`, `runs/`, `scripts/`, `workflows/`, `templates/`, `schemas/`).
|
|
20
|
+
2. If missing, unpack via `python skills/torusguard/bootstrap.py --target .`.
|
|
21
|
+
3. Check existing `.torusguard/config/torusguard.json` before overwriting.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Execution Steps
|
|
26
|
+
|
|
27
|
+
1. **Stack Detection:** Run `python .torusguard/scripts/stack_detect.py .` to detect:
|
|
28
|
+
- Python: Django (`manage.py`), FastAPI (`fastapi`), Flask (`flask`), SQLAlchemy.
|
|
29
|
+
- Node: Next.js (`"next"`), Express (`"express"`), React/Vite (`"vite"`).
|
|
30
|
+
- BaaS: Supabase (`@supabase/supabase-js`), Firebase (`firebase-admin`).
|
|
31
|
+
2. **Emit Stack Record:** Log detected language, framework, ORM, and client SDKs.
|
|
32
|
+
3. **Activate Tailored Rules:** Copy matching `TG-*` rules from `.torusguard/rules/` into `.torusguard/rules/active/`.
|
|
33
|
+
4. **Provision Policy:** Create `SECURITY.md` if absent, configuring responsible disclosure contacts.
|
|
34
|
+
5. **Write Configuration:** Persist detected stack and active rules count to `.torusguard/config/torusguard.json`.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Safety Constraints
|
|
39
|
+
- Never overwrite custom rules in `.torusguard/rules/active/` without prompt.
|
|
40
|
+
- Retain existing `SECURITY.md` if already established by repository owners.
|
|
41
|
+
- Strictly read-only detection against source files.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Output Format
|
|
46
|
+
```markdown
|
|
47
|
+
🛡️ [TorusGuard] Workspace Initialized
|
|
48
|
+
- Primary Stack: <Detected Stack> | Components: <Backend/Frontend/DB>
|
|
49
|
+
- Active Rules: <Count> rules enabled in `.torusguard/rules/active/`
|
|
50
|
+
- Configuration: `.torusguard/config/torusguard.json` written
|
|
51
|
+
Next: Run `/torusguard audit` to execute static security scan.
|
|
52
|
+
```
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: torusguard-recheck
|
|
3
|
+
description: Execute targeted differential AST re-scan against modified files, verify fix closure, and assert zero regressions.
|
|
4
|
+
version: 0.9.2
|
|
5
|
+
workflow: .torusguard/workflows/recheck.md
|
|
6
|
+
tools: Read, Grep, Glob, Write
|
|
7
|
+
scripts-binding:
|
|
8
|
+
- .torusguard/scripts/run_manager.py
|
|
9
|
+
- .torusguard/scripts/finding_scorer.py
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# TorusGuard Recheck — Targeted Differential Audit & Regression Verification
|
|
13
|
+
|
|
14
|
+
## Objective
|
|
15
|
+
Re-scan only files modified by remediation patches, confirming that targeted vulnerability sinks have been neutralized and verifying that no new security regressions were introduced.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Execution Steps
|
|
20
|
+
|
|
21
|
+
1. **Identify Modified Files:** Read `apply-log.json` from active run directory.
|
|
22
|
+
2. **Execute Differential Scan:** Re-run active `TG-*` rules exclusively against the modified files.
|
|
23
|
+
3. **Evaluate Finding Status:** Transition finding state according to transition rules below.
|
|
24
|
+
4. **Assert Regression-Free:** Ensure no new security warnings triggered on altered lines.
|
|
25
|
+
5. **Update State:** Record verified status in `findings.json`.
|
|
26
|
+
6. **Emit Recheck Report:** Save summary in `.torusguard/runs/<run_id>/recheck-report.md`.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## State Transition Rules
|
|
31
|
+
- **`Fixed`:** Targeted vulnerable AST pattern is absent and no new issues appear on modified lines.
|
|
32
|
+
- **`Partially Fixed`:** Vulnerability surface was reduced but sanitization remains incomplete.
|
|
33
|
+
- **`Not Fixed`:** Vulnerable AST sink remains present in patched file.
|
|
34
|
+
- **`Regression`:** Patch introduced a new security rule violation on modified lines.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Safety Constraints
|
|
39
|
+
- Restrict AST scan strictly to modified files and direct callers.
|
|
40
|
+
- If regression is detected, halt and recommend immediate rollback via `.bak` snapshot.
|
|
41
|
+
- Read-only differential analysis.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Output Format
|
|
46
|
+
```markdown
|
|
47
|
+
✅ [TorusGuard] Differential Recheck Completed
|
|
48
|
+
- Modified Files Scanned: <Count>
|
|
49
|
+
- Target Finding: <Finding ID> ──► FIXED
|
|
50
|
+
- Regressions Detected: 0
|
|
51
|
+
- Report: `.torusguard/runs/<run_id>/recheck-report.md`
|
|
52
|
+
Next: Run `/torusguard report` to export final SARIF and release summary.
|
|
53
|
+
```
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: torusguard-report
|
|
3
|
+
description: Generate unified security posture reports and export OASIS SARIF v2.1.0 logs for CI/CD integration.
|
|
4
|
+
version: 0.9.2
|
|
5
|
+
workflow: .torusguard/workflows/report.md
|
|
6
|
+
tools: Read, Grep, Glob, Write
|
|
7
|
+
scripts-binding:
|
|
8
|
+
- .torusguard/scripts/sarif_exporter.py
|
|
9
|
+
- .torusguard/scripts/run_manager.py
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# TorusGuard Report — Unified Security Posture Report & SARIF Export
|
|
13
|
+
|
|
14
|
+
## Objective
|
|
15
|
+
Aggregate findings, verification traces, and recheck results into a signed executive security summary and export schema-compliant OASIS SARIF v2.1.0 logs for CI/CD pipelines.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Execution Steps
|
|
20
|
+
|
|
21
|
+
1. **Aggregate Run Data:** Read findings, verified evidence, and recheck records from active run.
|
|
22
|
+
2. **Export OASIS SARIF v2.1.0:**
|
|
23
|
+
```bash
|
|
24
|
+
python .torusguard/scripts/sarif_exporter.py --run <run_dir> --output <run_dir>/results.sarif
|
|
25
|
+
```
|
|
26
|
+
3. **Compile Executive Markdown Report:** Generate `report.md` with posture score, open/closed finding tables, and risk breakdown.
|
|
27
|
+
4. **Update Run Manifest:** Finalize `manifest.json` status counts.
|
|
28
|
+
5. **Archive Release Artifacts:** Ensure `report.md` and `results.sarif` are serialized to disk.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## SARIF v2.1.0 Output Specification
|
|
33
|
+
- **Version:** `$schema: https://docs.oasis-open.org/sarif/sarif/v2.1.0/cos02/schemas/sarif-schema-2.1.0.json`, `version: 2.1.0`.
|
|
34
|
+
- **Tool Driver:** `name: TorusGuard`, `semanticVersion: 0.9.2`, full rules catalog in `driver.rules`.
|
|
35
|
+
- **Category Hygiene:** Set `automationDetails.id: "torusguard/static"` to avoid collisions in multi-analysis CI.
|
|
36
|
+
- **Fingerprinting:** Populate `partialFingerprints.primaryLocationLineHash` with SHA-256 context hash.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Safety Constraints
|
|
41
|
+
- Redact all tokens, passwords, and API keys before saving report.
|
|
42
|
+
- Strictly read-only reporting; no source code modifications.
|
|
43
|
+
- Ensure SARIF passes JSON schema validation.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Output Format
|
|
48
|
+
```markdown
|
|
49
|
+
📊 [TorusGuard] Security Posture Report Emitted
|
|
50
|
+
- Run ID: <Run ID> | Posture Score: <Score>/100
|
|
51
|
+
- Findings: <Total> (<Fixed> Fixed · <Open> Open)
|
|
52
|
+
- SARIF Export: `.torusguard/runs/<run_id>/results.sarif`
|
|
53
|
+
- Executive Report: `.torusguard/runs/<run_id>/report.md`
|
|
54
|
+
```
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: torusguard-status
|
|
3
|
+
description: Display current TorusGuard security posture, active configuration, rules catalog, and run history.
|
|
4
|
+
version: 0.9.2
|
|
5
|
+
workflow: .torusguard/workflows/status.md
|
|
6
|
+
tools: Read, Grep, Glob
|
|
7
|
+
scripts-binding:
|
|
8
|
+
- .torusguard/scripts/run_manager.py
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# TorusGuard Status — Workspace Security Posture & Diagnostic Overview
|
|
12
|
+
|
|
13
|
+
## Objective
|
|
14
|
+
Provide an instant diagnostic summary of the repository's security state, active framework rules, historical run results, and runtime scope validity.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Execution Steps
|
|
19
|
+
|
|
20
|
+
1. **Read Configuration:** Parse `.torusguard/config/torusguard.json` to verify initialization state and detected framework stack.
|
|
21
|
+
2. **Enumerate Active Rules:** Count rule files physically present in `.torusguard/rules/active/`.
|
|
22
|
+
3. **Inspect Run History:** List historical run folders in `.torusguard/runs/` via `run_manager.py`.
|
|
23
|
+
4. **Check Authorization Scope:** Check `.torusguard/config/scope.json` for active targets and TTL expiration.
|
|
24
|
+
5. **Render Diagnostic Overview:** Output formatted status card.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Safety Constraints
|
|
29
|
+
- Read-only execution; zero file modifications.
|
|
30
|
+
- Handle uninitialized workspaces gracefully with advice to run `/torusguard init`.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Output Format
|
|
35
|
+
```markdown
|
|
36
|
+
🛡️ [TorusGuard] Workspace Status Overview
|
|
37
|
+
- Version: v0.9.2 | Stack: <Detected Framework>
|
|
38
|
+
- Active Rules: <Count> rules active in `.torusguard/rules/active/`
|
|
39
|
+
- Historical Runs: <Count> runs recorded
|
|
40
|
+
- Scope: <Authorized (TTL Active) / Expired / Unconfigured>
|
|
41
|
+
- Posture: <SECURE / ACTION REQUIRED>
|
|
42
|
+
```
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: torusguard-verify
|
|
3
|
+
description: Verify finding evidence sufficiency, audit live code line matches, and calibrate 0–100 confidence scores.
|
|
4
|
+
version: 0.9.2
|
|
5
|
+
workflow: .torusguard/workflows/verify.md
|
|
6
|
+
tools: Read, Grep, Glob, Write
|
|
7
|
+
scripts-binding:
|
|
8
|
+
- .torusguard/scripts/finding_scorer.py
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# TorusGuard Verify — Finding Evidence Verification & Calibration
|
|
12
|
+
|
|
13
|
+
## Objective
|
|
14
|
+
Audit the evidence sufficiency of candidate findings by reading current disk lines, evaluating unbroken taint source-to-sink flow, filtering false alarms, and calibrating final 0–100 confidence scores.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Execution Steps
|
|
19
|
+
|
|
20
|
+
1. **Locate Target Findings:** Load active findings from `.torusguard/runs/<latest-run>/findings.md`.
|
|
21
|
+
2. **Live Disk Line Match:** Inspect exact cited lines using `view_file` to confirm code presence.
|
|
22
|
+
3. **Audit Evidence Sufficiency:** Verify source-to-sink flow against criteria below.
|
|
23
|
+
4. **Calibrate Confidence Score:**
|
|
24
|
+
```bash
|
|
25
|
+
python .torusguard/scripts/finding_scorer.py --run <run_dir> --verify
|
|
26
|
+
```
|
|
27
|
+
5. **Update State:** Mark finding as `Confirmed`, `Needs Review`, or `False Positive`.
|
|
28
|
+
6. **Emit Verified Evidence:** Save report in `.torusguard/runs/<run_id>/verified-evidence.md`.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Evidence Sufficiency
|
|
33
|
+
A finding is verified as sufficient when:
|
|
34
|
+
- **Direct AST Match:** The vulnerable API or sink call exists on disk at the cited location.
|
|
35
|
+
- **Exposed Surface:** The sink is reachable from an external route, view, or public method.
|
|
36
|
+
- **Absence of Sanitizer:** No escaping function, parameterization, or validating middleware neutralizes the input.
|
|
37
|
+
- **Taint Integrity:** Untrusted request data flows into the sink without structural validation.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Safety Constraints
|
|
42
|
+
- Read-only analysis; no files are modified.
|
|
43
|
+
- Never guess line numbers; always verify via active disk read.
|
|
44
|
+
- Downgrade findings with sanitizer presence to `False Positive`.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Output Format
|
|
49
|
+
```markdown
|
|
50
|
+
🧪 [TorusGuard] Finding Verification Complete
|
|
51
|
+
- Findings Audited: <Count> | Confirmed Real: <Count>
|
|
52
|
+
- False Positives Filtered: <Count> | Refined Mean Score: <Score>/100
|
|
53
|
+
- Artifact: `.torusguard/runs/<run_id>/verified-evidence.md`
|
|
54
|
+
Next: Run `/torusguard harden` to formulate surgical fixes for confirmed flaws.
|
|
55
|
+
```
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: torusguard-web-validate
|
|
3
|
+
description: Execute authorized HTTP probing against local/staging web applications — session capture, transparent audit headers, and secret redaction.
|
|
4
|
+
version: 0.9.2
|
|
5
|
+
workflow: .torusguard/workflows/web-validate.md
|
|
6
|
+
tools: Read, Grep, Glob, Bash, Write
|
|
7
|
+
scripts-binding:
|
|
8
|
+
- .torusguard/scripts/safety_gate.py
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# TorusGuard Web Validate — Bounded HTTP Probing & Session Capture
|
|
12
|
+
|
|
13
|
+
## Objective
|
|
14
|
+
Safely probe live web applications within authorized scope, injecting transparent audit headers, verifying security headers and cookies, redacting sensitive tokens, and recording deterministic replay traces.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Authorization Gate Check
|
|
19
|
+
Before dispatching any HTTP request:
|
|
20
|
+
1. Verify `.torusguard/config/scope.json` exists and contains target URL.
|
|
21
|
+
2. Confirm current timestamp is prior to `expires_at` TTL.
|
|
22
|
+
3. Assert target is local or non-production staging.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Safety Gate
|
|
27
|
+
All requests pass through `.torusguard/scripts/safety_gate.py`:
|
|
28
|
+
- `Auto-Allowed`: Read-only `GET`, `HEAD`, `OPTIONS` on non-sensitive paths.
|
|
29
|
+
- `Approval Required`: Requests touching auth, sessions, or parameters.
|
|
30
|
+
- `Manual Only`: Any destructive method (`DELETE`, `DROP`) is strictly blocked.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Execution Steps
|
|
35
|
+
|
|
36
|
+
1. **Gate Check:** Validate scope in `scope.json` and query `safety_gate.py`.
|
|
37
|
+
2. **Inject Audit Header:** Attach `X-TorusGuard-AuthID: <auth_id>` to all outbound requests.
|
|
38
|
+
3. **Dispatch Bounded Probe:** Send single non-destructive HTTP request.
|
|
39
|
+
4. **Validate Security Headers:** Check for CSP, HSTS, X-Content-Type-Options, and CORS configurations.
|
|
40
|
+
5. **Audit Cookie Flags:** Verify `HttpOnly`, `Secure`, and `SameSite` on session cookies.
|
|
41
|
+
6. **Capture Replay Trace:** Save sanitized trace in `.torusguard/runs/<run_id>/requests.json`.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Credential Redaction
|
|
46
|
+
All Bearer tokens, cookies, passwords, and API keys are redacted prior to disk serialization (`Bearer [REDACTED]`).
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Safety Constraints
|
|
51
|
+
- Max 50 requests per validation session.
|
|
52
|
+
- Never test unauthorized domains or third-party APIs.
|
|
53
|
+
- Zero state-changing destructive operations.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Output Format
|
|
58
|
+
```markdown
|
|
59
|
+
🌐 [TorusGuard] Web Validation Completed
|
|
60
|
+
- Target: <Host URL> | Endpoints Tested: <Count>
|
|
61
|
+
- Header Posture: <CSP/HSTS Status> | Cookies: <Flags Status>
|
|
62
|
+
- Replay Trace: `.torusguard/runs/<run_id>/requests.json`
|
|
63
|
+
Next: Run `/torusguard exploit-check` to confirm exploitability of candidate flaws.
|
|
64
|
+
```
|
|
@@ -0,0 +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.
|
|
@@ -0,0 +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`
|
|
@@ -0,0 +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}}`
|
|
@@ -0,0 +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}}
|