Open-source AI Security Operations Center: alert fusion, LLM-agent triage, MITRE ATT&CK investigation, and a replayable decision ledger for every agent step. Self-hostable, runs with no API keys, MIT licensed. Ships an MCP server for Claude, Cursor and Continue.
Python agentic-aiai-securityalert-triageblue-teamcybersecuritydetection-engineeringincident-responselanggraphllm-agentsmcpmitre-attackmodel-context-protocolpurple-teamsecurity-operationsself-hostedsiemsoarsocthreat-detectionthreat-intelligence
fix(web): reconcile dashboard merge artifacts after upstream v17 rebase
Alexandru Mateescub9c65606c90f
diff --git a/apps/web/src/components/cases/CaseWorkspace.tsx b/apps/web/src/components/cases/CaseWorkspace.tsxindex 6a80f3115..633bf41e4 100644--- a/apps/web/src/components/cases/CaseWorkspace.tsx+++ b/apps/web/src/components/cases/CaseWorkspace.tsx@@ -175,12 +175,7 @@ const STATUS_DOT: Record<CaseStatus, string> = {contained: 'bg-amber-400',resolved: 'bg-emerald-400',closed: 'bg-slate-600',- new: 'bg-slate-400',- triaged: 'bg-amber-400',- investigating: 'bg-blue-400 animate-pulse',- contained: 'bg-teal-400',- pending_closure: 'bg-violet-400',- cancelled: 'bg-slate-500'};+};const TASK_STATUS_BADGE: Record<CaseTask['status'], string> = {todo: 'bg-slate-500/15 text-slate-300 ring-slate-500/30',diff --git a/apps/web/src/components/cases/CaseWorkspaceHonesty.test.tsx b/apps/web/src/components/cases/CaseWorkspaceHonesty.test.tsxindex 5f0d10ab7..929e55203 100644--- a/apps/web/src/components/cases/CaseWorkspaceHonesty.test.tsx+++ b/apps/web/src/components/cases/CaseWorkspaceHonesty.test.tsx@@ -60,6 +60,8 @@ const casesApi = vi.hoisted(() => ({openAutoSummaryHtml: vi.fn(),downloadReportPdf: vi.fn(),getAttackChain: vi.fn(),+ getTimeline: vi.fn(),+ reopen: vi.fn(),}));vi.mock('@/lib/api', () => ({@@ -162,6 +164,10 @@ beforeEach(() => {swrErrors.clear();swrMutate.mockClear();for (const fn of Object.values(casesApi)) fn.mockReset();+ // Methods whose callers chain (.then/.catch) need a resolved default;+ // mockReset() alone would make them return undefined and explode.+ casesApi.getTimeline.mockResolvedValue({ events: [] });+ casesApi.getAttackChain.mockResolvedValue({ nodes: [], edges: [] });__setDemoModeForTests(false);});diff --git a/apps/web/src/components/dashboard/DashboardFirstPaint.test.tsx b/apps/web/src/components/dashboard/DashboardFirstPaint.test.tsxindex aa65a201d..480ea6342 100644--- a/apps/web/src/components/dashboard/DashboardFirstPaint.test.tsx+++ b/apps/web/src/components/dashboard/DashboardFirstPaint.test.tsx@@ -93,7 +93,6 @@ vi.mock('@/lib/realtime', () => ({}));import { DashboardView } from './DashboardView';-import { TimeWindowProvider } from '@/components/layout/TimeWindowProvider';/** Every panel claim that is a statement about measured data. */const MEASURED_CLAIMS = [@@ -117,7 +116,7 @@ afterEach(() => {describe('the dashboard does not report a result it has not got', () => {it('claims nothing on first paint, while the request is still in flight', () => {- swrLoading.add(`dashboard-metrics:24h`);+ swrLoading.add('dashboard-metrics');render(<TimeWindowProvider>@@ -134,7 +133,7 @@ describe('the dashboard does not report a result it has not got', () => {it('claims nothing when the response carried no alert totals', () => {// Not in flight, no error, and a payload the view cannot read. Equally// unmeasured, and the branch a plain `isLoading` check would miss.- swrData.set(`dashboard-metrics:24h`, { cases: { open: 0, inProgress: 0, resolvedThisWeek: 0 } });+ swrData.set('dashboard-metrics', { cases: { open: 0, inProgress: 0, resolvedThisWeek: 0 } });render(<TimeWindowProvider>@@ -149,7 +148,7 @@ describe('the dashboard does not report a result it has not got', () => {});it('still shows the failure when the request failed', () => {- swrErrors.set(`dashboard-metrics:24h`, new Error('503 Service Unavailable'));+ swrErrors.set('dashboard-metrics', new Error('503 Service Unavailable'));render(<TimeWindowProvider>@@ -164,7 +163,7 @@ describe('the dashboard does not report a result it has not got', () => {it('still reports a genuinely empty window as empty', () => {// The other direction. "Not loaded yet" everywhere forever would pass// every assertion above and tell an operator nothing.- swrData.set(`dashboard-metrics:24h`, {+ swrData.set('dashboard-metrics', {alerts: { total: 0, new: 0, critical: 0, high: 0, medium: 0, low: 0, info: 0, mttr: 0, mttr_sample_count: 0 },cases: { open: 0, inProgress: 0, resolvedThisWeek: 0 },sources: [],diff --git a/apps/web/src/components/dashboard/DashboardHonesty.test.tsx b/apps/web/src/components/dashboard/DashboardHonesty.test.tsxindex 3137a207c..12e9aa63d 100644--- a/apps/web/src/components/dashboard/DashboardHonesty.test.tsx+++ b/apps/web/src/components/dashboard/DashboardHonesty.test.tsx@@ -99,7 +99,6 @@ vi.mock('@/lib/realtime', () => ({}));import { DashboardView } from './DashboardView';-import { TimeWindowProvider } from '@/components/layout/TimeWindowProvider';import { SOCMetricsDashboard } from './SOCMetricsDashboard';/**@@ -140,7 +139,7 @@ afterEach(() => {describe('DashboardView — no fabricated data outside demo mode', () => {it('renders an error state, not a mock connector inventory, when the metrics API fails', () => {- swrErrors.set(`dashboard-metrics:24h`, new Error('503 Service Unavailable'));+ swrErrors.set('dashboard-metrics', new Error('503 Service Unavailable'));render(<TimeWindowProvider>@@ -154,7 +153,7 @@ describe('DashboardView — no fabricated data outside demo mode', () => {});it('does not invent a 1247-alert baseline when the API fails', () => {- swrErrors.set(`dashboard-metrics:24h`, new Error('network down'));+ swrErrors.set('dashboard-metrics', new Error('network down'));render(<TimeWindowProvider>@@ -170,7 +169,7 @@ describe('DashboardView — no fabricated data outside demo mode', () => {// A real, reachable API on a tenant that has alerts but no connectors,// no technique hits and no trend history yet. Previously each of these// empty arrays was swapped for the corresponding mock.- swrData.set(`dashboard-metrics:24h`, {+ swrData.set('dashboard-metrics', {alerts: { total: 4, new: 1, critical: 0, high: 2, medium: 1, low: 1, resolvedToday: 0, mttr: 11 },cases: { open: 0, inProgress: 0, resolvedThisWeek: 0 },sources: [],@@ -194,7 +193,7 @@ describe('DashboardView — no fabricated data outside demo mode', () => {});it('publishes no trend delta it cannot source from the API', () => {- swrData.set(`dashboard-metrics:24h`, {+ swrData.set('dashboard-metrics', {alerts: { total: 4, new: 1, critical: 0, high: 2, medium: 1, low: 1, resolvedToday: 0, mttr: 11 },cases: { open: 0, inProgress: 0, resolvedThisWeek: 0 },sources: [],@@ -385,7 +384,7 @@ describe('a mean over no samples is unmeasured, not zero', () => {it('does not label an hours figure as minutes on the operations strip', () => {// `alerts.mttr` is hours and the tile rendered it with an `m` suffix, so// a 1.5-hour MTTR would have read "1.5m" had it ever been non-zero.- swrData.set(`dashboard-metrics:24h`, {+ swrData.set('dashboard-metrics', {alerts: { total: 1, new: 1, critical: 0, high: 0, medium: 1, low: 0, resolvedToday: 0, mttr: 1.5, mttr_sample_count: 2 },cases: { open: 0, inProgress: 0, resolvedThisWeek: 0 },sources: [],@@ -405,7 +404,7 @@ describe('a mean over no samples is unmeasured, not zero', () => {});it('reports the operations strip MTTR as unmeasured when no case has closed', () => {- swrData.set(`dashboard-metrics:24h`, {+ swrData.set('dashboard-metrics', {alerts: { total: 1, new: 1, critical: 0, high: 0, medium: 1, low: 0, resolvedToday: 0, mttr: 0, mttr_sample_count: 0 },cases: { open: 0, inProgress: 0, resolvedThisWeek: 0 },sources: [],@@ -433,7 +432,7 @@ describe('demo mode still populates the dashboards', () => {__setDemoModeForTests(true);// In demo mode `demoFallback` supplies the mock as SWR fallbackData, which// the mocked SWR above models by seeding the same cache key.- swrData.set(`dashboard-metrics:24h`, {+ swrData.set('dashboard-metrics', {alerts: { total: 1247, new: 89, critical: 12, high: 43, medium: 156, low: 289, resolvedToday: 67, mttr: 42 },cases: { open: 23, inProgress: 15, resolvedThisWeek: 34 },sources: [{ name: 'CrowdStrike EDR', count: 412, status: 'active' }],diff --git a/apps/web/src/components/dashboard/DashboardView.tsx b/apps/web/src/components/dashboard/DashboardView.tsxindex a9085e353..baf7415b2 100644--- a/apps/web/src/components/dashboard/DashboardView.tsx+++ b/apps/web/src/components/dashboard/DashboardView.tsx@@ -18,6 +18,7 @@ import React, { Component, Suspense, type ErrorInfo, type ReactNode, useState, uimport useSWR from 'swr';import { metricsApi, type DashboardMetrics } from '@/lib/api';import { useTimeWindow } from '@/components/layout/TimeWindowProvider';+import { TIME_WINDOW_LONG_LABEL, TIME_WINDOW_SHORT_LABEL } from '@/lib/timeWindow';import { clsx } from 'clsx';import dynamic from 'next/dynamic';import Link from 'next/link';@@ -29,8 +30,6 @@ import { FunnelKpiBar } from './FunnelKpiBar';import { EfficiencyReport } from './EfficiencyReport';import { PipelineHealth } from './PipelineHealth';import { demoFallback } from '@/lib/demoFallback';-import { useTimeWindow } from '@/components/layout/TimeWindowProvider';-import { TIME_WINDOW_LONG_LABEL, TIME_WINDOW_SHORT_LABEL } from '@/lib/timeWindow';import { EmptyState } from '@/components/ui/EmptyState';import { ErrorState } from '@/components/ui/ErrorState';@@ -536,9 +535,9 @@ export function DashboardView() {const topMitre = metrics?.topMitre ?? [];const activeSourceCount = sources.filter((s) => s.status === 'active').length;- const periodLabel = TIME_WINDOW_SHORT_LABEL[metrics?.period ?? period];+ const periodLabel = TIME_WINDOW_SHORT_LABEL[timeWindow] ?? '';const trendTimeFmt =- (metrics?.period ?? period) === '7d' || (metrics?.period ?? period) === '30d'+ (timeWindow) === '7d' || (timeWindow) === '30d'? 'MMM d': 'HH:mm';const trendData = (metrics?.alertsTrend ?? []).map((d) => ({@@ -666,7 +665,7 @@ export function DashboardView() {pending={metricsPending}onRetry={retryMetrics}emptyTitle={`No alerts in the last ${TIME_WINDOW_LONG_LABEL[- metrics?.period ?? period+ timeWindow].replace(/^Last /, '')}`}emptyDescription="The volume curve plots alert counts once alerts start arriving."/>diff --git a/apps/web/src/components/dashboard/FunnelKpiBar.tsx b/apps/web/src/components/dashboard/FunnelKpiBar.tsxindex eee4d55ed..0216d6b25 100644--- a/apps/web/src/components/dashboard/FunnelKpiBar.tsx+++ b/apps/web/src/components/dashboard/FunnelKpiBar.tsx@@ -81,7 +81,10 @@ function formatPercent(ratio: number): string {* not.*/function formatDelta(deltaPercent: number | null): string {- if (deltaPercent === null || !Number.isFinite(deltaPercent)) return '—';+ // null means the previous window was empty: no baseline exists, and an+ // em-dash would read as "flat". Say it plainly.+ if (deltaPercent === null) return 'no baseline';+ if (!Number.isFinite(deltaPercent)) return '—';const rounded =Math.abs(deltaPercent) >= 10 ? Math.round(deltaPercent) : deltaPercent.toFixed(1);const sign = deltaPercent > 0 ? '+' : deltaPercent < 0 ? '−' : '';