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,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
|
+
```
|