feat(rt-import): import Red Team engagement results as validated tests

Backend — POST /tests/import-rt (red_lead + admin):
  Accepts engagement JSON with name/date/description/operator and
  a list of techniques each with mitre_id, result, attack_success,
  platform, notes. Creates one Test per technique directly in
  'validated' state (red + blue validation = approved) bypassing
  the normal workflow. Recalculates technique.status_global for
  all affected techniques. Returns created/skipped summary.

Frontend — /tests/import-rt (new dedicated page):
  - Format reference panel (collapsible) with field descriptions
  - Download template JSON button (generates a filled example)
  - Paste JSON textarea + file upload (.json)
  - Live validation + preview table showing what will be imported
  - Import button with spinner
  - Success / warning / error result display
  Accessible to admin and red_lead only.
  Added to sidebar under Tests > Import RT Results.
This commit is contained in:
kitos
2026-05-29 16:15:35 +02:00
parent 98e0f27172
commit 6021f0801c
5 changed files with 542 additions and 2 deletions
+2
View File
@@ -22,6 +22,7 @@ import {
GitCompareArrows,
ScrollText,
ClipboardCheck,
Upload,
} from "lucide-react";
import { useAuth } from "../context/AuthContext";
import { getTechniques } from "../api/techniques";
@@ -56,6 +57,7 @@ const mainLinks: NavItem[] = [
{ to: "/tests", label: "All Tests", icon: ListChecks },
{ to: "/tests/validated", label: "Validated Tests", icon: CheckCircle },
{ to: "/test-catalog", label: "Test Catalog", icon: BookOpen },
{ to: "/tests/import-rt", label: "Import RT Results", icon: Upload, roles: ["admin", "red_lead"] },
],
},
{ to: "/campaigns", label: "Campaigns", icon: Zap },