| from __future__ import annotations | |
| import json | |
| from pathlib import Path | |
| DEMO_DIR = Path(__file__).parent.parent / "demo_examples" | |
| DEMO_LABELS: dict[str, str] = { | |
| "demo_sg_open.json": "Security Group: Open SSH Ingress (Terraform)", | |
| "demo_s3_public.json": "S3 Bucket: Public Access Enabled (Terraform)", | |
| "demo_iam_wild.json": "IAM: Wildcard Permissions (Terraform)", | |
| "demo_rds_unencr.json": "RDS: Unencrypted Storage (Terraform)", | |
| "demo_k8s_root.json": "Kubernetes: Container Running as Root", | |
| } | |
| def load_demos() -> dict[str, dict]: | |
| result: dict[str, dict] = {} | |
| for fname, label in DEMO_LABELS.items(): | |
| path = DEMO_DIR / fname | |
| if path.exists(): | |
| result[label] = json.loads(path.read_text()) | |
| return result | |