feat(tests): attack_success 3-value UI, data classification badge, reorder containment options
Aegis CI / lint-and-test (push) Has been cancelled
Snyk Security Scan / Python vulnerabilities (backend) (push) Has been cancelled
Snyk Security Scan / npm vulnerabilities (frontend) (push) Has been cancelled
Snyk Security Scan / Docker image vulnerabilities (backend) (push) Has been cancelled
Aegis CI / lint-and-test (push) Has been cancelled
Snyk Security Scan / Python vulnerabilities (backend) (push) Has been cancelled
Snyk Security Scan / npm vulnerabilities (frontend) (push) Has been cancelled
Snyk Security Scan / Docker image vulnerabilities (backend) (push) Has been cancelled
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import client from "./client";
|
||||
import type { AttackSuccessResult } from "../types/models";
|
||||
|
||||
// ── Types ───────────────────────────────────────────────────────────
|
||||
|
||||
@@ -42,7 +43,7 @@ export interface TestResultsReport {
|
||||
technique_id: string;
|
||||
state: string;
|
||||
platform: string | null;
|
||||
attack_success: boolean | null;
|
||||
attack_success: AttackSuccessResult | null;
|
||||
detection_result: string | null;
|
||||
red_validation_status: string | null;
|
||||
blue_validation_status: string | null;
|
||||
|
||||
@@ -3,6 +3,8 @@ import type {
|
||||
Test,
|
||||
TestResult,
|
||||
ContainmentResult,
|
||||
AttackSuccessResult,
|
||||
DataClassification,
|
||||
TestState,
|
||||
TestTimelineEntry,
|
||||
} from "../types/models";
|
||||
@@ -32,7 +34,7 @@ export interface RedUpdatePayload {
|
||||
description?: string;
|
||||
procedure_text?: string;
|
||||
tool_used?: string;
|
||||
attack_success?: boolean;
|
||||
attack_success?: AttackSuccessResult;
|
||||
red_summary?: string;
|
||||
execution_start_time?: string;
|
||||
execution_end_time?: string;
|
||||
@@ -137,6 +139,17 @@ export async function updateTest(
|
||||
return data;
|
||||
}
|
||||
|
||||
/** Update the data classification label for a test (admin only). */
|
||||
export async function updateTestClassification(
|
||||
testId: string,
|
||||
dataClassification: DataClassification,
|
||||
): Promise<Test> {
|
||||
const { data } = await client.patch<Test>(`/tests/${testId}/classification`, {
|
||||
data_classification: dataClassification,
|
||||
});
|
||||
return data;
|
||||
}
|
||||
|
||||
// ── Red Team ───────────────────────────────────────────────────────
|
||||
|
||||
/** Red Team updates their fields (draft, red_executing). */
|
||||
@@ -365,7 +378,7 @@ export interface RTEvidenceEntry {
|
||||
export interface RTTechniqueEntry {
|
||||
mitre_id: string;
|
||||
result: "detected" | "not_detected" | "partially_detected";
|
||||
attack_success: boolean;
|
||||
attack_success: AttackSuccessResult;
|
||||
platform?: string;
|
||||
notes?: string;
|
||||
evidence: RTEvidenceEntry[]; // required — at least 1 image
|
||||
@@ -382,7 +395,7 @@ export interface RTImportPayload {
|
||||
export interface RTImportResult {
|
||||
created: number;
|
||||
skipped: number;
|
||||
items: { mitre_id: string; test_name: string; result: string; attack_success: boolean; evidence_attached: number }[];
|
||||
items: { mitre_id: string; test_name: string; result: string; attack_success: AttackSuccessResult; evidence_attached: number }[];
|
||||
warnings: { mitre_id: string; reason: string }[];
|
||||
engagement: string;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
import { useState } from "react";
|
||||
import { ChevronDown, ChevronUp, Loader2, Lock } from "lucide-react";
|
||||
import type { DataClassification } from "../../types/models";
|
||||
|
||||
// ── Options ────────────────────────────────────────────────────────
|
||||
|
||||
const CLASSIFICATION_OPTIONS: { value: DataClassification; label: string; color: string }[] = [
|
||||
{ value: "public", label: "Public", color: "border-gray-500/30 bg-gray-800/50 text-gray-400" },
|
||||
{ value: "internal", label: "Internal", color: "border-blue-500/30 bg-blue-900/30 text-blue-400" },
|
||||
{ value: "sensitive", label: "Sensitive", color: "border-amber-500/30 bg-amber-900/30 text-amber-400" },
|
||||
{ value: "restricted", label: "Restricted", color: "border-red-500/30 bg-red-900/30 text-red-400" },
|
||||
];
|
||||
|
||||
// ── Props ──────────────────────────────────────────────────────────
|
||||
|
||||
interface DataClassificationBadgeProps {
|
||||
value: DataClassification;
|
||||
canEdit: boolean;
|
||||
isSaving: boolean;
|
||||
onChange: (value: DataClassification) => void;
|
||||
}
|
||||
|
||||
// ── Component ──────────────────────────────────────────────────────
|
||||
|
||||
export default function DataClassificationBadge({
|
||||
value,
|
||||
canEdit,
|
||||
isSaving,
|
||||
onChange,
|
||||
}: DataClassificationBadgeProps) {
|
||||
const [expanded, setExpanded] = useState(false);
|
||||
const current = CLASSIFICATION_OPTIONS.find((o) => o.value === value) ?? CLASSIFICATION_OPTIONS[1];
|
||||
|
||||
if (!canEdit) {
|
||||
return (
|
||||
<span
|
||||
className={`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[10px] font-medium ${current.color}`}
|
||||
>
|
||||
<Lock className="h-2.5 w-2.5" />
|
||||
{current.label}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="relative inline-block">
|
||||
<button
|
||||
onClick={() => setExpanded((v) => !v)}
|
||||
className={`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[10px] font-medium transition-colors hover:opacity-80 ${current.color}`}
|
||||
>
|
||||
<Lock className="h-2.5 w-2.5" />
|
||||
{current.label}
|
||||
{expanded ? <ChevronUp className="h-2.5 w-2.5" /> : <ChevronDown className="h-2.5 w-2.5" />}
|
||||
</button>
|
||||
|
||||
{expanded && (
|
||||
<div className="absolute left-0 top-full z-20 mt-1 w-44 rounded-lg border border-gray-700 bg-gray-900 p-1.5 shadow-xl">
|
||||
{isSaving ? (
|
||||
<div className="flex items-center justify-center py-2">
|
||||
<Loader2 className="h-4 w-4 animate-spin text-gray-500" />
|
||||
</div>
|
||||
) : (
|
||||
CLASSIFICATION_OPTIONS.map((opt) => (
|
||||
<button
|
||||
key={opt.value}
|
||||
onClick={() => {
|
||||
onChange(opt.value);
|
||||
setExpanded(false);
|
||||
}}
|
||||
className={`block w-full rounded px-2 py-1.5 text-left text-xs transition-colors ${
|
||||
opt.value === value
|
||||
? "bg-gray-800 text-white"
|
||||
: "text-gray-400 hover:bg-gray-800 hover:text-white"
|
||||
}`}
|
||||
>
|
||||
{opt.label}
|
||||
</button>
|
||||
))
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -18,6 +18,7 @@ import type {
|
||||
Test,
|
||||
TestResult,
|
||||
ContainmentResult,
|
||||
AttackSuccessResult,
|
||||
TeamSide,
|
||||
Evidence,
|
||||
TestTimelineEntry,
|
||||
@@ -61,11 +62,29 @@ const DETECTION_RESULTS: { value: TestResult; label: string; color: string }[] =
|
||||
];
|
||||
|
||||
// ── Containment result options ─────────────────────────────────────
|
||||
// Order matches Detection's full/none/partial pattern for consistency.
|
||||
|
||||
const CONTAINMENT_RESULTS: { value: ContainmentResult; label: string; color: string }[] = [
|
||||
{ value: "contained", label: "Contained", color: "border-green-500 bg-green-500/10 text-green-400" },
|
||||
{ value: "partially_contained", label: "Partially Contained", color: "border-yellow-500 bg-yellow-500/10 text-yellow-400" },
|
||||
{ value: "not_contained", label: "Not Contained", color: "border-red-500 bg-red-500/10 text-red-400" },
|
||||
{
|
||||
value: "partially_contained",
|
||||
label: "Partially Contained",
|
||||
color: "border-yellow-500 bg-yellow-500/10 text-yellow-400",
|
||||
},
|
||||
];
|
||||
|
||||
// ── Attack success options ──────────────────────────────────────────
|
||||
// Order matches Detection's full/none/partial pattern for consistency.
|
||||
|
||||
const ATTACK_SUCCESS_RESULTS: { value: AttackSuccessResult; label: string; color: string }[] = [
|
||||
{ value: "successful", label: "Yes", color: "border-green-500 bg-green-500/10 text-green-400" },
|
||||
{ value: "not_successful", label: "No", color: "border-red-500 bg-red-500/10 text-red-400" },
|
||||
{
|
||||
value: "partially_successful",
|
||||
label: "Partial",
|
||||
color: "border-yellow-500 bg-yellow-500/10 text-yellow-400",
|
||||
},
|
||||
];
|
||||
|
||||
// ── Props ──────────────────────────────────────────────────────────
|
||||
@@ -81,7 +100,7 @@ interface TeamTabsProps {
|
||||
redDraft: {
|
||||
procedure_text: string;
|
||||
tool_used: string;
|
||||
attack_success: boolean;
|
||||
attack_success: AttackSuccessResult | "";
|
||||
red_summary: string;
|
||||
execution_start_time: string;
|
||||
execution_end_time: string;
|
||||
@@ -233,28 +252,45 @@ export default function TeamTabs({
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Attack Success toggle */}
|
||||
{/* Attack Success */}
|
||||
<div>
|
||||
<label className="mb-1.5 block text-sm font-medium text-gray-300">
|
||||
<label className="mb-2 block text-sm font-medium text-gray-300">
|
||||
Attack Successful?
|
||||
</label>
|
||||
{canEditRed ? (
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{ATTACK_SUCCESS_RESULTS.map((opt) => (
|
||||
<button
|
||||
onClick={() => onRedFieldChange("attack_success", !redDraft.attack_success)}
|
||||
className={`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${
|
||||
redDraft.attack_success ? "bg-green-600" : "bg-gray-600"
|
||||
key={opt.value}
|
||||
onClick={() => onRedFieldChange("attack_success", opt.value)}
|
||||
className={`rounded-lg border px-3 py-2 text-sm font-medium transition-colors ${
|
||||
redDraft.attack_success === opt.value
|
||||
? opt.color
|
||||
: "border-gray-700 bg-gray-800 text-gray-400 hover:border-gray-600"
|
||||
}`}
|
||||
>
|
||||
<span
|
||||
className={`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${
|
||||
redDraft.attack_success ? "translate-x-6" : "translate-x-1"
|
||||
}`}
|
||||
/>
|
||||
{opt.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<span className={`text-sm ${test.attack_success ? "text-green-400" : "text-red-400"}`}>
|
||||
{test.attack_success === null ? "Not set" : test.attack_success ? "Yes" : "No"}
|
||||
<p className="text-sm">
|
||||
{test.attack_success ? (
|
||||
<span
|
||||
className={`inline-flex rounded-full border px-2.5 py-0.5 text-xs font-medium ${
|
||||
test.attack_success === "successful"
|
||||
? "border-green-500/30 bg-green-900/50 text-green-400"
|
||||
: test.attack_success === "not_successful"
|
||||
? "border-red-500/30 bg-red-900/50 text-red-400"
|
||||
: "border-yellow-500/30 bg-yellow-900/50 text-yellow-400"
|
||||
}`}
|
||||
>
|
||||
{ATTACK_SUCCESS_RESULTS.find((o) => o.value === test.attack_success)?.label}
|
||||
</span>
|
||||
) : (
|
||||
<span className="text-gray-500">Not set</span>
|
||||
)}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -660,12 +696,20 @@ export default function TeamTabs({
|
||||
<div>
|
||||
<dt className="text-xs font-medium uppercase text-gray-500">Attack Success</dt>
|
||||
<dd className="mt-0.5 text-sm">
|
||||
{test.attack_success === null ? (
|
||||
<span className="text-gray-500">Not set</span>
|
||||
) : test.attack_success ? (
|
||||
<span className="text-green-400">Yes</span>
|
||||
{test.attack_success ? (
|
||||
<span
|
||||
className={
|
||||
test.attack_success === "successful"
|
||||
? "text-green-400"
|
||||
: test.attack_success === "not_successful"
|
||||
? "text-red-400"
|
||||
: "text-yellow-400"
|
||||
}
|
||||
>
|
||||
{ATTACK_SUCCESS_RESULTS.find((o) => o.value === test.attack_success)?.label}
|
||||
</span>
|
||||
) : (
|
||||
<span className="text-red-400">No</span>
|
||||
<span className="text-gray-500">Not set</span>
|
||||
)}
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
@@ -18,8 +18,9 @@ import {
|
||||
} from "lucide-react";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import { requestDiscussion } from "../../api/tests";
|
||||
import type { Test, TestState, User } from "../../types/models";
|
||||
import type { Test, TestState, User, DataClassification } from "../../types/models";
|
||||
import LiveTimer from "./LiveTimer";
|
||||
import DataClassificationBadge from "./DataClassificationBadge";
|
||||
|
||||
// ── Progress steps ─────────────────────────────────────────────────
|
||||
|
||||
@@ -87,6 +88,8 @@ interface TestDetailHeaderProps {
|
||||
onHold: () => void;
|
||||
onResume: () => void;
|
||||
isTogglingHold: boolean;
|
||||
onUpdateClassification: (value: DataClassification) => void;
|
||||
isUpdatingClassification: boolean;
|
||||
}
|
||||
|
||||
// ── Component ──────────────────────────────────────────────────────
|
||||
@@ -109,6 +112,8 @@ export default function TestDetailHeader({
|
||||
onHold,
|
||||
onResume,
|
||||
isTogglingHold,
|
||||
onUpdateClassification,
|
||||
isUpdatingClassification,
|
||||
}: TestDetailHeaderProps) {
|
||||
const role = user?.role ?? "";
|
||||
const currentIdx = STATE_INDEX[test.state];
|
||||
@@ -524,6 +529,12 @@ export default function TestDetailHeader({
|
||||
>
|
||||
{getStateLabel(test)}
|
||||
</span>
|
||||
<DataClassificationBadge
|
||||
value={test.data_classification}
|
||||
canEdit={role === "admin"}
|
||||
isSaving={isUpdatingClassification}
|
||||
onChange={onUpdateClassification}
|
||||
/>
|
||||
</div>
|
||||
<p className="mt-1 text-sm text-gray-400">
|
||||
Created {formatDate(test.created_at)}
|
||||
|
||||
@@ -34,7 +34,7 @@ const TEMPLATE_JSON: RTImportPayload = {
|
||||
{
|
||||
mitre_id: "T1059.001",
|
||||
result: "detected",
|
||||
attack_success: true,
|
||||
attack_success: "successful",
|
||||
platform: "windows",
|
||||
notes: "PowerShell execution caught by Defender for Endpoint within 2 min",
|
||||
evidence: [
|
||||
@@ -48,7 +48,7 @@ const TEMPLATE_JSON: RTImportPayload = {
|
||||
{
|
||||
mitre_id: "T1078",
|
||||
result: "not_detected",
|
||||
attack_success: true,
|
||||
attack_success: "successful",
|
||||
platform: "windows",
|
||||
notes: "Credential reuse via stolen credentials — undetected for 48h",
|
||||
evidence: [
|
||||
@@ -67,7 +67,7 @@ const TEMPLATE_JSON: RTImportPayload = {
|
||||
{
|
||||
mitre_id: "T1486",
|
||||
result: "not_detected",
|
||||
attack_success: false,
|
||||
attack_success: "not_successful",
|
||||
platform: "windows",
|
||||
notes: "Ransomware blocked by AppLocker before execution",
|
||||
evidence: [
|
||||
@@ -81,7 +81,7 @@ const TEMPLATE_JSON: RTImportPayload = {
|
||||
{
|
||||
mitre_id: "T1190",
|
||||
result: "partially_detected",
|
||||
attack_success: true,
|
||||
attack_success: "partially_successful",
|
||||
platform: "linux",
|
||||
notes: "Exploit worked but only a partial alert fired — no full incident created",
|
||||
evidence: [
|
||||
@@ -231,7 +231,7 @@ export default function ImportRTPage() {
|
||||
["name", "string", "Engagement name"],
|
||||
["techniques[].mitre_id", "string", "e.g. T1059.001"],
|
||||
["techniques[].result", "enum", "detected | not_detected | partially_detected"],
|
||||
["techniques[].attack_success", "boolean", "Was the attack successful?"],
|
||||
["techniques[].attack_success", "enum", "successful | not_successful | partially_successful"],
|
||||
["techniques[].evidence", "array", "Min 1 image required per technique"],
|
||||
["techniques[].evidence[].filename", "string", "e.g. screenshot_edr.png"],
|
||||
["techniques[].evidence[].data", "string", "Base64-encoded image (PNG/JPG/GIF/WebP/BMP, max 10 MB)"],
|
||||
@@ -299,7 +299,7 @@ export default function ImportRTPage() {
|
||||
<textarea
|
||||
value={jsonText}
|
||||
onChange={(e) => handleTextChange(e.target.value)}
|
||||
placeholder={`Paste your JSON here or use the template…\n\n{\n "name": "Red Team Q1 2024",\n "techniques": [\n {\n "mitre_id": "T1059.001",\n "result": "detected",\n "attack_success": true\n }\n ]\n}`}
|
||||
placeholder={`Paste your JSON here or use the template…\n\n{\n "name": "Red Team Q1 2024",\n "techniques": [\n {\n "mitre_id": "T1059.001",\n "result": "detected",\n "attack_success": "successful"\n }\n ]\n}`}
|
||||
rows={14}
|
||||
className="w-full rounded-lg border border-gray-700 bg-gray-800 px-3 py-2.5 font-mono text-xs text-gray-200 placeholder-gray-600 focus:border-cyan-500 focus:outline-none resize-none"
|
||||
/>
|
||||
@@ -361,10 +361,13 @@ export default function ImportRTPage() {
|
||||
</span>
|
||||
</td>
|
||||
<td className="px-4 py-2.5">
|
||||
{t.attack_success
|
||||
? <span className="text-orange-400">Success</span>
|
||||
: <span className="text-gray-500">Blocked</span>
|
||||
}
|
||||
{t.attack_success === "successful" ? (
|
||||
<span className="text-orange-400">Success</span>
|
||||
) : t.attack_success === "partially_successful" ? (
|
||||
<span className="text-yellow-400">Partial</span>
|
||||
) : (
|
||||
<span className="text-gray-500">Blocked</span>
|
||||
)}
|
||||
</td>
|
||||
<td className="px-4 py-2.5 text-gray-400 capitalize">{t.platform ?? "—"}</td>
|
||||
<td className="px-4 py-2.5 text-gray-500 max-w-xs truncate">{t.notes ?? "—"}</td>
|
||||
|
||||
@@ -22,12 +22,13 @@ import {
|
||||
resumeTimer,
|
||||
holdTest,
|
||||
resumeTest,
|
||||
updateTestClassification,
|
||||
getTestTimeline,
|
||||
getRetestChain,
|
||||
} from "../api/tests";
|
||||
import { uploadEvidence, getEvidence } from "../api/evidence";
|
||||
import { useAuth } from "../context/AuthContext";
|
||||
import type { TestResult, ContainmentResult, TeamSide, TestTimelineEntry } from "../types/models";
|
||||
import type { TestResult, ContainmentResult, AttackSuccessResult, DataClassification, TeamSide, TestTimelineEntry } from "../types/models";
|
||||
|
||||
import TestDetailHeader from "../components/test-detail/TestDetailHeader";
|
||||
import TeamTabs from "../components/test-detail/TeamTabs";
|
||||
@@ -72,10 +73,17 @@ export default function TestDetailPage() {
|
||||
const [holdModal, setHoldModal] = useState(false);
|
||||
const [holdReason, setHoldReason] = useState("");
|
||||
|
||||
const [redDraft, setRedDraft] = useState({
|
||||
const [redDraft, setRedDraft] = useState<{
|
||||
procedure_text: string;
|
||||
tool_used: string;
|
||||
attack_success: AttackSuccessResult | "";
|
||||
red_summary: string;
|
||||
execution_start_time: string;
|
||||
execution_end_time: string;
|
||||
}>({
|
||||
procedure_text: "",
|
||||
tool_used: "",
|
||||
attack_success: false,
|
||||
attack_success: "",
|
||||
red_summary: "",
|
||||
execution_start_time: "",
|
||||
execution_end_time: "",
|
||||
@@ -131,7 +139,7 @@ export default function TestDetailPage() {
|
||||
setRedDraft({
|
||||
procedure_text: test.procedure_text || "",
|
||||
tool_used: test.tool_used || "",
|
||||
attack_success: test.attack_success ?? false,
|
||||
attack_success: test.attack_success ?? "",
|
||||
red_summary: test.red_summary || "",
|
||||
execution_start_time: isoToDatetimeLocal(test.execution_start_time),
|
||||
execution_end_time: isoToDatetimeLocal(test.execution_end_time),
|
||||
@@ -179,7 +187,7 @@ export default function TestDetailPage() {
|
||||
updateTestRed(testId!, {
|
||||
procedure_text: redDraft.procedure_text || undefined,
|
||||
tool_used: redDraft.tool_used || undefined,
|
||||
attack_success: redDraft.attack_success,
|
||||
attack_success: redDraft.attack_success || undefined,
|
||||
red_summary: redDraft.red_summary || undefined,
|
||||
execution_start_time: redDraft.execution_start_time || undefined,
|
||||
execution_end_time: redDraft.execution_end_time || undefined,
|
||||
@@ -351,6 +359,15 @@ export default function TestDetailPage() {
|
||||
onError: (err: unknown) => showToast(extractError(err), "error"),
|
||||
});
|
||||
|
||||
const updateClassificationMutation = useMutation({
|
||||
mutationFn: (value: DataClassification) => updateTestClassification(testId!, value),
|
||||
onSuccess: () => {
|
||||
invalidateAll();
|
||||
showToast("Data classification updated", "success");
|
||||
},
|
||||
onError: (err: unknown) => showToast(extractError(err), "error"),
|
||||
});
|
||||
|
||||
// Evidence upload
|
||||
const uploadMutation = useMutation({
|
||||
mutationFn: ({ file, team }: { file: File; team: TeamSide }) =>
|
||||
@@ -513,6 +530,8 @@ export default function TestDetailPage() {
|
||||
onHold={() => setHoldModal(true)}
|
||||
onResume={() => resumeHoldMutation.mutate()}
|
||||
isTogglingHold={holdMutation.isPending || resumeHoldMutation.isPending}
|
||||
onUpdateClassification={(value) => updateClassificationMutation.mutate(value)}
|
||||
isUpdatingClassification={updateClassificationMutation.isPending}
|
||||
/>
|
||||
|
||||
{/* Content: Tabs + Sidebar */}
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
Swords,
|
||||
} from "lucide-react";
|
||||
import { getTests } from "../api/tests";
|
||||
import type { Test, TestResult } from "../types/models";
|
||||
import type { Test, TestResult, AttackSuccessResult } from "../types/models";
|
||||
|
||||
/* ── Result helpers ─────────────────────────────────────────────────── */
|
||||
|
||||
@@ -41,19 +41,23 @@ function DetectionBadge({ result }: { result: TestResult | null | undefined }) {
|
||||
);
|
||||
}
|
||||
|
||||
function AttackBadge({ success }: { success: boolean | null | undefined }) {
|
||||
function AttackBadge({ success }: { success: AttackSuccessResult | null | undefined }) {
|
||||
if (success === null || success === undefined)
|
||||
return <span className="text-gray-600 text-xs">—</span>;
|
||||
const isSuccess = success === "successful";
|
||||
const isPartial = success === "partially_successful";
|
||||
return (
|
||||
<span
|
||||
className={`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium ${
|
||||
success
|
||||
isSuccess
|
||||
? "bg-orange-500/10 text-orange-400 border-orange-500/20"
|
||||
: isPartial
|
||||
? "bg-yellow-500/10 text-yellow-400 border-yellow-500/20"
|
||||
: "bg-gray-500/10 text-gray-400 border-gray-600/20"
|
||||
}`}
|
||||
>
|
||||
<Swords className="h-3 w-3" />
|
||||
{success ? "Success" : "Blocked"}
|
||||
{isSuccess ? "Success" : isPartial ? "Partial" : "Blocked"}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -60,6 +60,10 @@ export type TestResult = "detected" | "not_detected" | "partially_detected";
|
||||
|
||||
export type ContainmentResult = "contained" | "partially_contained" | "not_contained";
|
||||
|
||||
export type AttackSuccessResult = "successful" | "not_successful" | "partially_successful";
|
||||
|
||||
export type DataClassification = "public" | "internal" | "sensitive" | "restricted";
|
||||
|
||||
export type ValidationStatus = "pending" | "approved" | "rejected";
|
||||
|
||||
export type TeamSide = "red" | "blue";
|
||||
@@ -87,7 +91,7 @@ export interface Test {
|
||||
|
||||
// Red Team fields
|
||||
red_summary: string | null;
|
||||
attack_success: boolean | null;
|
||||
attack_success: AttackSuccessResult | null;
|
||||
execution_start_time: string | null;
|
||||
execution_end_time: string | null;
|
||||
red_validated_by: string | null;
|
||||
@@ -145,6 +149,9 @@ export interface Test {
|
||||
retest_of: string | null;
|
||||
retest_count: number;
|
||||
|
||||
// Data classification
|
||||
data_classification: DataClassification;
|
||||
|
||||
// Technique info (populated in list endpoints)
|
||||
technique_mitre_id: string | null;
|
||||
technique_name: string | null;
|
||||
|
||||
Reference in New Issue
Block a user