Publish EventLens v1.1.0 (#1)
This commit was merged in pull request #1.
This commit is contained in:
1 parent
c0ade21029
commit
87432f3283
63 files changed
+7381
-1420
No files matched your search
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"printWidth": 120,
|
||||
"endOfLine": "auto"
|
||||
}
|
||||
@@ -7,12 +7,18 @@ test("workspace navigation and primary controls expose accessible state", async
|
||||
}
|
||||
await page.getByRole("button", { name: "Load demo", exact: true }).first().click();
|
||||
await page.getByRole("button", { name: "Timeline", exact: false }).click();
|
||||
await expect(page.getByRole("button", { name: "Timeline", exact: false }).first()).toHaveAttribute("aria-current", "page");
|
||||
await expect(page.getByRole("button", { name: "Timeline", exact: false }).first()).toHaveAttribute(
|
||||
"aria-current",
|
||||
"page",
|
||||
);
|
||||
await expect(page.getByRole("textbox", { name: "Search normalized evidence" })).toBeVisible();
|
||||
await expect(page.getByLabel("Filter by category")).toBeVisible();
|
||||
await expect(page.getByLabel("Filter by level")).toBeVisible();
|
||||
await expect(page.getByLabel("Filter by provider")).toBeVisible();
|
||||
await expect(page.getByRole("button", { name: "Previous evidence" })).toHaveAttribute("aria-label", "Previous evidence");
|
||||
await expect(page.getByRole("button", { name: "Previous evidence" })).toHaveAttribute(
|
||||
"aria-label",
|
||||
"Previous evidence",
|
||||
);
|
||||
await expect(page.getByRole("listitem").first()).toHaveAttribute("aria-setsize", /[0-9]+/);
|
||||
await page.getByRole("textbox", { name: "Search normalized evidence" }).focus();
|
||||
await page.keyboard.press("Tab");
|
||||
|
||||
@@ -7,11 +7,13 @@ test("malformed successful analysis keeps the previous investigation", async ({
|
||||
await page.getByRole("button", { name: "Load demo", exact: true }).first().click();
|
||||
await expect(page.getByRole("region", { name: "Current investigation context" })).toContainText("bundled-demo");
|
||||
|
||||
await page.route("**/api/analyze", (route) => route.fulfill({
|
||||
status: 200,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify({ source: "bad.evtx", events: [], incidents: [{ id: "broken" }] }),
|
||||
}));
|
||||
await page.route("**/api/analyze", (route) =>
|
||||
route.fulfill({
|
||||
status: 200,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify({ source: "bad.evtx", events: [], incidents: [{ id: "broken" }] }),
|
||||
}),
|
||||
);
|
||||
await page.locator('input[type="file"]').setInputFiles(validUpload);
|
||||
|
||||
await expect(page.getByRole("alert")).toContainText("Analysis returned an invalid response.");
|
||||
@@ -21,11 +23,15 @@ test("malformed successful analysis keeps the previous investigation", async ({
|
||||
});
|
||||
|
||||
test("structured parser errors have safe, useful wording", async ({ page }) => {
|
||||
await page.route("**/api/analyze", (route) => route.fulfill({
|
||||
status: 422,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify({ detail: { code: "no_readable_events", message: "No readable Windows events were found in this file." } }),
|
||||
}));
|
||||
await page.route("**/api/analyze", (route) =>
|
||||
route.fulfill({
|
||||
status: 422,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify({
|
||||
detail: { code: "no_readable_events", message: "No readable Windows events were found in this file." },
|
||||
}),
|
||||
}),
|
||||
);
|
||||
await page.goto("/#analysis");
|
||||
await page.locator('input[type="file"]').setInputFiles(validUpload);
|
||||
|
||||
@@ -40,13 +46,21 @@ test("rejecting an invalid file cancels an older pending analysis", async ({ pag
|
||||
|
||||
let routeStarted!: () => void;
|
||||
let releaseRoute!: () => void;
|
||||
const started = new Promise<void>((resolve) => { routeStarted = resolve; });
|
||||
const released = new Promise<void>((resolve) => { releaseRoute = resolve; });
|
||||
const started = new Promise<void>((resolve) => {
|
||||
routeStarted = resolve;
|
||||
});
|
||||
const released = new Promise<void>((resolve) => {
|
||||
releaseRoute = resolve;
|
||||
});
|
||||
await page.route("**/api/analyze", async (route) => {
|
||||
routeStarted();
|
||||
await released;
|
||||
try {
|
||||
await route.fulfill({ status: 200, contentType: "application/json", body: JSON.stringify({ source: "late.evtx", events: [], incidents: [] }) });
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify({ source: "late.evtx", events: [], incidents: [] }),
|
||||
});
|
||||
} catch {
|
||||
// The route can already be cancelled by the browser request abort.
|
||||
}
|
||||
|
||||
@@ -4,7 +4,9 @@ test("demo investigation workflow crosses Analysis, Timeline and Reports", async
|
||||
await page.goto("/#analysis");
|
||||
await expect(page.getByRole("heading", { name: "No event log loaded", exact: true })).toBeVisible();
|
||||
await page.getByRole("button", { name: "Load demo", exact: true }).first().click();
|
||||
await expect(page.getByRole("region", { name: "Current investigation context" }).getByText("bundled-demo", { exact: true })).toBeVisible();
|
||||
await expect(
|
||||
page.getByRole("region", { name: "Current investigation context" }).getByText("bundled-demo", { exact: true }),
|
||||
).toBeVisible();
|
||||
await expect(page.getByRole("heading", { name: "Incident windows", exact: true })).toBeVisible();
|
||||
await expect(page.getByText("Analysis status", { exact: true })).toBeVisible();
|
||||
await expect(page.getByText("Deterministic demo fixture", { exact: true })).toBeVisible();
|
||||
@@ -14,7 +16,9 @@ test("demo investigation workflow crosses Analysis, Timeline and Reports", async
|
||||
await page.getByText("Service failure recorded", { exact: true }).click();
|
||||
await expect(page).toHaveURL(/#timeline$/);
|
||||
await expect(page.getByRole("heading", { name: "Event timeline", exact: true })).toBeVisible();
|
||||
await expect(page.getByRole("heading", { name: "Example Sync Service terminated unexpectedly", exact: true })).toBeVisible();
|
||||
await expect(
|
||||
page.getByRole("heading", { name: "Example Sync Service terminated unexpectedly", exact: true }),
|
||||
).toBeVisible();
|
||||
await expect(page.getByText("Focus active", { exact: true })).toBeVisible();
|
||||
|
||||
const search = page.getByRole("textbox", { name: "Search normalized evidence" });
|
||||
|
||||
@@ -2,16 +2,62 @@ import { expect, test } from "@playwright/test";
|
||||
|
||||
const partialAnalysis = {
|
||||
source: "partial.evtx",
|
||||
events: [{ id: "1", timestamp: "2026-09-09T10:00:00Z", timestamp_source: "event", timestamp_valid: true, provider: "Synthetic", event_id: 1000, level: "error", channel: "Application", computer: "TEST-PC", category: "crash", summary: "Synthetic crash", fields: {} }],
|
||||
incidents: [{ id: "incident-1", rule_id: "windows.generic.attention", start: "2026-09-09T10:00:00Z", end: "2026-09-09T10:00:00Z", title: "Synthetic crash", category: "crash", severity: "warning", reasons: ["Parser retained only a partial result."], evidence_event_ids: ["1"], original_count: 1, compressed_count: 1 }],
|
||||
parse: { parser: "evtx-rs", status: "partial", parsed_events: 1, records_seen: 4, skipped_records: 2, issue_count: 1, truncated: true, truncation_reason: "event_limit_reached", duration_ms: 8, issues: [{ code: "event_limit_reached", record_id: 4, message: "later records were not analyzed", skipped_record: true }] },
|
||||
events: [
|
||||
{
|
||||
id: "1",
|
||||
timestamp: "2026-09-09T10:00:00Z",
|
||||
timestamp_source: "event",
|
||||
timestamp_valid: true,
|
||||
provider: "Synthetic",
|
||||
event_id: 1000,
|
||||
level: "error",
|
||||
channel: "Application",
|
||||
computer: "TEST-PC",
|
||||
category: "crash",
|
||||
summary: "Synthetic crash",
|
||||
fields: {},
|
||||
},
|
||||
],
|
||||
incidents: [
|
||||
{
|
||||
id: "incident-1",
|
||||
rule_id: "windows.generic.attention",
|
||||
start: "2026-09-09T10:00:00Z",
|
||||
end: "2026-09-09T10:00:00Z",
|
||||
title: "Synthetic crash",
|
||||
category: "crash",
|
||||
severity: "warning",
|
||||
reasons: ["Parser retained only a partial result."],
|
||||
evidence_event_ids: ["1"],
|
||||
original_count: 1,
|
||||
compressed_count: 1,
|
||||
},
|
||||
],
|
||||
parse: {
|
||||
parser: "evtx-rs",
|
||||
status: "partial",
|
||||
parsed_events: 1,
|
||||
records_seen: 4,
|
||||
skipped_records: 2,
|
||||
issue_count: 1,
|
||||
truncated: true,
|
||||
truncation_reason: "event_limit_reached",
|
||||
duration_ms: 8,
|
||||
issues: [
|
||||
{ code: "event_limit_reached", record_id: 4, message: "later records were not analyzed", skipped_record: true },
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
test("partial result is unmistakable and invalid extension is rejected", async ({ page }) => {
|
||||
await page.route("**/api/analyze", (route) => route.fulfill({ status: 200, contentType: "application/json", body: JSON.stringify(partialAnalysis) }));
|
||||
await page.route("**/api/analyze", (route) =>
|
||||
route.fulfill({ status: 200, contentType: "application/json", body: JSON.stringify(partialAnalysis) }),
|
||||
);
|
||||
await page.goto("/#analysis");
|
||||
await expect(page.getByRole("heading", { name: "Analysis", exact: true })).toBeVisible();
|
||||
await page.locator('input[type="file"]').setInputFiles({ name: "partial.evtx", mimeType: "application/octet-stream", buffer: Buffer.from("synthetic") });
|
||||
await page
|
||||
.locator('input[type="file"]')
|
||||
.setInputFiles({ name: "partial.evtx", mimeType: "application/octet-stream", buffer: Buffer.from("synthetic") });
|
||||
await expect(page.getByRole("alert")).toContainText("Partial analysis");
|
||||
await expect(page.getByRole("alert")).toContainText("incident reconstruction may be incomplete");
|
||||
await expect(page.getByText("event_limit_reached", { exact: true })).toBeVisible();
|
||||
@@ -20,6 +66,8 @@ test("partial result is unmistakable and invalid extension is rejected", async (
|
||||
await page.getByRole("button", { name: "Timeline", exact: false }).click();
|
||||
await expect(page.getByRole("alert")).toContainText("incident reconstruction may be incomplete");
|
||||
|
||||
await page.locator('input[type="file"]').setInputFiles({ name: "not-an-evtx.txt", mimeType: "text/plain", buffer: Buffer.from("nope") });
|
||||
await page
|
||||
.locator('input[type="file"]')
|
||||
.setInputFiles({ name: "not-an-evtx.txt", mimeType: "text/plain", buffer: Buffer.from("nope") });
|
||||
await expect(page.getByRole("alert").filter({ hasText: "Choose a Windows .evtx file." })).toBeVisible();
|
||||
});
|
||||
@@ -1,6 +1,6 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test("capture deterministic v1.0.6 portfolio views", async ({ page }) => {
|
||||
test("capture deterministic v1.1.0 portfolio views", async ({ page }) => {
|
||||
await page.goto("/#analysis");
|
||||
await page.getByRole("button", { name: "Load demo", exact: true }).first().click();
|
||||
await expect(page.getByRole("heading", { name: "Incident windows", exact: true })).toBeVisible();
|
||||
|
||||
@@ -1,9 +1,19 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test("core workspace actions remain usable across supported viewport widths", async ({ page }) => {
|
||||
// 7 viewports x 5 workspaces; the default 30 s is too tight on shared CI runners.
|
||||
test.setTimeout(90_000);
|
||||
await page.goto("/#analysis");
|
||||
await page.getByRole("button", { name: "Load demo", exact: true }).first().click();
|
||||
for (const viewport of [{ width: 360, height: 800 }, { width: 390, height: 844 }, { width: 768, height: 900 }, { width: 1024, height: 768 }, { width: 1366, height: 768 }, { width: 1440, height: 900 }, { width: 1920, height: 1080 }]) {
|
||||
for (const viewport of [
|
||||
{ width: 360, height: 800 },
|
||||
{ width: 390, height: 844 },
|
||||
{ width: 768, height: 900 },
|
||||
{ width: 1024, height: 768 },
|
||||
{ width: 1366, height: 768 },
|
||||
{ width: 1440, height: 900 },
|
||||
{ width: 1920, height: 1080 },
|
||||
]) {
|
||||
await page.setViewportSize(viewport);
|
||||
await expect(page.getByRole("button", { name: "Open .evtx", exact: true }).first()).toBeVisible();
|
||||
for (const workspace of ["Analysis", "Timeline", "Hunting", "Reports", "Settings"]) {
|
||||
|
||||
@@ -19,7 +19,9 @@ test("settings keeps session state and reports a persistence failure", async ({
|
||||
await expect(compact).toBeChecked();
|
||||
await expect(page.locator(".settings-save-feedback")).toHaveText("Preferences changed for this session only");
|
||||
await expect(page.getByText("Saved automatically in this browser", { exact: true })).toBeHidden();
|
||||
await expect(page.getByText("Preferences are available for this session only because browser storage is unavailable.")).toBeVisible();
|
||||
await expect(
|
||||
page.getByText("Preferences are available for this session only because browser storage is unavailable."),
|
||||
).toBeVisible();
|
||||
await expect(page.getByText("Not saved to browser storage")).toBeVisible();
|
||||
await expect(page.getByText("Interface preferences for this session")).toBeVisible();
|
||||
|
||||
|
||||
@@ -3,14 +3,29 @@ import { expect, test } from "@playwright/test";
|
||||
function largeAnalysis(count: number) {
|
||||
return {
|
||||
source: "synthetic-large.evtx",
|
||||
events: Array.from({ length: count }, (_, index) => ({ id: String(index), timestamp: "2026-09-09T10:00:00Z", timestamp_source: "event", timestamp_valid: true, provider: "Synthetic Provider", event_id: index, level: "warning", channel: "Application", computer: "TEST-PC", category: "other", summary: `Synthetic event ${index}`, fields: { message: `Synthetic event ${index}` } })),
|
||||
events: Array.from({ length: count }, (_, index) => ({
|
||||
id: String(index),
|
||||
timestamp: "2026-09-09T10:00:00Z",
|
||||
timestamp_source: "event",
|
||||
timestamp_valid: true,
|
||||
provider: "Synthetic Provider",
|
||||
event_id: index,
|
||||
level: "warning",
|
||||
channel: "Application",
|
||||
computer: "TEST-PC",
|
||||
category: "other",
|
||||
summary: `Synthetic event ${index}`,
|
||||
fields: { message: `Synthetic event ${index}` },
|
||||
})),
|
||||
incidents: [],
|
||||
};
|
||||
}
|
||||
|
||||
test("large timelines virtualize DOM rows and keep search usable", async ({ page }) => {
|
||||
const analysis = largeAnalysis(10_000);
|
||||
await page.route("**/api/demo", (route) => route.fulfill({ status: 200, contentType: "application/json", body: JSON.stringify(analysis) }));
|
||||
await page.route("**/api/demo", (route) =>
|
||||
route.fulfill({ status: 200, contentType: "application/json", body: JSON.stringify(analysis) }),
|
||||
);
|
||||
await page.goto("/#analysis");
|
||||
await page.getByRole("button", { name: "Load demo", exact: true }).first().click();
|
||||
await expect(page.getByText("10,000", { exact: false }).first()).toBeVisible();
|
||||
|
||||
@@ -48,7 +48,7 @@ test("Hunting combines facets and opens a result in the inspector", async ({ pag
|
||||
await page.getByRole("button", { name: "Hunting", exact: false }).click();
|
||||
|
||||
await page.getByRole("textbox", { name: "Search hunting evidence" }).fill("DNS name resolution");
|
||||
await expect(page.getByRole("status")).toHaveText("1 of 6 matching events");
|
||||
await expect(page.getByRole("status")).toHaveText("1 of 19 matching events");
|
||||
await expect(page.getByRole("button", { name: /DNS name resolution timed out/ })).toBeVisible();
|
||||
await page.getByRole("button", { name: /DNS name resolution timed out/ }).click();
|
||||
await expect(page.getByRole("heading", { name: "Inspector", exact: true })).toBeVisible();
|
||||
|
||||
Generated
+166
-153
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "eventlens-web",
|
||||
"version": "1.0.6",
|
||||
"version": "1.1.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "eventlens-web",
|
||||
"version": "1.0.6",
|
||||
"version": "1.1.0",
|
||||
"dependencies": {
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0"
|
||||
@@ -21,6 +21,7 @@
|
||||
"eslint-plugin-react": "^7.37.5",
|
||||
"eslint-plugin-react-hooks": "^7.1.1",
|
||||
"globals": "^17.12.0",
|
||||
"prettier": "3.6.2",
|
||||
"typescript": "^5.8.0",
|
||||
"typescript-eslint": "^8.70.1",
|
||||
"vite": "^6.0.0",
|
||||
@@ -932,6 +933,13 @@
|
||||
"url": "https://github.com/sponsors/nzakas"
|
||||
}
|
||||
},
|
||||
"node_modules/@isaacs/nonrecursive-glob-match": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@isaacs/nonrecursive-glob-match/-/nonrecursive-glob-match-1.1.0.tgz",
|
||||
"integrity": "sha512-GPm/Dbvk5RLmhRnxXIa7nTpK0xtl4E0wj0MslsuNiJ1FIROU+2+9lgUC/dgF7Ey4QCWhfEsgxilMRMCdHPfDfw==",
|
||||
"dev": true,
|
||||
"license": "BlueOak-1.0.0"
|
||||
},
|
||||
"node_modules/@jridgewell/gen-mapping": {
|
||||
"version": "0.3.13",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
|
||||
@@ -1460,17 +1468,17 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/eslint-plugin": {
|
||||
"version": "8.70.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.70.1.tgz",
|
||||
"integrity": "sha512-nDNrUQ/4ruSNYbu749TRY7cfrzPtoLHEXSNBI8aaNY32LlZCajixqRf3FqcKC4p5Cam4VOHYx/t+i5+nKXvrqA==",
|
||||
"version": "8.73.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.73.0.tgz",
|
||||
"integrity": "sha512-UkygMFer53Yzn29MCYFTHf34hGXf5KJhiDWfIm1tXtXRrym1CS6l5H9Y3yCtPWChpC0/f93H88gdj8tN0dd4kw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@eslint-community/regexpp": "^4.12.2",
|
||||
"@typescript-eslint/scope-manager": "8.70.1",
|
||||
"@typescript-eslint/type-utils": "8.70.1",
|
||||
"@typescript-eslint/utils": "8.70.1",
|
||||
"@typescript-eslint/visitor-keys": "8.70.1",
|
||||
"@typescript-eslint/scope-manager": "8.73.0",
|
||||
"@typescript-eslint/type-utils": "8.73.0",
|
||||
"@typescript-eslint/utils": "8.73.0",
|
||||
"@typescript-eslint/visitor-keys": "8.73.0",
|
||||
"ignore": "^7.0.5",
|
||||
"natural-compare": "^1.4.0",
|
||||
"ts-api-utils": "^2.5.0"
|
||||
@@ -1483,15 +1491,15 @@
|
||||
"url": "https://opencollective.com/typescript-eslint"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@typescript-eslint/parser": "^8.70.1",
|
||||
"@typescript-eslint/parser": "^8.73.0",
|
||||
"eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
|
||||
"typescript": ">=4.8.4 <6.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": {
|
||||
"version": "7.0.10",
|
||||
"resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.10.tgz",
|
||||
"integrity": "sha512-HpbUakT7xp5miBUywCHf36ZEuAJNklBJDDsGpUIjMzOSmM8ELSfA9Sa/QDPeNeqeoN31u+UTCkL4klCOVvRm4Q==",
|
||||
"version": "7.0.16",
|
||||
"resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.16.tgz",
|
||||
"integrity": "sha512-52N+Y4HRMOJmbLmr+DqO4iSRyyB7N52gm7PWCT6h0p978+oKbqHCB7gIJIwZvBUsjlSdWbrBFqUSmIFNZMpn0A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
@@ -1499,16 +1507,16 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/parser": {
|
||||
"version": "8.70.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.70.1.tgz",
|
||||
"integrity": "sha512-nO974WLllwhSFWQXnMLj6nDGa8f0khKEz1JzpPJ1u7Vm/4X1X6ZHajpoknU4bb41vJyMB0HHVyS2GqdhWfIXZw==",
|
||||
"version": "8.73.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.73.0.tgz",
|
||||
"integrity": "sha512-AuL45bVcmssHfZ3Di3cs9Q0l4gBm4ZFVrJOQEE7VpqW+PVgQaEwSwazz4TVIiFabXkk6U51EprYDwqw+HR8ePw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/scope-manager": "8.70.1",
|
||||
"@typescript-eslint/types": "8.70.1",
|
||||
"@typescript-eslint/typescript-estree": "8.70.1",
|
||||
"@typescript-eslint/visitor-keys": "8.70.1",
|
||||
"@typescript-eslint/scope-manager": "8.73.0",
|
||||
"@typescript-eslint/types": "8.73.0",
|
||||
"@typescript-eslint/typescript-estree": "8.73.0",
|
||||
"@typescript-eslint/visitor-keys": "8.73.0",
|
||||
"debug": "^4.4.3"
|
||||
},
|
||||
"engines": {
|
||||
@@ -1524,14 +1532,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/project-service": {
|
||||
"version": "8.70.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.70.1.tgz",
|
||||
"integrity": "sha512-62xOgboPfwc3/IgPSX/W6oQR3ZbF04194FPGUGH8HL8iLFHbt/456/8Ph1wLNUgVF+s94FlHoipBsz+v7+LMnA==",
|
||||
"version": "8.73.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.73.0.tgz",
|
||||
"integrity": "sha512-/pEf8Rc4Mjk+qJnY0uO1+Gadeal8uv50xpuic+srG2vIVatA0XxvWMUeMtFvs6OCHqftiQ7/+qH4aehG5stzIA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/tsconfig-utils": "^8.70.1",
|
||||
"@typescript-eslint/types": "^8.70.1",
|
||||
"@typescript-eslint/tsconfig-utils": "^8.73.0",
|
||||
"@typescript-eslint/types": "^8.73.0",
|
||||
"debug": "^4.4.3"
|
||||
},
|
||||
"engines": {
|
||||
@@ -1546,14 +1554,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/scope-manager": {
|
||||
"version": "8.70.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.70.1.tgz",
|
||||
"integrity": "sha512-Pa0EeSeAusQc1WbjQMac+YfenewYTBu0KjgYvkUKwhXaHUKbFog23Dm/rp0DX/6tyYOQ3Xl1a+3EcFNZynGHCw==",
|
||||
"version": "8.73.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.73.0.tgz",
|
||||
"integrity": "sha512-/TjD738Iq2rzj5z0ixVOi+TsvgjAzZPLPaH1yWdDBytR/HTR5gMpyYWZeCe5WTQZLwk3ho8AV7U3muoQCRtXBQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "8.70.1",
|
||||
"@typescript-eslint/visitor-keys": "8.70.1"
|
||||
"@typescript-eslint/types": "8.73.0",
|
||||
"@typescript-eslint/visitor-keys": "8.73.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
@@ -1564,9 +1572,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/tsconfig-utils": {
|
||||
"version": "8.70.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.70.1.tgz",
|
||||
"integrity": "sha512-jumze1fPI+sDOaM2TWGQdn39PDxTr7TZGeuyLkAbNyx2vtMT3uRnVKChN0hfht5V2TugphJzF6bYXvBcE09qqg==",
|
||||
"version": "8.73.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.73.0.tgz",
|
||||
"integrity": "sha512-lmtCFOfYaJfpqZywGuXi4FpNtE+NQ+YLe3T0K9rtEDcW8ZuGWvfI++pj8r05sYMI8vWT2CYK4rWyedmD6Rp4og==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
@@ -1581,15 +1589,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/type-utils": {
|
||||
"version": "8.70.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.70.1.tgz",
|
||||
"integrity": "sha512-7zKTnyvaVWqzLZHPFQtX1hVHqgkMC+WebPWakNCSyrQVbIP1AM0L0TlBZtACldIRb6PptI8Odk+jyZ5kP3B1VA==",
|
||||
"version": "8.73.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.73.0.tgz",
|
||||
"integrity": "sha512-MOC9i4xy1F7KcDde7Ip8jf1SrRiALb2Km4UWxGNjUE2YlhjIEo1ayE27GHIwIQyfWuHTmEonQT14uyurlyC6aA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "8.70.1",
|
||||
"@typescript-eslint/typescript-estree": "8.70.1",
|
||||
"@typescript-eslint/utils": "8.70.1",
|
||||
"@typescript-eslint/types": "8.73.0",
|
||||
"@typescript-eslint/typescript-estree": "8.73.0",
|
||||
"@typescript-eslint/utils": "8.73.0",
|
||||
"debug": "^4.4.3",
|
||||
"ts-api-utils": "^2.5.0"
|
||||
},
|
||||
@@ -1606,9 +1614,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/types": {
|
||||
"version": "8.70.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.70.1.tgz",
|
||||
"integrity": "sha512-Dm1ypdhhrGCTyyehxElhgJ6kgk8MVCv5qXdoOVqPr1uqk42jX8KjrZqhROvdShczA8qrDoYiOWn1ykWlx2k81Q==",
|
||||
"version": "8.73.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.73.0.tgz",
|
||||
"integrity": "sha512-O/1ytYzflF16QDKXx4/qOXg1IuZp+n7hr9t+S0nv7N/2Tl8rJiNCshztV1gcSUvHbPtoX3+zmNbtSAyVbzxVfw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
@@ -1620,18 +1628,18 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/typescript-estree": {
|
||||
"version": "8.70.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.70.1.tgz",
|
||||
"integrity": "sha512-TU8PwyGN0PQJUcE96mw8eCQ44SmxGdQlJmlWakHaHQ15eIuuvye5yNtmh/i6oS88jzXVQB71xdNkbkB/fMwL0g==",
|
||||
"version": "8.73.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.73.0.tgz",
|
||||
"integrity": "sha512-InjlBkSdWceIwIBWSwS3ENUp+i0O02PGX3Zv2wnihWJC1WDVGvG7mTHuf8b57uAaITj94d6tRPDH+sUEtXdRQQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/project-service": "8.70.1",
|
||||
"@typescript-eslint/tsconfig-utils": "8.70.1",
|
||||
"@typescript-eslint/types": "8.70.1",
|
||||
"@typescript-eslint/visitor-keys": "8.70.1",
|
||||
"@typescript-eslint/project-service": "8.73.0",
|
||||
"@typescript-eslint/tsconfig-utils": "8.73.0",
|
||||
"@typescript-eslint/types": "8.73.0",
|
||||
"@typescript-eslint/visitor-keys": "8.73.0",
|
||||
"debug": "^4.4.3",
|
||||
"minimatch": "^10.2.2",
|
||||
"minimatch": "^11.0.1",
|
||||
"semver": "^7.7.3",
|
||||
"tinyglobby": "^0.2.15",
|
||||
"ts-api-utils": "^2.5.0"
|
||||
@@ -1644,7 +1652,13 @@
|
||||
"url": "https://opencollective.com/typescript-eslint"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@typescript/native": "npm:typescript@>=7.1.0-dev.20261009.1 || >=7.1.0-beta <7.1.0-dev",
|
||||
"typescript": ">=4.8.4 <6.1.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@typescript/native": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/typescript-estree/node_modules/balanced-match": {
|
||||
@@ -1658,9 +1672,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": {
|
||||
"version": "5.0.12",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.12.tgz",
|
||||
"integrity": "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==",
|
||||
"version": "5.0.13",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.13.tgz",
|
||||
"integrity": "sha512-Vh3dmFbc4wZeox7M9I/0L9GfFd83Su4+yCck/OF9Gi/P/dAHn0RT7X4K9R7gMNMhDck3DvhR6QXsnQdjjgwNvQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
@@ -1671,25 +1685,26 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": {
|
||||
"version": "10.2.6",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz",
|
||||
"integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==",
|
||||
"version": "11.0.9",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-11.0.9.tgz",
|
||||
"integrity": "sha512-KCFkfyjqerNlSstjlhIGNXIKZGA/6O4V4RlhZ+Dsr621SPPw0mzlypE9D9ZOoPiVefHID+j7/XuMMlqfD/F60Q==",
|
||||
"dev": true,
|
||||
"license": "BlueOak-1.0.0",
|
||||
"dependencies": {
|
||||
"brace-expansion": "^5.0.8"
|
||||
"@isaacs/nonrecursive-glob-match": "^1.1.0",
|
||||
"brace-expansion": "^5.0.12"
|
||||
},
|
||||
"engines": {
|
||||
"node": "18 || 20 || >=22"
|
||||
"node": "20 || >=22"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/typescript-estree/node_modules/semver": {
|
||||
"version": "7.8.5",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz",
|
||||
"integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",
|
||||
"version": "7.8.6",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.6.tgz",
|
||||
"integrity": "sha512-9lpSSU4Mly3mrtruwLs1eLK6+gzbzqeBFwRNjIjE+9LuDpWdYctrQlQ3ej1Ilgi7gknpsTRnPoLP8DpCHqHIJw==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"bin": {
|
||||
@@ -1700,16 +1715,16 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/utils": {
|
||||
"version": "8.70.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.70.1.tgz",
|
||||
"integrity": "sha512-Esgul8MsnKnRLdYU2Eb2cRV9bS5HJYtKj1ByJnOzzG2M58DGdSUQ1jUuILxipqcpB2h9WLrbD5GijIWUjX/Tqw==",
|
||||
"version": "8.73.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.73.0.tgz",
|
||||
"integrity": "sha512-j2SVJJvVkXdUL0WcEzo4vEH1mO1vIi8KlVukcYA2MgMZvYN2LlZR4PmsW+GTSxSW24j6Q/EP7+MOifLtg5hmsA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.9.1",
|
||||
"@typescript-eslint/scope-manager": "8.70.1",
|
||||
"@typescript-eslint/types": "8.70.1",
|
||||
"@typescript-eslint/typescript-estree": "8.70.1"
|
||||
"@typescript-eslint/scope-manager": "8.73.0",
|
||||
"@typescript-eslint/types": "8.73.0",
|
||||
"@typescript-eslint/typescript-estree": "8.73.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
@@ -1724,13 +1739,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/visitor-keys": {
|
||||
"version": "8.70.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.70.1.tgz",
|
||||
"integrity": "sha512-Vwj9lUIW5Xq3wQ9w6gv3R86g1hMK8f2zNOdGTAgeXUMMXFK78G9ruCjjqutHMNJc0+CH7LYRnHeUB9IT8wFmcw==",
|
||||
"version": "8.73.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.73.0.tgz",
|
||||
"integrity": "sha512-k4lsFVpRZICbltkIEEH4hZRkwXkqDF1GHBpClKQOHQY+RkoZAAuyc1ci3I6p+CB6v3U4jaHIUshc4RzzQXZWLg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "8.70.1",
|
||||
"@typescript-eslint/types": "8.73.0",
|
||||
"eslint-visitor-keys": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
@@ -1755,22 +1770,22 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@vitest/mocker": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-5.0.0.tgz",
|
||||
"integrity": "sha512-66PGTMIiVJP3t4a5yxU9qPtf7MdTBs8jmToMvy+HVflB3Yy13WJZTtPePdvU+wjRV02SKK5doLbSA6o9pwOmiA==",
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-5.1.1.tgz",
|
||||
"integrity": "sha512-b2OgTB4+3ImWIVafXKazJXwLKwQxUNnix6b3xUvUTMh7RyXlrtzoxfZr8aEz9zkHOMAS4K5lu3TvFWoiVeVTQg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@jridgewell/trace-mapping": "0.3.31",
|
||||
"@vitest/spy": "5.0.0",
|
||||
"@vitest/spy": "5.1.1",
|
||||
"estree-walker": "^3.0.3",
|
||||
"magic-string": "^1.2.3"
|
||||
"magic-string": "^1.4.5"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/vitest"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"msw": "^2.4.9",
|
||||
"msw": "^2.4.9 || ^3.0.0",
|
||||
"vite": "^6.0.0 || ^7.0.0 || ^8.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
@@ -1783,9 +1798,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@vitest/spy": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-5.0.0.tgz",
|
||||
"integrity": "sha512-uy+luWBAPw9XfthoHi5AkfHUnuPYEESjl0p/r+meoBnU8bxg5GDQ3Ey8MjcJ6sqahkL4PFyrvfMJJBw7LbU06g==",
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-5.1.1.tgz",
|
||||
"integrity": "sha512-6K8C6alQG1/Yc8/ZI22iJS7JEsxPdVzqtqDq+/xM4Z0mGVykemMVjLhqMy/q6/IHYG3kKD8hKSwRen/ZdyI9vQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
@@ -2213,9 +2228,9 @@
|
||||
"license": "CC-BY-4.0"
|
||||
},
|
||||
"node_modules/chai": {
|
||||
"version": "6.2.2",
|
||||
"resolved": "https://registry.npmjs.org/chai/-/chai-6.2.2.tgz",
|
||||
"integrity": "sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==",
|
||||
"version": "6.3.0",
|
||||
"resolved": "https://registry.npmjs.org/chai/-/chai-6.3.0.tgz",
|
||||
"integrity": "sha512-XWAtwJ6OHO+tj0EKCs0Y2UamnyOxseZWltU4x2U2wh8g4AigdjwvtUjvLP2tqkA/avxHEtzxNaqGq/YGNwckKg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
@@ -4063,9 +4078,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/magic-string": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.3.1.tgz",
|
||||
"integrity": "sha512-rm91zr2Ou+XueDTohjQQjdQEcYM6zVi8KVUCG8Ec3vHwUEKrhSdCNyfuIywkA6hcCAteIn0ZOtAHA6eGpiX+Pg==",
|
||||
"version": "1.4.5",
|
||||
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.5.tgz",
|
||||
"integrity": "sha512-oLLC2+YvQUfAa+vxoufE/yc1icb87M9iXIRqAoR/2EhE/8cb3SF/+Gi0c2By1B+5Vz2e2vQtUvHiu1+63Znh+w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
@@ -4266,9 +4281,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/obug": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/obug/-/obug-2.2.1.tgz",
|
||||
"integrity": "sha512-XrsrhT5sybtKI6wakr2SPOlGZWWYbUXZ7a0jT8/QOeAPau+1X/bSegNe5YR75oJmEZQbKningirmGOEJCIk61Q==",
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/obug/-/obug-3.0.0.tgz",
|
||||
"integrity": "sha512-5vvB5+W7ePv+p3uqxi+RcW1XAzLW0/hxt3/4X4Lc4qHudzOhmBiBwOY6DRob4WnanAEGvNcLjF+KNOufrUoEQw==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
"https://github.com/sponsors/sxzz",
|
||||
@@ -4486,6 +4501,22 @@
|
||||
"node": ">= 0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/prettier": {
|
||||
"version": "3.6.2",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.6.2.tgz",
|
||||
"integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"prettier": "bin/prettier.cjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/prettier/prettier?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/prop-types": {
|
||||
"version": "15.8.1",
|
||||
"resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz",
|
||||
@@ -4879,34 +4910,20 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/siginfo": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz",
|
||||
"integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==",
|
||||
"dev": true,
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/source-map-js": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
|
||||
"integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.4.tgz",
|
||||
"integrity": "sha512-J7ZjMvHd9O1fcT/5V09QWaaSl2BbWx3F6O08spde82Namf9UB0GxRVIPiNbVsdKkoizHiSpTodo3vp2bAy91MA==",
|
||||
"dev": true,
|
||||
"license": "BSD-3-Clause",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/stackback": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz",
|
||||
"integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/std-env": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/std-env/-/std-env-4.2.0.tgz",
|
||||
"integrity": "sha512-oCUKSupKTHX53EyjDtuZQ64pjLJ6yYCtpmEw0goYxtjG9KpbRe8KAsl2tBUGU9DyMcJ0RwJ8GqJAFzMXcXW1Rw==",
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/std-env/-/std-env-4.3.0.tgz",
|
||||
"integrity": "sha512-OtU/EgQ1kIm5KwqQpBC6ZEMXrZRui11w8zgfTWp8cdO9B8OaPsbA8bTHO2P+HNo1VlUTGMVBwPhydu6poeXiag==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
@@ -5078,9 +5095,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/tinybench": {
|
||||
"version": "6.1.4",
|
||||
"resolved": "https://registry.npmjs.org/tinybench/-/tinybench-6.1.4.tgz",
|
||||
"integrity": "sha512-9APumHG7r4yOk4X4WlkmE71aZcv1gvin1czO3OQ1U9iJcFA5Ja/ygyb0vPOVHTthFozUYs8CLoLUlM8grb2lTQ==",
|
||||
"version": "6.2.4",
|
||||
"resolved": "https://registry.npmjs.org/tinybench/-/tinybench-6.2.4.tgz",
|
||||
"integrity": "sha512-SQ52jEncXxbMCzJuY2A/jGIbbAu6NYsBWW7grz2pNE+EnzQdoGaoBfpk4qC/opE7qiUcGmGgaGIz5EoHdS1O9w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
@@ -5088,9 +5105,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/tinyexec": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.3.0.tgz",
|
||||
"integrity": "sha512-QKAl9m8gWWGHV8jZcPeym6j+XULi6tOf1mT83WYJ4Lk2ytW/uwAWkrP0uFsdoYMdueVJ0qs26wZ+23xeB4ibNQ==",
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.3.1.tgz",
|
||||
"integrity": "sha512-GCvB3aoys96IuDFBMcTB46JOR6mdMtAToqwiW8JlWhsoh1mhHi/xn9ss/Dg7N555GiJyEt2qzoG/NHCwM6h1EA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
@@ -5232,16 +5249,16 @@
|
||||
}
|
||||
},
|
||||
"node_modules/typescript-eslint": {
|
||||
"version": "8.70.1",
|
||||
"resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.70.1.tgz",
|
||||
"integrity": "sha512-AcWG7KDjZ2THNXsgwttMaGmzVi0VFRlFYfqFHYQRbDpF3owuYbuiL8c7UUrd2k8s3PoSfIQrWfrGXfcElrWLYA==",
|
||||
"version": "8.73.0",
|
||||
"resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.73.0.tgz",
|
||||
"integrity": "sha512-+EnKy9rkYPun4l+kG2bDuYWQ6y1tGVgdR/tY1U9AC6h21CjEwOoc7gsjwe0FXB8uWFzk4QiCFbuRWgX758PiAg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "8.70.1",
|
||||
"@typescript-eslint/parser": "8.70.1",
|
||||
"@typescript-eslint/typescript-estree": "8.70.1",
|
||||
"@typescript-eslint/utils": "8.70.1"
|
||||
"@typescript-eslint/eslint-plugin": "8.73.0",
|
||||
"@typescript-eslint/parser": "8.73.0",
|
||||
"@typescript-eslint/typescript-estree": "8.73.0",
|
||||
"@typescript-eslint/utils": "8.73.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
@@ -5316,9 +5333,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/vite": {
|
||||
"version": "6.4.3",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-6.4.3.tgz",
|
||||
"integrity": "sha512-NTKlcQjlAK7MlQoyb6LgaqHc8sso/pVyUJYWMws3jg21uTJw/LddqIFPcPqP6PzpgbIcZyKI85sFE4HBrQDA8A==",
|
||||
"version": "6.4.6",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-6.4.6.tgz",
|
||||
"integrity": "sha512-RtsraAwEG68idOA6iUOoIpOlcSKROnf815aIq9qHTSrDNpLoBrBa12suyfcEd8qn0xwOVQI1Yhm1GbmTjF600A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
@@ -5391,25 +5408,25 @@
|
||||
}
|
||||
},
|
||||
"node_modules/vitest": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vitest/-/vitest-5.0.0.tgz",
|
||||
"integrity": "sha512-gpsMNoRhMjMktVxPtstOH4/PJuPyovVaMDr4oDilXaGH1EcqM2OE96SoHT2VIQ6fTGtTjqmHDrEu2X9RQiXf8Q==",
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/vitest/-/vitest-5.1.1.tgz",
|
||||
"integrity": "sha512-trVmzUFOSraCZcI3uZIMD5FqBh4atFkC/XuJP/IU7qtyQay0FCs3Ia+0QiQ2JJwGyWG/xrcBoJNel2+O7kEZ0g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/chai": "^5.2.2",
|
||||
"@vitest/mocker": "5.0.0",
|
||||
"chai": "^6.2.2",
|
||||
"@vitest/mocker": "5.1.1",
|
||||
"chai": "^6.3.0",
|
||||
"es-module-lexer": "^2.3.2",
|
||||
"expect-type": "^1.4.0",
|
||||
"magic-string": "^1.2.3",
|
||||
"obug": "^2.1.4",
|
||||
"magic-string": "^1.4.5",
|
||||
"obug": "^3.0.0",
|
||||
"picomatch": "^4.0.7",
|
||||
"std-env": "^4.2.0",
|
||||
"tinybench": "6.1.4",
|
||||
"tinyexec": "1.3.0",
|
||||
"std-env": "^4.3.0",
|
||||
"tinybench": "^6.2.3",
|
||||
"tinyexec": "^1.3.1",
|
||||
"tinyglobby": "^0.2.17",
|
||||
"why-is-node-running": "^2.3.0"
|
||||
"why-is-node-running": "3.2.1"
|
||||
},
|
||||
"bin": {
|
||||
"vitest": "vitest.mjs"
|
||||
@@ -5424,12 +5441,12 @@
|
||||
"@edge-runtime/vm": "*",
|
||||
"@opentelemetry/api": "^1.9.0",
|
||||
"@types/node": "^22.0.0 || >=24.0.0",
|
||||
"@vitest/browser-playwright": "5.0.0",
|
||||
"@vitest/browser-preview": "5.0.0",
|
||||
"@vitest/browser-playwright": "5.1.1",
|
||||
"@vitest/browser-preview": "5.1.1",
|
||||
"@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0",
|
||||
"@vitest/coverage-istanbul": "5.0.0",
|
||||
"@vitest/coverage-v8": "5.0.0",
|
||||
"@vitest/ui": "5.0.0",
|
||||
"@vitest/coverage-istanbul": "5.1.1",
|
||||
"@vitest/coverage-v8": "5.1.1",
|
||||
"@vitest/ui": "5.1.1",
|
||||
"happy-dom": "*",
|
||||
"jsdom": "*",
|
||||
"vite": "^6.4.0 || ^7.0.0 || ^8.0.0"
|
||||
@@ -5579,20 +5596,16 @@
|
||||
}
|
||||
},
|
||||
"node_modules/why-is-node-running": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz",
|
||||
"integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==",
|
||||
"version": "3.2.1",
|
||||
"resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-3.2.1.tgz",
|
||||
"integrity": "sha512-Tb2FUhB4vUsGQlfSquQLYkApkuPAFQXGFzxWKHHumVz2dK+X1RUm/HnID4+TfIGYJ1kTcwOaCk/buYCEJr6YjQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"siginfo": "^2.0.0",
|
||||
"stackback": "0.0.2"
|
||||
},
|
||||
"bin": {
|
||||
"why-is-node-running": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
"node": ">=20.11"
|
||||
}
|
||||
},
|
||||
"node_modules/word-wrap": {
|
||||
@@ -5626,9 +5639,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/zod": {
|
||||
"version": "4.6.5",
|
||||
"resolved": "https://registry.npmjs.org/zod/-/zod-4.6.5.tgz",
|
||||
"integrity": "sha512-v5l/aFXZQeai4awLbOpSoHecE9UiMrnfx75tEXLjNonXVARxQ5mOeipTjROUchszUNCqnE+hqAMujRsRHsut2Q==",
|
||||
"version": "4.6.7",
|
||||
"resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz",
|
||||
"integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
{
|
||||
"name": "eventlens-web",
|
||||
"version": "1.0.6",
|
||||
"version": "1.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"lint": "eslint src",
|
||||
"lint": "eslint src && prettier --check src e2e",
|
||||
"build": "tsc --noEmit && vite build",
|
||||
"test": "vitest run --passWithNoTests",
|
||||
"test:e2e": "playwright test"
|
||||
"test:e2e": "playwright test",
|
||||
"format": "prettier --write src e2e"
|
||||
},
|
||||
"dependencies": {
|
||||
"react": "^19.0.0",
|
||||
@@ -23,6 +24,7 @@
|
||||
"eslint-plugin-react": "^7.37.5",
|
||||
"eslint-plugin-react-hooks": "^7.1.1",
|
||||
"globals": "^17.12.0",
|
||||
"prettier": "3.6.2",
|
||||
"typescript": "^5.8.0",
|
||||
"typescript-eslint": "^8.70.1",
|
||||
"vite": "^6.0.0",
|
||||
|
||||
+341
-68
@@ -1,9 +1,25 @@
|
||||
import { type ChangeEvent, type DragEvent, useEffect, useMemo, useRef, useState } from "react";
|
||||
import { analysisToMarkdown, prepareExport } from "../export";
|
||||
import { type ChangeEvent, type DragEvent, useDeferredValue, useEffect, useMemo, useRef, useState } from "react";
|
||||
import { markdownFromPrepared, prepareExport, type PreparedExport } from "../export";
|
||||
import { redactInBackground } from "../redactClient";
|
||||
import type { RedactionSummary } from "../redact";
|
||||
import { analysisIndex } from "./indexes";
|
||||
import { filterEvents, uniqueProviders, type EventFilters } from "../filter";
|
||||
import type { Analysis, EventItem, Incident } from "../types";
|
||||
import { downloadText, exportStem } from "./format";
|
||||
import { DEFAULT_SETTINGS, EMPTY_FILTERS, EMPTY_HUNTING, ROW_HEIGHTS, SETTINGS_KEY, readSettings, type FilterState, type HuntingState, type InspectorTab, type UiSettings, type Workspace, workspaceFromHash } from "./model";
|
||||
import {
|
||||
DEFAULT_SETTINGS,
|
||||
EMPTY_FILTERS,
|
||||
EMPTY_HUNTING,
|
||||
ROW_HEIGHTS,
|
||||
SETTINGS_KEY,
|
||||
readSettings,
|
||||
type FilterState,
|
||||
type HuntingState,
|
||||
type InspectorTab,
|
||||
type UiSettings,
|
||||
type Workspace,
|
||||
workspaceFromHash,
|
||||
} from "./model";
|
||||
import { isAnalysis } from "./validation";
|
||||
import { AppTopbar, GlobalActions, InvestigationContext, Statusbar } from "../components/shell";
|
||||
import { ErrorBanner, ParserIssueNotice, PartialAnalysisWarning } from "../components/states";
|
||||
@@ -13,7 +29,10 @@ import { ReportsView } from "../workspaces/ReportsView";
|
||||
import { SettingsView } from "../workspaces/SettingsView";
|
||||
import { TimelineView } from "../workspaces/TimelineView";
|
||||
|
||||
const API = (import.meta.env.VITE_API_BASE_URL ?? (import.meta.env.DEV ? "http://127.0.0.1:8000" : "")).replace(/\/$/, "");
|
||||
const API = (import.meta.env.VITE_API_BASE_URL ?? (import.meta.env.DEV ? "http://127.0.0.1:8000" : "")).replace(
|
||||
/\/$/,
|
||||
"",
|
||||
);
|
||||
const APP_VERSION = import.meta.env.VITE_EVENTLENS_VERSION ?? "development";
|
||||
|
||||
function analysisErrorMessage(status: number, body: unknown): string {
|
||||
@@ -30,7 +49,9 @@ function analysisErrorMessage(status: number, body: unknown): string {
|
||||
|
||||
export function App() {
|
||||
const [settings, setSettings] = useState<UiSettings>(readSettings);
|
||||
const [activeWorkspace, setActiveWorkspace] = useState<Workspace>(() => workspaceFromHash() ?? readSettings().defaultWorkspace);
|
||||
const [activeWorkspace, setActiveWorkspace] = useState<Workspace>(
|
||||
() => workspaceFromHash() ?? readSettings().defaultWorkspace,
|
||||
);
|
||||
const [data, setData] = useState<Analysis | null>(null);
|
||||
const [selectedEventId, setSelectedEventId] = useState<string | null>(null);
|
||||
const [activeIncidentId, setActiveIncidentId] = useState("");
|
||||
@@ -45,6 +66,9 @@ export function App() {
|
||||
const [settingsNotice, setSettingsNotice] = useState("");
|
||||
const [settingsPersistenceFailed, setSettingsPersistenceFailed] = useState(false);
|
||||
const [settingsStorageConfirmed, setSettingsStorageConfirmed] = useState(false);
|
||||
const [redactionPreview, setRedactionPreview] = useState<{ data: Analysis; summary: RedactionSummary } | null>(null);
|
||||
const [redactionFailed, setRedactionFailed] = useState(false);
|
||||
const [exporting, setExporting] = useState(false);
|
||||
const fileInput = useRef<HTMLInputElement>(null);
|
||||
const requestRef = useRef<AbortController | null>(null);
|
||||
|
||||
@@ -83,37 +107,87 @@ export function App() {
|
||||
setActiveWorkspace(workspace);
|
||||
};
|
||||
|
||||
const activeIncident = useMemo(() => data?.incidents.find((incident) => incident.id === activeIncidentId) ?? null, [data, activeIncidentId]);
|
||||
const selected = useMemo(() => data?.events.find((event) => event.id === selectedEventId) ?? null, [data, selectedEventId]);
|
||||
const evidenceIds = useMemo(() => focusIncident && activeIncident ? new Set(activeIncident.evidence_event_ids) : null, [focusIncident, activeIncident]);
|
||||
const index = useMemo(() => (data ? analysisIndex(data) : null), [data]);
|
||||
// Filtering 100,000 events runs at a lower priority than typing, so inputs stay responsive.
|
||||
const deferredFilters = useDeferredValue(filters);
|
||||
const deferredHunting = useDeferredValue(hunting);
|
||||
const activeIncident = useMemo(() => index?.incidentById.get(activeIncidentId) ?? null, [index, activeIncidentId]);
|
||||
const selected = useMemo(
|
||||
() => (selectedEventId ? index?.eventById.get(selectedEventId) : null) ?? null,
|
||||
[index, selectedEventId],
|
||||
);
|
||||
const anchorCandidate = selected?.timestamp ?? activeIncident?.start ?? null;
|
||||
const evidenceIds = useMemo(
|
||||
() => (focusIncident && activeIncident ? new Set(activeIncident.evidence_event_ids) : null),
|
||||
[focusIncident, activeIncident],
|
||||
);
|
||||
const providers = useMemo(() => uniqueProviders(data?.events ?? []), [data]);
|
||||
const visibleEvents = useMemo(() => {
|
||||
const eventFilters: EventFilters = {
|
||||
search: filters.search,
|
||||
category: filters.category,
|
||||
level: filters.level,
|
||||
provider: filters.provider,
|
||||
noiseMode: filters.attentionOnly ? "attention" : "all",
|
||||
search: deferredFilters.search,
|
||||
category: deferredFilters.category,
|
||||
level: deferredFilters.level,
|
||||
provider: deferredFilters.provider,
|
||||
noiseMode: deferredFilters.attentionOnly ? "attention" : "all",
|
||||
evidenceIds,
|
||||
windowMinutes: filters.windowMinutes,
|
||||
anchorTimestamp: selected?.timestamp ?? activeIncident?.start ?? null,
|
||||
windowMinutes: deferredFilters.windowMinutes,
|
||||
anchorTimestamp: deferredFilters.windowAnchor,
|
||||
};
|
||||
return filterEvents(data?.events ?? [], eventFilters);
|
||||
}, [data, filters, evidenceIds, selected, activeIncident]);
|
||||
const incidentEventIds = useMemo(() => new Set(data?.incidents.flatMap((incident) => incident.evidence_event_ids) ?? []), [data]);
|
||||
}, [data, deferredFilters, evidenceIds]);
|
||||
const incidentEventIds = useMemo(() => index?.incidentEventIds ?? new Set<string>(), [index]);
|
||||
const huntingResults = useMemo(() => {
|
||||
const filtered = filterEvents(data?.events ?? [], { search: hunting.search, category: hunting.category, level: hunting.level, provider: hunting.provider, noiseMode: "all", windowMinutes: hunting.windowMinutes, anchorTimestamp: selected?.timestamp ?? activeIncident?.start ?? null });
|
||||
return filtered.filter((event) => (!hunting.eventId || String(event.event_id ?? "") === hunting.eventId) && (!hunting.computer || (event.computer ?? "").toLowerCase().includes(hunting.computer.toLowerCase())) && (!hunting.incidentOnly || incidentEventIds.has(event.id)));
|
||||
}, [data, hunting, selected, activeIncident, incidentEventIds]);
|
||||
const redactionPreview = useMemo(() => data && redactExports ? prepareExport(data, true).redaction : null, [data, redactExports]);
|
||||
const filtered = filterEvents(data?.events ?? [], {
|
||||
search: deferredHunting.search,
|
||||
category: deferredHunting.category,
|
||||
level: deferredHunting.level,
|
||||
provider: deferredHunting.provider,
|
||||
noiseMode: "all",
|
||||
windowMinutes: deferredHunting.windowMinutes,
|
||||
anchorTimestamp: deferredHunting.windowAnchor,
|
||||
});
|
||||
return filtered.filter(
|
||||
(event) =>
|
||||
(!deferredHunting.eventId || String(event.event_id ?? "") === deferredHunting.eventId) &&
|
||||
(!deferredHunting.computer ||
|
||||
(event.computer ?? "").toLowerCase().includes(deferredHunting.computer.toLowerCase())) &&
|
||||
(!deferredHunting.incidentOnly || incidentEventIds.has(event.id)),
|
||||
);
|
||||
}, [data, deferredHunting, incidentEventIds]);
|
||||
|
||||
// Redaction is computed lazily, off the UI thread, and only once Reports needs it.
|
||||
useEffect(() => {
|
||||
if (!data || !redactExports || activeWorkspace !== "reports") return;
|
||||
if (redactionPreview?.data === data) return;
|
||||
let cancelled = false;
|
||||
setRedactionFailed(false);
|
||||
redactInBackground(data).then(
|
||||
(result) => {
|
||||
if (!cancelled) setRedactionPreview({ data, summary: result.summary });
|
||||
},
|
||||
() => {
|
||||
if (!cancelled) setRedactionFailed(true);
|
||||
},
|
||||
);
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, [data, redactExports, activeWorkspace, redactionPreview]);
|
||||
const currentRedaction = redactionPreview?.data === data ? redactionPreview.summary : null;
|
||||
const rowHeight = ROW_HEIGHTS[settings.density];
|
||||
const contextVisible = activeWorkspace === "timeline" ? visibleEvents.length : activeWorkspace === "hunting" ? huntingResults.length : undefined;
|
||||
const contextVisible =
|
||||
activeWorkspace === "timeline"
|
||||
? visibleEvents.length
|
||||
: activeWorkspace === "hunting"
|
||||
? huntingResults.length
|
||||
: undefined;
|
||||
|
||||
function updateSettings(patch: Partial<UiSettings>) {
|
||||
setSettingsStorageConfirmed(false);
|
||||
setSettings((current) => ({ ...current, ...patch }));
|
||||
setSettingsNotice("Saving preferences…");
|
||||
if (patch.defaultNoise) setFilters((current) => ({ ...current, attentionOnly: patch.defaultNoise === "attention" }));
|
||||
if (patch.defaultNoise)
|
||||
setFilters((current) => ({ ...current, attentionOnly: patch.defaultNoise === "attention" }));
|
||||
if (typeof patch.defaultRedaction === "boolean") setRedactExports(patch.defaultRedaction);
|
||||
}
|
||||
|
||||
@@ -125,12 +199,30 @@ export function App() {
|
||||
setSettingsNotice("Resetting preferences…");
|
||||
}
|
||||
|
||||
/** Choosing a time window pins it to the current selection; later selections do not move it. */
|
||||
function windowPatch<T extends { windowMinutes: number; windowAnchor: string | null }>(
|
||||
current: T,
|
||||
patch: Partial<T>,
|
||||
): T {
|
||||
const next = { ...current, ...patch };
|
||||
if (patch.windowMinutes !== undefined)
|
||||
next.windowAnchor =
|
||||
patch.windowMinutes > 0
|
||||
? current.windowMinutes > 0 && current.windowAnchor
|
||||
? current.windowAnchor
|
||||
: anchorCandidate
|
||||
: null;
|
||||
return next;
|
||||
}
|
||||
|
||||
function resetFilters() {
|
||||
setFilters(EMPTY_FILTERS(settings.defaultNoise === "attention"));
|
||||
setFocusIncident(false);
|
||||
}
|
||||
|
||||
function resetHunting() { setHunting(EMPTY_HUNTING()); }
|
||||
function resetHunting() {
|
||||
setHunting(EMPTY_HUNTING());
|
||||
}
|
||||
|
||||
function resetView(next: Analysis) {
|
||||
setData(next);
|
||||
@@ -146,7 +238,8 @@ export function App() {
|
||||
requestRef.current?.abort();
|
||||
const controller = new AbortController();
|
||||
requestRef.current = controller;
|
||||
setLoading(true); setError("");
|
||||
setLoading(true);
|
||||
setError("");
|
||||
try {
|
||||
const response = await fetch(`${API}/api/demo`, { cache: "no-store", signal: controller.signal });
|
||||
const body: unknown = await response.json().catch(() => null);
|
||||
@@ -155,28 +248,62 @@ export function App() {
|
||||
if (requestRef.current !== controller || controller.signal.aborted) return;
|
||||
resetView(body);
|
||||
} catch (reason) {
|
||||
if (requestRef.current === controller && !controller.signal.aborted) setError(reason instanceof Error && reason.message === "Demo returned an invalid response" ? reason.message : "The local EventLens service is unavailable. Check the service and retry.");
|
||||
} finally { if (requestRef.current === controller) { requestRef.current = null; setLoading(false); } }
|
||||
if (requestRef.current === controller && !controller.signal.aborted)
|
||||
setError(
|
||||
reason instanceof Error && reason.message === "Demo returned an invalid response"
|
||||
? reason.message
|
||||
: "The local EventLens service is unavailable. Check the service and retry.",
|
||||
);
|
||||
} finally {
|
||||
if (requestRef.current === controller) {
|
||||
requestRef.current = null;
|
||||
setLoading(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function analyzeFile(file: File) {
|
||||
requestRef.current?.abort();
|
||||
requestRef.current = null;
|
||||
if (!file.name.toLowerCase().endsWith(".evtx")) { setLoading(false); setError("Choose a Windows .evtx file."); return; }
|
||||
if (!file.name.toLowerCase().endsWith(".evtx")) {
|
||||
setLoading(false);
|
||||
setError("Choose a Windows .evtx file.");
|
||||
return;
|
||||
}
|
||||
const controller = new AbortController();
|
||||
requestRef.current = controller;
|
||||
setLoading(true); setError("");
|
||||
const form = new FormData(); form.append("file", file);
|
||||
setLoading(true);
|
||||
setError("");
|
||||
const form = new FormData();
|
||||
form.append("file", file);
|
||||
try {
|
||||
const response = await fetch(`${API}/api/analyze`, { method: "POST", body: form, cache: "no-store", signal: controller.signal });
|
||||
const response = await fetch(`${API}/api/analyze`, {
|
||||
method: "POST",
|
||||
body: form,
|
||||
cache: "no-store",
|
||||
signal: controller.signal,
|
||||
});
|
||||
const body: unknown = await response.json().catch(() => null);
|
||||
if (requestRef.current !== controller || controller.signal.aborted) return;
|
||||
if (!response.ok) { setError(analysisErrorMessage(response.status, body)); return; }
|
||||
if (!response.ok) {
|
||||
setError(analysisErrorMessage(response.status, body));
|
||||
return;
|
||||
}
|
||||
if (!isAnalysis(body)) throw new Error("Analysis returned an invalid response.");
|
||||
resetView(body);
|
||||
} catch (reason) {
|
||||
if (requestRef.current === controller && !controller.signal.aborted) setError(reason instanceof Error && reason.message === "Analysis returned an invalid response." ? reason.message : "The local EventLens service is unavailable. Check the service and retry.");
|
||||
} finally { if (requestRef.current === controller) { requestRef.current = null; setLoading(false); } }
|
||||
if (requestRef.current === controller && !controller.signal.aborted)
|
||||
setError(
|
||||
reason instanceof Error && reason.message === "Analysis returned an invalid response."
|
||||
? reason.message
|
||||
: "The local EventLens service is unavailable. Check the service and retry.",
|
||||
);
|
||||
} finally {
|
||||
if (requestRef.current === controller) {
|
||||
requestRef.current = null;
|
||||
setLoading(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function upload(event: ChangeEvent<HTMLInputElement>) {
|
||||
@@ -186,67 +313,213 @@ export function App() {
|
||||
}
|
||||
|
||||
async function drop(event: DragEvent<HTMLElement>) {
|
||||
event.preventDefault(); setDragging(false);
|
||||
event.preventDefault();
|
||||
setDragging(false);
|
||||
const file = event.dataTransfer.files?.[0];
|
||||
if (file) await analyzeFile(file);
|
||||
}
|
||||
|
||||
function selectIncident(id: string, openTimeline = false) {
|
||||
const incident = data?.incidents.find((item) => item.id === id);
|
||||
if (!incident) { setActiveIncidentId(""); return; }
|
||||
const incident = index?.incidentById.get(id);
|
||||
if (!incident) {
|
||||
setActiveIncidentId("");
|
||||
return;
|
||||
}
|
||||
setActiveIncidentId(id);
|
||||
setSelectedEventId(incident.evidence_event_ids[0] ?? null);
|
||||
setInspectorTab("details");
|
||||
if (openTimeline) { setFocusIncident(true); navigate("timeline"); }
|
||||
if (filters.windowMinutes > 0 && incident.start)
|
||||
setFilters((current) => ({ ...current, windowAnchor: incident.start }));
|
||||
if (openTimeline) {
|
||||
setFocusIncident(true);
|
||||
navigate("timeline");
|
||||
}
|
||||
}
|
||||
|
||||
function selectEvent(event: EventItem) {
|
||||
setSelectedEventId(event.id);
|
||||
const incident = data?.incidents.find((item) => item.evidence_event_ids.includes(event.id));
|
||||
const incident = index?.incidentByEvent.get(event.id);
|
||||
if (incident) setActiveIncidentId(incident.id);
|
||||
}
|
||||
|
||||
function moveSelection(delta: number, events: EventItem[]) {
|
||||
if (!events.length) return;
|
||||
const index = selected ? events.findIndex((event) => event.id === selected.id) : -1;
|
||||
const next = index < 0 ? (delta > 0 ? 0 : events.length - 1) : Math.min(events.length - 1, Math.max(0, index + delta));
|
||||
const next =
|
||||
index < 0 ? (delta > 0 ? 0 : events.length - 1) : Math.min(events.length - 1, Math.max(0, index + delta));
|
||||
selectEvent(events[next]);
|
||||
}
|
||||
|
||||
function exportJson() {
|
||||
if (!data) return;
|
||||
const prepared = prepareExport(data, redactExports);
|
||||
downloadText(`${exportStem(data.source)}-eventlens.json`, JSON.stringify(prepared.analysis, null, 2), "application/json");
|
||||
async function preparedExport(source: Analysis): Promise<PreparedExport> {
|
||||
if (!redactExports) return prepareExport(source, false);
|
||||
const result = await redactInBackground(source);
|
||||
return { analysis: result.analysis, redaction: result.summary };
|
||||
}
|
||||
|
||||
function exportMarkdown() {
|
||||
if (!data) return;
|
||||
downloadText(`${exportStem(data.source)}-eventlens.md`, analysisToMarkdown(data, redactExports), "text/markdown");
|
||||
async function runExport(kind: "json" | "markdown") {
|
||||
if (!data || exporting) return;
|
||||
const source = data;
|
||||
setExporting(true);
|
||||
try {
|
||||
const prepared = await preparedExport(source);
|
||||
if (kind === "json")
|
||||
downloadText(
|
||||
`${exportStem(source.source)}-eventlens.json`,
|
||||
JSON.stringify(prepared.analysis, null, 2),
|
||||
"application/json",
|
||||
);
|
||||
else
|
||||
downloadText(
|
||||
`${exportStem(source.source)}-eventlens.md`,
|
||||
markdownFromPrepared(prepared, redactExports),
|
||||
"text/markdown",
|
||||
);
|
||||
} catch {
|
||||
setError("The export could not be prepared. No file was written; retry the export.");
|
||||
} finally {
|
||||
setExporting(false);
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const scopedEvents = activeWorkspace === "hunting" ? huntingResults : visibleEvents;
|
||||
if (!selectedEventId || !scopedEvents.some((event) => event.id === selectedEventId)) setSelectedEventId(scopedEvents[0]?.id ?? null);
|
||||
if (!selectedEventId || !scopedEvents.some((event) => event.id === selectedEventId))
|
||||
setSelectedEventId(scopedEvents[0]?.id ?? null);
|
||||
}, [activeWorkspace, huntingResults, visibleEvents, selectedEventId]);
|
||||
|
||||
return <main className={`event-app-shell density-${settings.density}`} onDragOver={(event) => { event.preventDefault(); setDragging(true); }} onDragLeave={() => setDragging(false)} onDrop={drop}>
|
||||
<AppTopbar activeWorkspace={activeWorkspace} onNavigate={navigate} version={APP_VERSION} />
|
||||
<section className="event-main" aria-label={`${activeWorkspace} workspace`}>
|
||||
<InvestigationContext data={data} activeIncident={activeIncident} visibleCount={contextVisible} workspace={activeWorkspace} />
|
||||
<GlobalActions loading={loading} dragging={dragging} onOpen={() => fileInput.current?.click()} onDemo={() => void loadDemo()} workspace={activeWorkspace} />
|
||||
<input className="hidden-input" aria-label="Choose EVTX file" ref={fileInput} type="file" accept=".evtx" onChange={upload} />
|
||||
{loading ? <div className="loading-banner" role="status" aria-live="polite"><span className="loading-spinner" aria-hidden="true" />Analyzing event log… The application shell remains available.</div> : null}
|
||||
{error ? <ErrorBanner message={error} onDemo={() => void loadDemo()} /> : null}
|
||||
{data?.parse?.status === "partial" ? <PartialAnalysisWarning parse={data.parse} /> : null}
|
||||
{data?.parse && data.parse.status !== "partial" && data.parse.issues.length ? <ParserIssueNotice parse={data.parse} /> : null}
|
||||
<div className="workspace-content">
|
||||
{activeWorkspace === "analysis" ? <AnalysisView data={data} timestampDisplay={settings.timestampDisplay} activeIncidentId={activeIncidentId} onOpen={(incident: Incident) => selectIncident(incident.id, true)} onOpenFile={() => fileInput.current?.click()} onDemo={() => void loadDemo()} /> : null}
|
||||
{activeWorkspace === "timeline" ? <TimelineView data={data} filters={filters} providers={providers} visibleEvents={visibleEvents} selected={selected} activeIncident={activeIncident} activeIncidentId={activeIncidentId} focusIncident={focusIncident} timestampDisplay={settings.timestampDisplay} rowHeight={rowHeight} inspectorTab={inspectorTab} onFilterChange={(patch) => setFilters((current) => ({ ...current, ...patch }))} onResetFilters={resetFilters} onFocusChange={setFocusIncident} onSelectIncident={selectIncident} onSelectEvent={selectEvent} onMove={(delta) => moveSelection(delta, visibleEvents)} onTab={setInspectorTab} onOpenFile={() => fileInput.current?.click()} onDemo={() => void loadDemo()} /> : null}
|
||||
{activeWorkspace === "hunting" ? <HuntingView data={data} state={hunting} providers={providers} results={huntingResults} selected={selected} activeIncident={activeIncident} timestampDisplay={settings.timestampDisplay} inspectorTab={inspectorTab} incidentEventIds={incidentEventIds} onChange={(patch) => setHunting((current) => ({ ...current, ...patch }))} onReset={resetHunting} onSelectEvent={selectEvent} onMove={(delta) => moveSelection(delta, huntingResults)} onTab={setInspectorTab} onOpenTimeline={() => navigate("timeline")} onOpenFile={() => fileInput.current?.click()} onDemo={() => void loadDemo()} /> : null}
|
||||
{activeWorkspace === "reports" ? <ReportsView data={data} redactExports={redactExports} redactionPreview={redactionPreview} onRedactionChange={setRedactExports} onExportJson={exportJson} onExportMarkdown={exportMarkdown} timestampDisplay={settings.timestampDisplay} onOpenFile={() => fileInput.current?.click()} onDemo={() => void loadDemo()} /> : null}
|
||||
{activeWorkspace === "settings" ? <SettingsView settings={settings} saveNotice={settingsPersistenceFailed ? "Preferences changed for this session only" : settingsNotice} storageFailed={settingsPersistenceFailed} storageConfirmed={settingsStorageConfirmed} onChange={updateSettings} onReset={resetSettings} /> : null}
|
||||
</div>
|
||||
<Statusbar data={data} />
|
||||
</section>
|
||||
</main>;
|
||||
return (
|
||||
<main
|
||||
className={`event-app-shell density-${settings.density}`}
|
||||
onDragOver={(event) => {
|
||||
event.preventDefault();
|
||||
setDragging(true);
|
||||
}}
|
||||
onDragLeave={(event) => {
|
||||
if (!event.currentTarget.contains(event.relatedTarget as Node | null)) setDragging(false);
|
||||
}}
|
||||
onDrop={drop}
|
||||
>
|
||||
<AppTopbar activeWorkspace={activeWorkspace} onNavigate={navigate} version={APP_VERSION} />
|
||||
<section className="event-main" aria-label={`${activeWorkspace} workspace`}>
|
||||
<InvestigationContext
|
||||
data={data}
|
||||
activeIncident={activeIncident}
|
||||
visibleCount={contextVisible}
|
||||
workspace={activeWorkspace}
|
||||
/>
|
||||
<GlobalActions
|
||||
loading={loading}
|
||||
dragging={dragging}
|
||||
onOpen={() => fileInput.current?.click()}
|
||||
onDemo={() => void loadDemo()}
|
||||
workspace={activeWorkspace}
|
||||
/>
|
||||
<input
|
||||
className="hidden-input"
|
||||
aria-label="Choose EVTX file"
|
||||
ref={fileInput}
|
||||
type="file"
|
||||
accept=".evtx"
|
||||
onChange={upload}
|
||||
/>
|
||||
{loading ? (
|
||||
<div className="loading-banner" role="status" aria-live="polite">
|
||||
<span className="loading-spinner" aria-hidden="true" />
|
||||
Analyzing event log… The application shell remains available.
|
||||
</div>
|
||||
) : null}
|
||||
{error ? <ErrorBanner message={error} onDemo={() => void loadDemo()} /> : null}
|
||||
{data?.parse?.status === "partial" ? <PartialAnalysisWarning parse={data.parse} /> : null}
|
||||
{data?.parse && data.parse.status !== "partial" && data.parse.issues.length ? (
|
||||
<ParserIssueNotice parse={data.parse} />
|
||||
) : null}
|
||||
<div className="workspace-content">
|
||||
{activeWorkspace === "analysis" ? (
|
||||
<AnalysisView
|
||||
data={data}
|
||||
timestampDisplay={settings.timestampDisplay}
|
||||
activeIncidentId={activeIncidentId}
|
||||
onOpen={(incident: Incident) => selectIncident(incident.id, true)}
|
||||
onOpenFile={() => fileInput.current?.click()}
|
||||
onDemo={() => void loadDemo()}
|
||||
/>
|
||||
) : null}
|
||||
{activeWorkspace === "timeline" ? (
|
||||
<TimelineView
|
||||
data={data}
|
||||
anchorCandidate={anchorCandidate}
|
||||
filters={filters}
|
||||
providers={providers}
|
||||
visibleEvents={visibleEvents}
|
||||
selected={selected}
|
||||
activeIncident={activeIncident}
|
||||
activeIncidentId={activeIncidentId}
|
||||
focusIncident={focusIncident}
|
||||
timestampDisplay={settings.timestampDisplay}
|
||||
rowHeight={rowHeight}
|
||||
inspectorTab={inspectorTab}
|
||||
onFilterChange={(patch) => setFilters((current) => windowPatch(current, patch))}
|
||||
onResetFilters={resetFilters}
|
||||
onFocusChange={setFocusIncident}
|
||||
onSelectIncident={selectIncident}
|
||||
onSelectEvent={selectEvent}
|
||||
onMove={(delta) => moveSelection(delta, visibleEvents)}
|
||||
onTab={setInspectorTab}
|
||||
onOpenFile={() => fileInput.current?.click()}
|
||||
onDemo={() => void loadDemo()}
|
||||
/>
|
||||
) : null}
|
||||
{activeWorkspace === "hunting" ? (
|
||||
<HuntingView
|
||||
data={data}
|
||||
anchorCandidate={anchorCandidate}
|
||||
state={hunting}
|
||||
providers={providers}
|
||||
results={huntingResults}
|
||||
selected={selected}
|
||||
activeIncident={activeIncident}
|
||||
timestampDisplay={settings.timestampDisplay}
|
||||
inspectorTab={inspectorTab}
|
||||
incidentEventIds={incidentEventIds}
|
||||
onChange={(patch) => setHunting((current) => windowPatch(current, patch))}
|
||||
onReset={resetHunting}
|
||||
onSelectEvent={selectEvent}
|
||||
onMove={(delta) => moveSelection(delta, huntingResults)}
|
||||
onTab={setInspectorTab}
|
||||
onOpenTimeline={() => navigate("timeline")}
|
||||
onOpenFile={() => fileInput.current?.click()}
|
||||
onDemo={() => void loadDemo()}
|
||||
/>
|
||||
) : null}
|
||||
{activeWorkspace === "reports" ? (
|
||||
<ReportsView
|
||||
data={data}
|
||||
redactExports={redactExports}
|
||||
redactionPreview={currentRedaction}
|
||||
redactionPending={redactExports && !currentRedaction && !redactionFailed}
|
||||
redactionFailed={redactionFailed}
|
||||
exporting={exporting}
|
||||
onRedactionChange={setRedactExports}
|
||||
onExportJson={() => void runExport("json")}
|
||||
onExportMarkdown={() => void runExport("markdown")}
|
||||
timestampDisplay={settings.timestampDisplay}
|
||||
onOpenFile={() => fileInput.current?.click()}
|
||||
onDemo={() => void loadDemo()}
|
||||
/>
|
||||
) : null}
|
||||
{activeWorkspace === "settings" ? (
|
||||
<SettingsView
|
||||
settings={settings}
|
||||
saveNotice={settingsPersistenceFailed ? "Preferences changed for this session only" : settingsNotice}
|
||||
storageFailed={settingsPersistenceFailed}
|
||||
storageConfirmed={settingsStorageConfirmed}
|
||||
onChange={updateSettings}
|
||||
onReset={resetSettings}
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
<Statusbar data={data} />
|
||||
</section>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@@ -41,7 +41,13 @@ export function formatRange(start: string | null, end: string | null, display: T
|
||||
}
|
||||
|
||||
export function levelLabel(level: string): string {
|
||||
return level === "error" || level === "critical" ? "High" : level === "warning" ? "Medium" : level === "information" ? "Info" : level;
|
||||
return level === "error" || level === "critical"
|
||||
? "High"
|
||||
: level === "warning"
|
||||
? "Medium"
|
||||
: level === "information"
|
||||
? "Info"
|
||||
: level;
|
||||
}
|
||||
|
||||
export function statusLabel(data: Analysis | null): string {
|
||||
@@ -62,6 +68,12 @@ export function downloadText(filename: string, content: string, type: string): v
|
||||
window.setTimeout(() => URL.revokeObjectURL(href), 0);
|
||||
}
|
||||
|
||||
export function formatBytes(value: number): string {
|
||||
if (value < 1024) return `${value} B`;
|
||||
if (value < 1024 * 1024) return `${(value / 1024).toFixed(1)} KiB`;
|
||||
return `${(value / (1024 * 1024)).toFixed(1)} MiB`;
|
||||
}
|
||||
|
||||
export function exportStem(source: string): string {
|
||||
const base = sourceLabel(source).replace(/\.evtx$/i, "");
|
||||
return base.replace(/[^A-Za-z0-9._-]+/g, "_").slice(0, 80) || "eventlens";
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
import type { Analysis, Campaign, EventItem, Incident } from "../types";
|
||||
|
||||
export type AnalysisIndex = {
|
||||
eventById: Map<string, EventItem>;
|
||||
incidentById: Map<string, Incident>;
|
||||
/** First incident (in API order) that lists the event as evidence. */
|
||||
incidentByEvent: Map<string, Incident>;
|
||||
campaignById: Map<string, Campaign>;
|
||||
incidentEventIds: Set<string>;
|
||||
};
|
||||
|
||||
const cache = new WeakMap<Analysis, AnalysisIndex>();
|
||||
|
||||
/** O(1) lookups shared by all workspaces; built once per loaded analysis. */
|
||||
export function analysisIndex(data: Analysis): AnalysisIndex {
|
||||
const cached = cache.get(data);
|
||||
if (cached) return cached;
|
||||
const eventById = new Map(data.events.map((event) => [event.id, event]));
|
||||
const incidentById = new Map(data.incidents.map((incident) => [incident.id, incident]));
|
||||
const incidentByEvent = new Map<string, Incident>();
|
||||
for (const incident of data.incidents) {
|
||||
for (const id of incident.evidence_event_ids) if (!incidentByEvent.has(id)) incidentByEvent.set(id, incident);
|
||||
}
|
||||
const campaignById = new Map((data.campaigns ?? []).map((campaign) => [campaign.id, campaign]));
|
||||
const index = {
|
||||
eventById,
|
||||
incidentById,
|
||||
incidentByEvent,
|
||||
campaignById,
|
||||
incidentEventIds: new Set(incidentByEvent.keys()),
|
||||
};
|
||||
cache.set(data, index);
|
||||
return index;
|
||||
}
|
||||
|
||||
export function evidenceEvents(data: Analysis, incident: Incident | null): EventItem[] {
|
||||
if (!incident) return [];
|
||||
const { eventById } = analysisIndex(data);
|
||||
return incident.evidence_event_ids.flatMap((id) => {
|
||||
const event = eventById.get(id);
|
||||
return event ? [event] : [];
|
||||
});
|
||||
}
|
||||
@@ -1,4 +1,13 @@
|
||||
export const CATEGORIES = ["system", "service", "network", "authentication", "application", "crash", "other"];
|
||||
export const CATEGORIES = [
|
||||
"system",
|
||||
"service",
|
||||
"network",
|
||||
"authentication",
|
||||
"security",
|
||||
"application",
|
||||
"crash",
|
||||
"other",
|
||||
];
|
||||
export const LEVELS = ["critical", "error", "warning", "information", "verbose"];
|
||||
export const WINDOWS = [0, 1, 5, 15, 60];
|
||||
export const WORKSPACES = ["analysis", "timeline", "hunting", "reports", "settings"] as const;
|
||||
@@ -24,10 +33,12 @@ export type FilterState = {
|
||||
level: string;
|
||||
provider: string;
|
||||
windowMinutes: number;
|
||||
/** Timestamp the time window is pinned to; set when the window is chosen, not on every selection. */
|
||||
windowAnchor: string | null;
|
||||
attentionOnly: boolean;
|
||||
};
|
||||
|
||||
export type HuntingState = FilterState & {
|
||||
export type HuntingState = Omit<FilterState, "attentionOnly"> & {
|
||||
eventId: string;
|
||||
computer: string;
|
||||
incidentOnly: boolean;
|
||||
@@ -49,11 +60,17 @@ export const EMPTY_FILTERS = (attentionOnly: boolean): FilterState => ({
|
||||
level: "",
|
||||
provider: "",
|
||||
windowMinutes: 0,
|
||||
windowAnchor: null,
|
||||
attentionOnly,
|
||||
});
|
||||
|
||||
export const EMPTY_HUNTING = (): HuntingState => ({
|
||||
...EMPTY_FILTERS(false),
|
||||
search: "",
|
||||
category: "",
|
||||
level: "",
|
||||
provider: "",
|
||||
windowMinutes: 0,
|
||||
windowAnchor: null,
|
||||
eventId: "",
|
||||
computer: "",
|
||||
incidentOnly: false,
|
||||
@@ -70,7 +87,7 @@ export function readSettings(): UiSettings {
|
||||
defaultRedaction: typeof parsed.defaultRedaction === "boolean" ? parsed.defaultRedaction : true,
|
||||
density: parsed.density === "compact" ? "compact" : "comfortable",
|
||||
defaultWorkspace: WORKSPACES.includes(parsed.defaultWorkspace as Workspace)
|
||||
? parsed.defaultWorkspace as Workspace
|
||||
? (parsed.defaultWorkspace as Workspace)
|
||||
: "analysis",
|
||||
};
|
||||
} catch {
|
||||
@@ -80,5 +97,5 @@ export function readSettings(): UiSettings {
|
||||
|
||||
export function workspaceFromHash(hash = typeof window === "undefined" ? "" : window.location.hash): Workspace | null {
|
||||
const value = hash.replace(/^#/, "");
|
||||
return WORKSPACES.includes(value as Workspace) ? value as Workspace : null;
|
||||
return WORKSPACES.includes(value as Workspace) ? (value as Workspace) : null;
|
||||
}
|
||||
@@ -3,31 +3,35 @@ import { isAnalysis } from "./validation";
|
||||
|
||||
const valid = {
|
||||
source: "demo.evtx",
|
||||
events: [{
|
||||
id: "event-1",
|
||||
timestamp: "2026-09-22T08:00:00Z",
|
||||
timestamp_source: "event",
|
||||
timestamp_valid: true,
|
||||
provider: "Provider",
|
||||
event_id: 1000,
|
||||
level: "Error",
|
||||
category: "crash",
|
||||
summary: "Example event",
|
||||
fields: { process: "example.exe" },
|
||||
}],
|
||||
incidents: [{
|
||||
id: "incident-1",
|
||||
rule_id: "crash.sequence",
|
||||
start: "2026-09-22T08:00:00Z",
|
||||
end: "2026-09-22T08:00:00Z",
|
||||
title: "Example incident",
|
||||
category: "crash",
|
||||
severity: "high",
|
||||
reasons: ["Observed crash evidence."],
|
||||
evidence_event_ids: ["event-1"],
|
||||
original_count: 1,
|
||||
compressed_count: 1,
|
||||
}],
|
||||
events: [
|
||||
{
|
||||
id: "event-1",
|
||||
timestamp: "2026-09-22T08:00:00Z",
|
||||
timestamp_source: "event",
|
||||
timestamp_valid: true,
|
||||
provider: "Provider",
|
||||
event_id: 1000,
|
||||
level: "Error",
|
||||
category: "crash",
|
||||
summary: "Example event",
|
||||
fields: { process: "example.exe" },
|
||||
},
|
||||
],
|
||||
incidents: [
|
||||
{
|
||||
id: "incident-1",
|
||||
rule_id: "crash.sequence",
|
||||
start: "2026-09-22T08:00:00Z",
|
||||
end: "2026-09-22T08:00:00Z",
|
||||
title: "Example incident",
|
||||
category: "crash",
|
||||
severity: "high",
|
||||
reasons: ["Observed crash evidence."],
|
||||
evidence_event_ids: ["event-1"],
|
||||
original_count: 1,
|
||||
compressed_count: 1,
|
||||
},
|
||||
],
|
||||
parse: {
|
||||
parser: "evtx",
|
||||
status: "complete",
|
||||
@@ -57,14 +61,22 @@ describe("isAnalysis", () => {
|
||||
});
|
||||
|
||||
it("rejects missing evidence references and duplicate event IDs", () => {
|
||||
expect(isAnalysis({ ...valid, incidents: [{ ...valid.incidents[0], evidence_event_ids: ["missing"] }] })).toBe(false);
|
||||
expect(isAnalysis({ ...valid, events: [...valid.events, valid.events[0]], parse: { ...valid.parse, parsed_events: 2 } })).toBe(false);
|
||||
expect(isAnalysis({ ...valid, incidents: [{ ...valid.incidents[0], evidence_event_ids: ["missing"] }] })).toBe(
|
||||
false,
|
||||
);
|
||||
expect(
|
||||
isAnalysis({ ...valid, events: [...valid.events, valid.events[0]], parse: { ...valid.parse, parsed_events: 2 } }),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("rejects invalid timestamps and contradictory timestamp metadata", () => {
|
||||
expect(isAnalysis({ ...valid, events: [{ ...valid.events[0], timestamp: "not-a-date" }] })).toBe(false);
|
||||
expect(isAnalysis({ ...valid, events: [{ ...valid.events[0], timestamp: null, timestamp_valid: true }] })).toBe(false);
|
||||
expect(isAnalysis({ ...valid, events: [{ ...valid.events[0], timestamp_source: "invalid", timestamp_valid: true }] })).toBe(false);
|
||||
expect(isAnalysis({ ...valid, events: [{ ...valid.events[0], timestamp: null, timestamp_valid: true }] })).toBe(
|
||||
false,
|
||||
);
|
||||
expect(
|
||||
isAnalysis({ ...valid, events: [{ ...valid.events[0], timestamp_source: "invalid", timestamp_valid: true }] }),
|
||||
).toBe(false);
|
||||
expect(isAnalysis({ ...valid, incidents: [{ ...valid.incidents[0], start: "not-a-date" }] })).toBe(false);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
import type { Analysis, EventItem, Incident, ParseIssue, ParseStats } from "../types";
|
||||
import type { Analysis, Campaign, EventItem, Incident, ParseIssue, ParseStats, SourceInfo } from "../types";
|
||||
|
||||
function isRecord(value: unknown): value is Record<string, unknown> {
|
||||
return typeof value === "object" && value !== null && !Array.isArray(value);
|
||||
}
|
||||
|
||||
function isTimestamp(value: unknown): value is string | null {
|
||||
return value === null || (typeof value === "string" && /(?:Z|[+-]\d{2}:\d{2})$/.test(value) && Number.isFinite(Date.parse(value)));
|
||||
return (
|
||||
value === null ||
|
||||
(typeof value === "string" && /(?:Z|[+-]\d{2}:\d{2})$/.test(value) && Number.isFinite(Date.parse(value)))
|
||||
);
|
||||
}
|
||||
|
||||
function isFiniteNumber(value: unknown): value is number {
|
||||
@@ -23,14 +26,30 @@ function isStringArray(value: unknown): value is string[] {
|
||||
function isEventItem(value: unknown): value is EventItem {
|
||||
if (!isRecord(value)) return false;
|
||||
if (typeof value.id !== "string" || !isTimestamp(value.timestamp)) return false;
|
||||
if (typeof value.provider !== "string" || !(value.event_id === null || (isNonnegativeInteger(value.event_id) && value.event_id <= 4_294_967_295))) return false;
|
||||
if (typeof value.level !== "string" || typeof value.category !== "string" || typeof value.summary !== "string") return false;
|
||||
if (
|
||||
typeof value.provider !== "string" ||
|
||||
!(value.event_id === null || (isNonnegativeInteger(value.event_id) && value.event_id <= 4_294_967_295))
|
||||
)
|
||||
return false;
|
||||
if (typeof value.level !== "string" || typeof value.category !== "string" || typeof value.summary !== "string")
|
||||
return false;
|
||||
if (value.channel !== undefined && typeof value.channel !== "string") return false;
|
||||
if (value.computer !== undefined && typeof value.computer !== "string") return false;
|
||||
if (
|
||||
value.outcome !== undefined &&
|
||||
value.outcome !== null &&
|
||||
value.outcome !== "success" &&
|
||||
value.outcome !== "failure"
|
||||
)
|
||||
return false;
|
||||
if (value.fields !== undefined) {
|
||||
if (!isRecord(value.fields) || !Object.values(value.fields).every((item) => typeof item === "string")) return false;
|
||||
}
|
||||
if (typeof value.timestamp_valid !== "boolean" || !["event", "record", "missing", "invalid"].includes(String(value.timestamp_source))) return false;
|
||||
if (
|
||||
typeof value.timestamp_valid !== "boolean" ||
|
||||
!["event", "record", "missing", "invalid"].includes(String(value.timestamp_source))
|
||||
)
|
||||
return false;
|
||||
if (value.timestamp === null && value.timestamp_valid) return false;
|
||||
if (["event", "record"].includes(String(value.timestamp_source)) !== value.timestamp_valid) return false;
|
||||
return true;
|
||||
@@ -38,19 +57,54 @@ function isEventItem(value: unknown): value is EventItem {
|
||||
|
||||
function isIncident(value: unknown): value is Incident {
|
||||
if (!isRecord(value)) return false;
|
||||
return typeof value.id === "string"
|
||||
&& typeof value.rule_id === "string"
|
||||
&& isTimestamp(value.start)
|
||||
&& isTimestamp(value.end)
|
||||
&& typeof value.title === "string"
|
||||
&& typeof value.category === "string"
|
||||
&& typeof value.severity === "string"
|
||||
&& isStringArray(value.reasons)
|
||||
&& isStringArray(value.evidence_event_ids)
|
||||
&& isNonnegativeInteger(value.original_count)
|
||||
&& value.original_count > 0
|
||||
&& isNonnegativeInteger(value.compressed_count)
|
||||
&& value.compressed_count > 0;
|
||||
return (
|
||||
typeof value.id === "string" &&
|
||||
typeof value.rule_id === "string" &&
|
||||
isTimestamp(value.start) &&
|
||||
isTimestamp(value.end) &&
|
||||
typeof value.title === "string" &&
|
||||
typeof value.category === "string" &&
|
||||
typeof value.severity === "string" &&
|
||||
isStringArray(value.reasons) &&
|
||||
isStringArray(value.evidence_event_ids) &&
|
||||
isNonnegativeInteger(value.original_count) &&
|
||||
value.original_count > 0 &&
|
||||
isNonnegativeInteger(value.compressed_count) &&
|
||||
value.compressed_count > 0 &&
|
||||
(value.campaign_id === undefined || value.campaign_id === null || typeof value.campaign_id === "string")
|
||||
);
|
||||
}
|
||||
|
||||
function isCampaign(value: unknown): value is Campaign {
|
||||
if (!isRecord(value)) return false;
|
||||
return (
|
||||
typeof value.id === "string" &&
|
||||
typeof value.rule_id === "string" &&
|
||||
typeof value.title === "string" &&
|
||||
typeof value.category === "string" &&
|
||||
typeof value.severity === "string" &&
|
||||
typeof value.start === "string" &&
|
||||
isTimestamp(value.start) &&
|
||||
typeof value.end === "string" &&
|
||||
isTimestamp(value.end) &&
|
||||
isStringArray(value.incident_ids) &&
|
||||
value.incident_ids.length >= 2 &&
|
||||
isNonnegativeInteger(value.event_count) &&
|
||||
isStringArray(value.reasons)
|
||||
);
|
||||
}
|
||||
|
||||
function isSourceInfo(value: unknown): value is SourceInfo {
|
||||
return (
|
||||
isRecord(value) &&
|
||||
typeof value.sha256 === "string" &&
|
||||
/^[0-9a-f]{64}$/.test(value.sha256) &&
|
||||
isNonnegativeInteger(value.size_bytes)
|
||||
);
|
||||
}
|
||||
|
||||
function isIssueCounts(value: unknown): value is Record<string, number> {
|
||||
return isRecord(value) && Object.values(value).every(isNonnegativeInteger);
|
||||
}
|
||||
|
||||
function isParseIssue(value: unknown): value is ParseIssue {
|
||||
@@ -67,8 +121,18 @@ function isParseStats(value: unknown): value is ParseStats {
|
||||
if (!isNonnegativeInteger(value[key])) return false;
|
||||
}
|
||||
if (typeof value.truncated !== "boolean") return false;
|
||||
if (value.truncation_reason !== undefined && value.truncation_reason !== null && typeof value.truncation_reason !== "string") return false;
|
||||
return Array.isArray(value.issues) && value.issues.every(isParseIssue) && value.issue_count === value.issues.length;
|
||||
if (
|
||||
value.truncation_reason !== undefined &&
|
||||
value.truncation_reason !== null &&
|
||||
typeof value.truncation_reason !== "string"
|
||||
)
|
||||
return false;
|
||||
if (value.issues_truncated !== undefined && typeof value.issues_truncated !== "boolean") return false;
|
||||
if (value.issue_counts !== undefined && !isIssueCounts(value.issue_counts)) return false;
|
||||
if (!Array.isArray(value.issues) || !value.issues.every(isParseIssue)) return false;
|
||||
// The API caps the reported issue list; issue_count keeps the true total.
|
||||
const issueCount = value.issue_count as number;
|
||||
return value.issues_truncated === true ? issueCount >= value.issues.length : issueCount === value.issues.length;
|
||||
}
|
||||
|
||||
export function isAnalysis(value: unknown): value is Analysis {
|
||||
@@ -77,6 +141,18 @@ export function isAnalysis(value: unknown): value is Analysis {
|
||||
if (!Array.isArray(value.incidents) || !value.incidents.every(isIncident)) return false;
|
||||
const eventIds = new Set(value.events.map((event: EventItem) => event.id));
|
||||
if (eventIds.size !== value.events.length) return false;
|
||||
if (!value.incidents.every((incident: Incident) => incident.evidence_event_ids.every((id) => eventIds.has(id)))) return false;
|
||||
return value.parse === undefined || value.parse === null || (isParseStats(value.parse) && value.parse.parsed_events === value.events.length);
|
||||
if (!value.incidents.every((incident: Incident) => incident.evidence_event_ids.every((id) => eventIds.has(id))))
|
||||
return false;
|
||||
if (value.campaigns !== undefined) {
|
||||
if (!Array.isArray(value.campaigns) || !value.campaigns.every(isCampaign)) return false;
|
||||
const incidentIds = new Set(value.incidents.map((incident: Incident) => incident.id));
|
||||
if (!value.campaigns.every((campaign: Campaign) => campaign.incident_ids.every((id) => incidentIds.has(id))))
|
||||
return false;
|
||||
}
|
||||
if (value.source_info !== undefined && value.source_info !== null && !isSourceInfo(value.source_info)) return false;
|
||||
return (
|
||||
value.parse === undefined ||
|
||||
value.parse === null ||
|
||||
(isParseStats(value.parse) && value.parse.parsed_events === value.events.length)
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,232 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { redactAnalysis } from "./redact";
|
||||
import { filterEvents } from "./filter";
|
||||
import { analysisToMarkdown } from "./export";
|
||||
import { isAnalysis } from "./app/validation";
|
||||
import { analysisIndex, evidenceEvents } from "./app/indexes";
|
||||
import type { Analysis, EventItem } from "./types";
|
||||
|
||||
function event(id: number, overrides: Partial<EventItem> = {}): EventItem {
|
||||
return {
|
||||
id: String(id),
|
||||
timestamp: "2026-11-20T08:00:00Z",
|
||||
timestamp_source: "event",
|
||||
timestamp_valid: true,
|
||||
provider: "Microsoft-Windows-Security-Auditing",
|
||||
event_id: 4625,
|
||||
level: "information",
|
||||
category: "authentication",
|
||||
summary: `Failed sign-in for user${id % 500}`,
|
||||
channel: "Security",
|
||||
computer: `HOST${id % 20}`,
|
||||
fields: {
|
||||
"EventData.TargetUserName": `user${id % 500}`,
|
||||
"EventData.IpAddress": `192.0.2.${(id % 254) + 1}`,
|
||||
"EventData.WorkstationName": `WS${id % 300}`,
|
||||
"EventData.Status": "0xc000006d",
|
||||
},
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
describe("redaction performance and coverage", () => {
|
||||
it("redacts thousands of events with many distinct values within budget", () => {
|
||||
// The previous implementation needed ~73 s for 2,000 such events.
|
||||
const events = Array.from({ length: 10_000 }, (_, index) => event(index));
|
||||
const started = performance.now();
|
||||
const result = redactAnalysis({ source: "Security.evtx", events, incidents: [] });
|
||||
expect(performance.now() - started).toBeLessThan(5_000);
|
||||
expect(JSON.stringify(result.analysis)).not.toMatch(/user\d|HOST\d|WS\d|10\.0\./);
|
||||
});
|
||||
|
||||
it("uses consistent pseudonyms for the same value across fields and text", () => {
|
||||
const source: Analysis = { source: "a.evtx", incidents: [], events: [event(1), event(2, { computer: "HOST1" })] };
|
||||
const [first, second] = redactAnalysis(source).analysis.events;
|
||||
expect(first.computer).toBe(second.computer);
|
||||
expect(first.summary).toContain(first.fields?.["EventData.TargetUserName"]);
|
||||
expect(first.fields?.["EventData.TargetUserName"]).not.toBe(second.fields?.["EventData.TargetUserName"]);
|
||||
});
|
||||
|
||||
it("masks DNS query names, domain fields and internal FQDNs in free text", () => {
|
||||
const source: Analysis = {
|
||||
source: "System.evtx",
|
||||
incidents: [],
|
||||
events: [
|
||||
event(1, {
|
||||
provider: "Microsoft-Windows-DNS-Client",
|
||||
event_id: 1014,
|
||||
category: "network",
|
||||
summary: "Name resolution for fileserver.corp.contoso.local timed out",
|
||||
fields: {
|
||||
"EventData.QueryName": "fileserver.corp.contoso.local",
|
||||
"EventData.SubjectDomainName": "CONTOSO",
|
||||
query: "api.example.test",
|
||||
},
|
||||
}),
|
||||
],
|
||||
};
|
||||
const result = redactAnalysis(source);
|
||||
const serialized = JSON.stringify(result.analysis);
|
||||
expect(serialized).not.toContain("contoso");
|
||||
expect(serialized).not.toContain("CONTOSO");
|
||||
expect(serialized).not.toContain("api.example.test");
|
||||
expect(result.summary.domains).toBeGreaterThanOrEqual(3);
|
||||
});
|
||||
|
||||
it("keeps two-label file names and reports untouched field names", () => {
|
||||
const source: Analysis = {
|
||||
source: "a.evtx",
|
||||
incidents: [],
|
||||
events: [
|
||||
event(1, {
|
||||
summary: "ExampleApp.exe crashed in example.dll",
|
||||
fields: { "EventData.ExceptionCode": "0xc0000005" },
|
||||
}),
|
||||
],
|
||||
};
|
||||
const result = redactAnalysis(source);
|
||||
expect(result.analysis.events[0].summary).toContain("ExampleApp.exe");
|
||||
expect(result.summary.untouchedFieldKeys).toEqual(["EventData.ExceptionCode"]);
|
||||
});
|
||||
|
||||
it("redacts campaign titles and reasons", () => {
|
||||
const source: Analysis = {
|
||||
source: "a.evtx",
|
||||
events: [event(1)],
|
||||
incidents: [
|
||||
{
|
||||
id: "i1",
|
||||
rule_id: "r",
|
||||
start: "2026-11-20T08:00:00Z",
|
||||
end: "2026-11-20T08:00:00Z",
|
||||
title: "t",
|
||||
category: "authentication",
|
||||
severity: "warning",
|
||||
reasons: [],
|
||||
evidence_event_ids: ["1"],
|
||||
original_count: 1,
|
||||
compressed_count: 1,
|
||||
},
|
||||
],
|
||||
campaigns: [
|
||||
{
|
||||
id: "c1",
|
||||
rule_id: "r",
|
||||
title: "Recurring for user1 on HOST1",
|
||||
category: "authentication",
|
||||
severity: "warning",
|
||||
start: "2026-11-20T08:00:00Z",
|
||||
end: "2026-11-20T08:10:00Z",
|
||||
incident_ids: ["i1", "i1"],
|
||||
event_count: 2,
|
||||
reasons: ["seen from 192.0.2.1"],
|
||||
},
|
||||
],
|
||||
};
|
||||
const campaign = redactAnalysis(source).analysis.campaigns?.[0];
|
||||
expect(JSON.stringify(campaign)).not.toMatch(/user1|HOST1|10\.0\.1\.1/);
|
||||
});
|
||||
});
|
||||
|
||||
describe("attention filter", () => {
|
||||
it("treats Security audit failures as attention even at information level", () => {
|
||||
const failure = event(1, { outcome: "failure" });
|
||||
const success = event(2, { outcome: "success" });
|
||||
const visible = filterEvents([failure, success], {
|
||||
search: "",
|
||||
category: "",
|
||||
level: "",
|
||||
provider: "",
|
||||
noiseMode: "attention",
|
||||
});
|
||||
expect(visible.map((item) => item.id)).toEqual(["1"]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("response contract", () => {
|
||||
const base: Analysis = {
|
||||
source: "a.evtx",
|
||||
events: [event(1), event(2)],
|
||||
incidents: [
|
||||
{
|
||||
id: "i1",
|
||||
rule_id: "r",
|
||||
start: "2026-11-20T08:00:00Z",
|
||||
end: "2026-11-20T08:00:00Z",
|
||||
title: "a",
|
||||
category: "authentication",
|
||||
severity: "warning",
|
||||
reasons: [],
|
||||
evidence_event_ids: ["1"],
|
||||
original_count: 1,
|
||||
compressed_count: 1,
|
||||
campaign_id: "c1",
|
||||
},
|
||||
{
|
||||
id: "i2",
|
||||
rule_id: "r",
|
||||
start: "2026-11-20T08:03:00Z",
|
||||
end: "2026-11-20T08:03:00Z",
|
||||
title: "b",
|
||||
category: "authentication",
|
||||
severity: "warning",
|
||||
reasons: [],
|
||||
evidence_event_ids: ["2"],
|
||||
original_count: 1,
|
||||
compressed_count: 1,
|
||||
campaign_id: "c1",
|
||||
},
|
||||
],
|
||||
campaigns: [
|
||||
{
|
||||
id: "c1",
|
||||
rule_id: "r",
|
||||
title: "Recurring: a",
|
||||
category: "authentication",
|
||||
severity: "warning",
|
||||
start: "2026-11-20T08:00:00Z",
|
||||
end: "2026-11-20T08:03:00Z",
|
||||
incident_ids: ["i1", "i2"],
|
||||
event_count: 2,
|
||||
reasons: ["x"],
|
||||
},
|
||||
],
|
||||
source_info: { sha256: "a".repeat(64), size_bytes: 69632 },
|
||||
parse: {
|
||||
parser: "evtx-rs",
|
||||
status: "complete",
|
||||
parsed_events: 2,
|
||||
records_seen: 2,
|
||||
skipped_records: 0,
|
||||
issue_count: 300,
|
||||
truncated: false,
|
||||
duration_ms: 3,
|
||||
issues: [{ code: "invalid_timestamp", message: "m" }],
|
||||
issues_truncated: true,
|
||||
issue_counts: { invalid_timestamp: 300 },
|
||||
},
|
||||
};
|
||||
|
||||
it("accepts campaigns, source integrity and a truncated issue list", () => {
|
||||
expect(isAnalysis(base)).toBe(true);
|
||||
});
|
||||
|
||||
it("rejects campaigns that reference unknown incidents and malformed hashes", () => {
|
||||
expect(
|
||||
isAnalysis({ ...base, campaigns: [{ ...(base.campaigns ?? [])[0], incident_ids: ["i1", "missing"] }] }),
|
||||
).toBe(false);
|
||||
expect(isAnalysis({ ...base, source_info: { sha256: "xyz", size_bytes: 1 } })).toBe(false);
|
||||
expect(
|
||||
isAnalysis({ ...base, parse: { ...(base.parse as NonNullable<Analysis["parse"]>), issues_truncated: false } }),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("indexes evidence in incident order and exports campaign and hash metadata", () => {
|
||||
expect(analysisIndex(base).incidentByEvent.get("2")?.id).toBe("i2");
|
||||
expect(evidenceEvents(base, base.incidents[0]).map((item) => item.id)).toEqual(["1"]);
|
||||
const markdown = analysisToMarkdown(base, false);
|
||||
expect(markdown).toContain("## Campaigns");
|
||||
expect(markdown).toContain("a".repeat(64));
|
||||
expect(markdown).toContain("further issue(s)");
|
||||
});
|
||||
});
|
||||
@@ -22,40 +22,133 @@ export type IconName =
|
||||
|
||||
type IconProps = SVGProps<SVGSVGElement> & { name: IconName; title?: string };
|
||||
|
||||
const ICON_PROPS = { fill: "none", stroke: "currentColor", strokeWidth: 1.8, strokeLinecap: "round" as const, strokeLinejoin: "round" as const };
|
||||
const ICON_PROPS = {
|
||||
fill: "none",
|
||||
stroke: "currentColor",
|
||||
strokeWidth: 1.8,
|
||||
strokeLinecap: "round" as const,
|
||||
strokeLinejoin: "round" as const,
|
||||
};
|
||||
|
||||
export function Icon({ name, title, ...props }: IconProps) {
|
||||
const content = {
|
||||
analysis: <><path {...ICON_PROPS} d="M4 5h16v14H4z" /><path {...ICON_PROPS} d="M7 15h2m3-4h2m3-3h0" /><circle cx="8" cy="15" r="1" fill="currentColor" /><circle cx="13" cy="11" r="1" fill="currentColor" /><circle cx="18" cy="8" r="1" fill="currentColor" /></>,
|
||||
timeline: <><path {...ICON_PROPS} d="M5 5v14M12 5v14M19 5v14" /><circle cx="5" cy="9" r="2" fill="currentColor" /><circle cx="12" cy="15" r="2" fill="currentColor" /><circle cx="19" cy="7" r="2" fill="currentColor" /></>,
|
||||
hunting: <><circle {...ICON_PROPS} cx="10.5" cy="10.5" r="5.5" /><path {...ICON_PROPS} d="m15 15 5 5M4 4l2 2m12 12 2 2" /></>,
|
||||
reports: <><path {...ICON_PROPS} d="M6 3h8l4 4v14H6z" /><path {...ICON_PROPS} d="M14 3v5h5M9 12h6m-6 4h6" /></>,
|
||||
settings: <><path {...ICON_PROPS} d="M5 7h14M5 12h14M5 17h14" /><circle {...ICON_PROPS} cx="9" cy="7" r="2" /><circle {...ICON_PROPS} cx="15" cy="12" r="2" /><circle {...ICON_PROPS} cx="11" cy="17" r="2" /></>,
|
||||
file: <><path {...ICON_PROPS} d="M6 3h8l4 4v14H6z" /><path {...ICON_PROPS} d="M14 3v5h5" /></>,
|
||||
upload: <><path {...ICON_PROPS} d="M12 16V4m0 0L8 8m4-4 4 4M5 20h14" /></>,
|
||||
demo: <><path {...ICON_PROPS} d="M12 3 20 8v8l-8 5-8-5V8z" /><path {...ICON_PROPS} d="m10 9 5 3-5 3z" fill="currentColor" stroke="none" /></>,
|
||||
search: <><circle {...ICON_PROPS} cx="10.5" cy="10.5" r="6" /><path {...ICON_PROPS} d="m15 15 5 5" /></>,
|
||||
clock: <><circle {...ICON_PROPS} cx="12" cy="12" r="8" /><path {...ICON_PROPS} d="M12 7v5l3 2" /></>,
|
||||
warning: <><path {...ICON_PROPS} d="M12 3 22 20H2L12 3Z" /><path {...ICON_PROPS} d="M12 8v5m0 3v.2" /></>,
|
||||
analysis: (
|
||||
<>
|
||||
<path {...ICON_PROPS} d="M4 5h16v14H4z" />
|
||||
<path {...ICON_PROPS} d="M7 15h2m3-4h2m3-3h0" />
|
||||
<circle cx="8" cy="15" r="1" fill="currentColor" />
|
||||
<circle cx="13" cy="11" r="1" fill="currentColor" />
|
||||
<circle cx="18" cy="8" r="1" fill="currentColor" />
|
||||
</>
|
||||
),
|
||||
timeline: (
|
||||
<>
|
||||
<path {...ICON_PROPS} d="M5 5v14M12 5v14M19 5v14" />
|
||||
<circle cx="5" cy="9" r="2" fill="currentColor" />
|
||||
<circle cx="12" cy="15" r="2" fill="currentColor" />
|
||||
<circle cx="19" cy="7" r="2" fill="currentColor" />
|
||||
</>
|
||||
),
|
||||
hunting: (
|
||||
<>
|
||||
<circle {...ICON_PROPS} cx="10.5" cy="10.5" r="5.5" />
|
||||
<path {...ICON_PROPS} d="m15 15 5 5M4 4l2 2m12 12 2 2" />
|
||||
</>
|
||||
),
|
||||
reports: (
|
||||
<>
|
||||
<path {...ICON_PROPS} d="M6 3h8l4 4v14H6z" />
|
||||
<path {...ICON_PROPS} d="M14 3v5h5M9 12h6m-6 4h6" />
|
||||
</>
|
||||
),
|
||||
settings: (
|
||||
<>
|
||||
<path {...ICON_PROPS} d="M5 7h14M5 12h14M5 17h14" />
|
||||
<circle {...ICON_PROPS} cx="9" cy="7" r="2" />
|
||||
<circle {...ICON_PROPS} cx="15" cy="12" r="2" />
|
||||
<circle {...ICON_PROPS} cx="11" cy="17" r="2" />
|
||||
</>
|
||||
),
|
||||
file: (
|
||||
<>
|
||||
<path {...ICON_PROPS} d="M6 3h8l4 4v14H6z" />
|
||||
<path {...ICON_PROPS} d="M14 3v5h5" />
|
||||
</>
|
||||
),
|
||||
upload: (
|
||||
<>
|
||||
<path {...ICON_PROPS} d="M12 16V4m0 0L8 8m4-4 4 4M5 20h14" />
|
||||
</>
|
||||
),
|
||||
demo: (
|
||||
<>
|
||||
<path {...ICON_PROPS} d="M12 3 20 8v8l-8 5-8-5V8z" />
|
||||
<path {...ICON_PROPS} d="m10 9 5 3-5 3z" fill="currentColor" stroke="none" />
|
||||
</>
|
||||
),
|
||||
search: (
|
||||
<>
|
||||
<circle {...ICON_PROPS} cx="10.5" cy="10.5" r="6" />
|
||||
<path {...ICON_PROPS} d="m15 15 5 5" />
|
||||
</>
|
||||
),
|
||||
clock: (
|
||||
<>
|
||||
<circle {...ICON_PROPS} cx="12" cy="12" r="8" />
|
||||
<path {...ICON_PROPS} d="M12 7v5l3 2" />
|
||||
</>
|
||||
),
|
||||
warning: (
|
||||
<>
|
||||
<path {...ICON_PROPS} d="M12 3 22 20H2L12 3Z" />
|
||||
<path {...ICON_PROPS} d="M12 8v5m0 3v.2" />
|
||||
</>
|
||||
),
|
||||
"arrow-left": <path {...ICON_PROPS} d="m14 5-7 7 7 7" />,
|
||||
"arrow-right": <path {...ICON_PROPS} d="m10 5 7 7-7 7" />,
|
||||
reset: <><path {...ICON_PROPS} d="M4 12a8 8 0 1 0 2-5.3" /><path {...ICON_PROPS} d="M4 4v4h4" /></>,
|
||||
info: <><circle {...ICON_PROPS} cx="12" cy="12" r="8" /><path {...ICON_PROPS} d="M12 10v5m0-8v.2" /></>,
|
||||
export: <><path {...ICON_PROPS} d="M12 3v12m0 0 4-4m-4 4-4-4M5 20h14" /></>,
|
||||
reset: (
|
||||
<>
|
||||
<path {...ICON_PROPS} d="M4 12a8 8 0 1 0 2-5.3" />
|
||||
<path {...ICON_PROPS} d="M4 4v4h4" />
|
||||
</>
|
||||
),
|
||||
info: (
|
||||
<>
|
||||
<circle {...ICON_PROPS} cx="12" cy="12" r="8" />
|
||||
<path {...ICON_PROPS} d="M12 10v5m0-8v.2" />
|
||||
</>
|
||||
),
|
||||
export: (
|
||||
<>
|
||||
<path {...ICON_PROPS} d="M12 3v12m0 0 4-4m-4 4-4-4M5 20h14" />
|
||||
</>
|
||||
),
|
||||
check: <path {...ICON_PROPS} d="m5 12 4.2 4.2L19.5 6" />,
|
||||
privacy: <><path {...ICON_PROPS} d="M12 3 20 6v5c0 4.8-3.2 8.2-8 10-4.8-1.8-8-5.2-8-10V6l8-3Z" /><path {...ICON_PROPS} d="m8.5 12 2.2 2.2 4.8-4.8" /></>,
|
||||
privacy: (
|
||||
<>
|
||||
<path {...ICON_PROPS} d="M12 3 20 6v5c0 4.8-3.2 8.2-8 10-4.8-1.8-8-5.2-8-10V6l8-3Z" />
|
||||
<path {...ICON_PROPS} d="m8.5 12 2.2 2.2 4.8-4.8" />
|
||||
</>
|
||||
),
|
||||
}[name];
|
||||
return <svg viewBox="0 0 24 24" aria-hidden={title ? undefined : true} role={title ? "img" : undefined} {...props}>{title ? <title>{title}</title> : null}{content}</svg>;
|
||||
return (
|
||||
<svg viewBox="0 0 24 24" aria-hidden={title ? undefined : true} role={title ? "img" : undefined} {...props}>
|
||||
{title ? <title>{title}</title> : null}
|
||||
{content}
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
/** The canonical evidence-lens mark, shared by the browser package and topbar. */
|
||||
export function EventLensMark(props: SVGProps<SVGSVGElement>) {
|
||||
return <svg viewBox="0 0 64 64" aria-hidden="true" {...props}>
|
||||
<circle cx="27" cy="27" r="16" fill="none" stroke="#65d9d0" strokeWidth="5" />
|
||||
<path d="M16 29h22" fill="none" stroke="#dff8f5" strokeWidth="2.7" strokeLinecap="round" />
|
||||
<circle cx="20" cy="29" r="2.4" fill="#65d9d0" />
|
||||
<circle cx="27" cy="29" r="2.4" fill="#65d9d0" />
|
||||
<circle cx="34" cy="29" r="2.4" fill="#65d9d0" />
|
||||
<path d="m39 39 12 12" fill="none" stroke="#f4b860" strokeWidth="6" strokeLinecap="round" />
|
||||
</svg>;
|
||||
return (
|
||||
<svg viewBox="0 0 64 64" aria-hidden="true" {...props}>
|
||||
<circle cx="27" cy="27" r="16" fill="none" stroke="#65d9d0" strokeWidth="5" />
|
||||
<path d="M16 29h22" fill="none" stroke="#dff8f5" strokeWidth="2.7" strokeLinecap="round" />
|
||||
<circle cx="20" cy="29" r="2.4" fill="#65d9d0" />
|
||||
<circle cx="27" cy="29" r="2.4" fill="#65d9d0" />
|
||||
<circle cx="34" cy="29" r="2.4" fill="#65d9d0" />
|
||||
<path d="m39 39 12 12" fill="none" stroke="#f4b860" strokeWidth="6" strokeLinecap="round" />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
@@ -4,33 +4,176 @@ import { sourceLabel, statusLabel } from "../app/format";
|
||||
import { WORKSPACES, type Workspace } from "../app/model";
|
||||
import { EventLensMark, Icon } from "./icons";
|
||||
|
||||
const WORKSPACE_LABELS: Record<Workspace, string> = { analysis: "Analysis", timeline: "Timeline", hunting: "Hunting", reports: "Reports", settings: "Settings" };
|
||||
const WORKSPACE_LABELS: Record<Workspace, string> = {
|
||||
analysis: "Analysis",
|
||||
timeline: "Timeline",
|
||||
hunting: "Hunting",
|
||||
reports: "Reports",
|
||||
settings: "Settings",
|
||||
};
|
||||
|
||||
export function WorkspaceNav({ activeWorkspace, onNavigate }: { activeWorkspace: Workspace; onNavigate: (workspace: Workspace) => void }) {
|
||||
export function WorkspaceNav({
|
||||
activeWorkspace,
|
||||
onNavigate,
|
||||
}: {
|
||||
activeWorkspace: Workspace;
|
||||
onNavigate: (workspace: Workspace) => void;
|
||||
}) {
|
||||
const activeButton = useRef<HTMLButtonElement>(null);
|
||||
useEffect(() => {
|
||||
activeButton.current?.scrollIntoView({ block: "nearest", inline: "center" });
|
||||
}, [activeWorkspace]);
|
||||
return <nav className="workspace-nav" aria-label="EventLens workspaces">
|
||||
{WORKSPACES.map((workspace) => <button key={workspace} ref={activeWorkspace === workspace ? activeButton : undefined} type="button" className={activeWorkspace === workspace ? "active" : ""} aria-current={activeWorkspace === workspace ? "page" : undefined} onClick={() => onNavigate(workspace)}><Icon name={workspace} /><span>{WORKSPACE_LABELS[workspace]}</span></button>)}
|
||||
</nav>;
|
||||
return (
|
||||
<nav className="workspace-nav" aria-label="EventLens workspaces">
|
||||
{WORKSPACES.map((workspace) => (
|
||||
<button
|
||||
key={workspace}
|
||||
ref={activeWorkspace === workspace ? activeButton : undefined}
|
||||
type="button"
|
||||
className={activeWorkspace === workspace ? "active" : ""}
|
||||
aria-current={activeWorkspace === workspace ? "page" : undefined}
|
||||
onClick={() => onNavigate(workspace)}
|
||||
>
|
||||
<Icon name={workspace} />
|
||||
<span>{WORKSPACE_LABELS[workspace]}</span>
|
||||
</button>
|
||||
))}
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
|
||||
export function AppTopbar({ activeWorkspace, onNavigate, version }: { activeWorkspace: Workspace; onNavigate: (workspace: Workspace) => void; version: string }) {
|
||||
return <header className="event-topbar"><div className="event-brand"><span className="event-logo"><EventLensMark /></span><div><strong>EventLens</strong><small>Windows incident reconstruction</small></div></div><WorkspaceNav activeWorkspace={activeWorkspace} onNavigate={onNavigate} /><div className="instance-status"><span aria-hidden="true" /><div><b>Local Instance</b><small>v{version}</small></div></div></header>;
|
||||
export function AppTopbar({
|
||||
activeWorkspace,
|
||||
onNavigate,
|
||||
version,
|
||||
}: {
|
||||
activeWorkspace: Workspace;
|
||||
onNavigate: (workspace: Workspace) => void;
|
||||
version: string;
|
||||
}) {
|
||||
return (
|
||||
<header className="event-topbar">
|
||||
<div className="event-brand">
|
||||
<span className="event-logo">
|
||||
<EventLensMark />
|
||||
</span>
|
||||
<div>
|
||||
<strong>EventLens</strong>
|
||||
<small>Windows incident reconstruction</small>
|
||||
</div>
|
||||
</div>
|
||||
<WorkspaceNav activeWorkspace={activeWorkspace} onNavigate={onNavigate} />
|
||||
<div className="instance-status">
|
||||
<span aria-hidden="true" />
|
||||
<div>
|
||||
<b>Local Instance</b>
|
||||
<small>v{version}</small>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
|
||||
export function InvestigationContext({ data, activeIncident, visibleCount, workspace }: { data: Analysis | null; activeIncident: Incident | null; visibleCount?: number; workspace: Workspace }) {
|
||||
if (workspace === "settings") return <section className="investigation-context preferences-context" aria-label="Local preferences context"><div className="investigation-source"><Icon name="settings" /><span><b>Local preferences</b><small>Interface preferences for this session</small></span></div><div className="context-facts"><span>Event text, files and evidence are never stored here</span></div></section>;
|
||||
export function InvestigationContext({
|
||||
data,
|
||||
activeIncident,
|
||||
visibleCount,
|
||||
workspace,
|
||||
}: {
|
||||
data: Analysis | null;
|
||||
activeIncident: Incident | null;
|
||||
visibleCount?: number;
|
||||
workspace: Workspace;
|
||||
}) {
|
||||
if (workspace === "settings")
|
||||
return (
|
||||
<section className="investigation-context preferences-context" aria-label="Local preferences context">
|
||||
<div className="investigation-source">
|
||||
<Icon name="settings" />
|
||||
<span>
|
||||
<b>Local preferences</b>
|
||||
<small>Interface preferences for this session</small>
|
||||
</span>
|
||||
</div>
|
||||
<div className="context-facts">
|
||||
<span>Event text, files and evidence are never stored here</span>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
if (!data) return null;
|
||||
return <section className="investigation-context" aria-label="Current investigation context"><div className="investigation-source"><Icon name="file" /><span><b title={data.source}>{sourceLabel(data.source)}</b><small>Current forensic session</small></span></div><div className="context-facts"><span className={`status-badge status-${data.parse?.status ?? "demo"}`}>{statusLabel(data)}</span><span>{data.events.length.toLocaleString()} events</span><span>{data.incidents.length} incident{data.incidents.length === 1 ? "" : "s"}</span>{typeof visibleCount === "number" ? <span>{visibleCount.toLocaleString()} visible</span> : null}</div>{activeIncident ? <span className="context-incident" title={activeIncident.title}>Incident: <b>{activeIncident.title}</b></span> : null}</section>;
|
||||
return (
|
||||
<section className="investigation-context" aria-label="Current investigation context">
|
||||
<div className="investigation-source">
|
||||
<Icon name="file" />
|
||||
<span>
|
||||
<b title={data.source}>{sourceLabel(data.source)}</b>
|
||||
<small>Current forensic session</small>
|
||||
</span>
|
||||
</div>
|
||||
<div className="context-facts">
|
||||
<span className={`status-badge status-${data.parse?.status ?? "demo"}`}>{statusLabel(data)}</span>
|
||||
<span>{data.events.length.toLocaleString()} events</span>
|
||||
<span>
|
||||
{data.incidents.length} incident{data.incidents.length === 1 ? "" : "s"}
|
||||
</span>
|
||||
{typeof visibleCount === "number" ? <span>{visibleCount.toLocaleString()} visible</span> : null}
|
||||
</div>
|
||||
{activeIncident ? (
|
||||
<span className="context-incident" title={activeIncident.title}>
|
||||
Incident: <b>{activeIncident.title}</b>
|
||||
</span>
|
||||
) : null}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
export function GlobalActions({ loading, dragging, onOpen, onDemo, workspace }: { loading: boolean; dragging: boolean; onOpen: () => void; onDemo: () => void; workspace: Workspace }) {
|
||||
export function GlobalActions({
|
||||
loading,
|
||||
dragging,
|
||||
onOpen,
|
||||
onDemo,
|
||||
workspace,
|
||||
}: {
|
||||
loading: boolean;
|
||||
dragging: boolean;
|
||||
onOpen: () => void;
|
||||
onDemo: () => void;
|
||||
workspace: Workspace;
|
||||
}) {
|
||||
const secondary = workspace === "reports" || workspace === "settings";
|
||||
return <section className={`global-actions ${dragging ? "dragging" : ""} ${secondary ? "global-actions-secondary" : ""}`} aria-label="Analysis actions"><div className="action-buttons"><button type="button" className="primary-button" onClick={onOpen} disabled={loading}><Icon name="upload" />{loading ? "Analyzing…" : "Open .evtx"}</button><button type="button" className="secondary-button" onClick={onDemo} disabled={loading}><Icon name="demo" />Load demo</button><span className="drop-hint">Drop an .evtx file anywhere in the workspace</span></div><span className="context-muted">Local, in-memory analysis</span></section>;
|
||||
return (
|
||||
<section
|
||||
className={`global-actions ${dragging ? "dragging" : ""} ${secondary ? "global-actions-secondary" : ""}`}
|
||||
aria-label="Analysis actions"
|
||||
>
|
||||
<div className="action-buttons">
|
||||
<button type="button" className="primary-button" onClick={onOpen} disabled={loading}>
|
||||
<Icon name="upload" />
|
||||
{loading ? "Analyzing…" : "Open .evtx"}
|
||||
</button>
|
||||
<button type="button" className="secondary-button" onClick={onDemo} disabled={loading}>
|
||||
<Icon name="demo" />
|
||||
Load demo
|
||||
</button>
|
||||
<span className="drop-hint">Drop an .evtx file anywhere in the workspace</span>
|
||||
</div>
|
||||
<span className="context-muted">Local, in-memory analysis</span>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
export function Statusbar({ data }: { data: Analysis | null }) {
|
||||
return <footer className="event-statusbar"><span><Icon name="file" /> {data ? sourceLabel(data.source) : "No source loaded"}</span><span><Icon name="info" /> {data ? `${data.events.length.toLocaleString()} events` : "Local only"}</span><span className={data?.parse?.status === "partial" ? "partial" : "complete"}><i className="status-dot" aria-hidden="true" /> {statusLabel(data)}</span></footer>;
|
||||
return (
|
||||
<footer className="event-statusbar">
|
||||
<span>
|
||||
<Icon name="file" /> {data ? sourceLabel(data.source) : "No source loaded"}
|
||||
</span>
|
||||
<span>
|
||||
<Icon name="info" /> {data ? `${data.events.length.toLocaleString()} events` : "Local only"}
|
||||
</span>
|
||||
<span className={data?.parse?.status === "partial" ? "partial" : "complete"}>
|
||||
<i className="status-dot" aria-hidden="true" /> {statusLabel(data)}
|
||||
</span>
|
||||
</footer>
|
||||
);
|
||||
}
|
||||
@@ -4,33 +4,196 @@ import { formatRange } from "../app/format";
|
||||
import type { TimestampDisplay } from "../app/model";
|
||||
import { Icon } from "./icons";
|
||||
|
||||
export function WorkspaceHeader({ eyebrow, title, description, action }: { eyebrow: string; title: string; description: string; action?: ReactNode }) {
|
||||
return <header className="workspace-header"><div><p className="eyebrow">{eyebrow}</p><h1>{title}</h1><p className="workspace-description">{description}</p></div>{action ? <div className="workspace-header-action">{action}</div> : null}</header>;
|
||||
export function WorkspaceHeader({
|
||||
eyebrow,
|
||||
title,
|
||||
description,
|
||||
action,
|
||||
}: {
|
||||
eyebrow: string;
|
||||
title: string;
|
||||
description: string;
|
||||
action?: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<header className="workspace-header">
|
||||
<div>
|
||||
<p className="eyebrow">{eyebrow}</p>
|
||||
<h1>{title}</h1>
|
||||
<p className="workspace-description">{description}</p>
|
||||
</div>
|
||||
{action ? <div className="workspace-header-action">{action}</div> : null}
|
||||
</header>
|
||||
);
|
||||
}
|
||||
|
||||
export function EmptyState({ onOpen, onDemo, title = "No event log loaded", description = "Open a local EVTX file or load the deterministic demo to begin an evidence-based investigation." }: { onOpen: () => void; onDemo: () => void; title?: string; description?: string }) {
|
||||
return <section className="empty-state" aria-live="polite"><div className="empty-state-mark"><Icon name="file" /></div><div><h2>{title}</h2><p>{description}</p><ol className="workflow-steps" aria-label="EventLens investigation workflow"><li>EVTX</li><li>Normalize</li><li>Correlate</li><li>Inspect evidence</li><li>Review/export</li></ol><p className="empty-privacy">Analysis stays local, uploads are not intentionally persisted, parsing is bounded, and exports have a redaction preview.</p><div className="empty-actions"><button type="button" className="primary-button" onClick={onOpen}><Icon name="upload" />Open .evtx</button><button type="button" className="secondary-button" onClick={onDemo}><Icon name="demo" />Load demo</button></div></div></section>;
|
||||
export function EmptyState({
|
||||
onOpen,
|
||||
onDemo,
|
||||
title = "No event log loaded",
|
||||
description = "Open a local EVTX file or load the deterministic demo to begin an evidence-based investigation.",
|
||||
}: {
|
||||
onOpen: () => void;
|
||||
onDemo: () => void;
|
||||
title?: string;
|
||||
description?: string;
|
||||
}) {
|
||||
return (
|
||||
<section className="empty-state" aria-live="polite">
|
||||
<div className="empty-state-mark">
|
||||
<Icon name="file" />
|
||||
</div>
|
||||
<div>
|
||||
<h2>{title}</h2>
|
||||
<p>{description}</p>
|
||||
<ol className="workflow-steps" aria-label="EventLens investigation workflow">
|
||||
<li>EVTX</li>
|
||||
<li>Normalize</li>
|
||||
<li>Correlate</li>
|
||||
<li>Inspect evidence</li>
|
||||
<li>Review/export</li>
|
||||
</ol>
|
||||
<p className="empty-privacy">
|
||||
Analysis stays local, uploads are not intentionally persisted, parsing is bounded, and exports have a
|
||||
redaction preview.
|
||||
</p>
|
||||
<div className="empty-actions">
|
||||
<button type="button" className="primary-button" onClick={onOpen}>
|
||||
<Icon name="upload" />
|
||||
Open .evtx
|
||||
</button>
|
||||
<button type="button" className="secondary-button" onClick={onDemo}>
|
||||
<Icon name="demo" />
|
||||
Load demo
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
export function PartialAnalysisWarning({ parse }: { parse?: ParseStats | null }) {
|
||||
if (!parse || parse.status !== "partial") return null;
|
||||
return <section className="partial-warning" role="alert" aria-live="assertive"><div className="notice-title"><Icon name="warning" /><div><strong>Partial analysis — incident reconstruction may be incomplete</strong><span>{parse.parsed_events.toLocaleString()} events retained from {parse.records_seen.toLocaleString()} records seen; {parse.skipped_records.toLocaleString()} observed record(s) were not retained.</span></div></div><p>Review parser issues before treating the timeline or exports as a complete investigation.</p><ul>{parse.issues.slice(0, 5).map((issue, index) => <li key={`${issue.code}-${issue.record_id ?? "none"}-${index}`}><code>{issue.code}</code> — {issue.message}</li>)}</ul></section>;
|
||||
return (
|
||||
<section className="partial-warning" role="alert" aria-live="assertive">
|
||||
<div className="notice-title">
|
||||
<Icon name="warning" />
|
||||
<div>
|
||||
<strong>Partial analysis — incident reconstruction may be incomplete</strong>
|
||||
<span>
|
||||
{parse.parsed_events.toLocaleString()} events retained from {parse.records_seen.toLocaleString()} records
|
||||
seen; {parse.skipped_records.toLocaleString()} observed record(s) were not retained.
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<p>Review parser issues before treating the timeline or exports as a complete investigation.</p>
|
||||
<ul>
|
||||
{parse.issues.slice(0, 5).map((issue, index) => (
|
||||
<li key={`${issue.code}-${issue.record_id ?? "none"}-${index}`}>
|
||||
<code>{issue.code}</code> — {issue.message}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
export function ParserIssueNotice({ parse }: { parse?: ParseStats | null }) {
|
||||
if (!parse || !parse.issues.length) return null;
|
||||
return <section className="parser-issues" role="status"><strong>Parser notes</strong><span>{parse.issues.length} non-fatal parser issue(s) were retained with the evidence. Review data-quality notes before exporting.</span><ul>{parse.issues.slice(0, 4).map((issue, index) => <li key={`${issue.code}-${issue.record_id ?? "none"}-${index}`}><code>{issue.code}</code> — {issue.message}</li>)}</ul></section>;
|
||||
return (
|
||||
<section className="parser-issues" role="status">
|
||||
<strong>Parser notes</strong>
|
||||
<span>
|
||||
{parse.issues.length} non-fatal parser issue(s) were retained with the evidence. Review data-quality notes
|
||||
before exporting.
|
||||
</span>
|
||||
<ul>
|
||||
{parse.issues.slice(0, 4).map((issue, index) => (
|
||||
<li key={`${issue.code}-${issue.record_id ?? "none"}-${index}`}>
|
||||
<code>{issue.code}</code> — {issue.message}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
export function ErrorBanner({ message, onDemo }: { message: string; onDemo: () => void }) {
|
||||
return <section className="error-banner" role="alert"><div><strong>Analysis could not be completed</strong><span>{message}</span></div><button type="button" className="text-button" onClick={onDemo}>Load demo instead</button></section>;
|
||||
return (
|
||||
<section className="error-banner" role="alert">
|
||||
<div>
|
||||
<strong>Analysis could not be completed</strong>
|
||||
<span>{message}</span>
|
||||
</div>
|
||||
<button type="button" className="text-button" onClick={onDemo}>
|
||||
Load demo instead
|
||||
</button>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
export function MetricCard({ icon, value, label, tone = "blue" }: { icon: ReactNode; value: string | number; label: string; tone?: "blue" | "amber" | "green" }) {
|
||||
return <div className={`metric-card tone-${tone}`}><span className="metric-icon">{icon}</span><strong>{value}</strong><span>{label}</span></div>;
|
||||
export function MetricCard({
|
||||
icon,
|
||||
value,
|
||||
label,
|
||||
tone = "blue",
|
||||
}: {
|
||||
icon: ReactNode;
|
||||
value: string | number;
|
||||
label: string;
|
||||
tone?: "blue" | "amber" | "green";
|
||||
}) {
|
||||
return (
|
||||
<div className={`metric-card tone-${tone}`}>
|
||||
<span className="metric-icon">{icon}</span>
|
||||
<strong>{value}</strong>
|
||||
<span>{label}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function IncidentCard({ incident, timestampDisplay, selected, onOpen }: { incident: Incident; timestampDisplay: TimestampDisplay; selected: boolean; onOpen: (incident: Incident) => void }) {
|
||||
const severity = incident.severity === "critical" || incident.severity === "error" ? "high" : incident.severity === "warning" ? "medium" : "info";
|
||||
return <button type="button" className={`incident-card severity-${severity} ${selected ? "selected" : ""}`} onClick={() => onOpen(incident)}><div className="incident-card-heading"><span className="incident-icon"><Icon name="warning" /></span><strong>{incident.title}</strong><span className="severity-pill">{severity === "high" ? "High" : severity === "medium" ? "Medium" : "Info"}</span></div><p>{incident.reasons[0] ?? "Evidence was grouped by a deterministic EventLens rule."}</p><footer><span>{formatRange(incident.start, incident.end, timestampDisplay)}</span><b>{incident.original_count} event{incident.original_count === 1 ? "" : "s"}</b></footer><span className="incident-card-action">Inspect evidence <Icon name="arrow-right" /></span></button>;
|
||||
export function IncidentCard({
|
||||
incident,
|
||||
timestampDisplay,
|
||||
selected,
|
||||
onOpen,
|
||||
}: {
|
||||
incident: Incident;
|
||||
timestampDisplay: TimestampDisplay;
|
||||
selected: boolean;
|
||||
onOpen: (incident: Incident) => void;
|
||||
}) {
|
||||
const severity =
|
||||
incident.severity === "critical" || incident.severity === "error"
|
||||
? "high"
|
||||
: incident.severity === "warning"
|
||||
? "medium"
|
||||
: "info";
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
className={`incident-card severity-${severity} ${selected ? "selected" : ""}`}
|
||||
onClick={() => onOpen(incident)}
|
||||
>
|
||||
<div className="incident-card-heading">
|
||||
<span className="incident-icon">
|
||||
<Icon name="warning" />
|
||||
</span>
|
||||
<strong>{incident.title}</strong>
|
||||
<span className="severity-pill">
|
||||
{severity === "high" ? "High" : severity === "medium" ? "Medium" : "Info"}
|
||||
</span>
|
||||
</div>
|
||||
<p>{incident.reasons[0] ?? "Evidence was grouped by a deterministic EventLens rule."}</p>
|
||||
<footer>
|
||||
<span>{formatRange(incident.start, incident.end, timestampDisplay)}</span>
|
||||
<b>
|
||||
{incident.original_count} event{incident.original_count === 1 ? "" : "s"}
|
||||
</b>
|
||||
</footer>
|
||||
<span className="incident-card-action">
|
||||
Inspect evidence <Icon name="arrow-right" />
|
||||
</span>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -1,29 +1,280 @@
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import type { Analysis, EventItem, Incident } from "../types";
|
||||
import { formatClock, formatDate, formatDateTime, levelLabel } from "../app/format";
|
||||
import { CATEGORIES, LEVELS, OVERSCAN, WINDOWS, type FilterState, type InspectorTab, type TimestampDisplay } from "../app/model";
|
||||
import {
|
||||
CATEGORIES,
|
||||
LEVELS,
|
||||
OVERSCAN,
|
||||
WINDOWS,
|
||||
type FilterState,
|
||||
type InspectorTab,
|
||||
type TimestampDisplay,
|
||||
} from "../app/model";
|
||||
import { Icon } from "./icons";
|
||||
import { analysisIndex, evidenceEvents } from "../app/indexes";
|
||||
|
||||
export const MAX_INCIDENT_OPTIONS = 500;
|
||||
|
||||
export function filterCount(filters: FilterState): number {
|
||||
return [filters.search, filters.category, filters.level, filters.provider, filters.windowMinutes > 0 ? filters.windowMinutes : "", filters.attentionOnly ? "attention" : ""].filter(Boolean).length;
|
||||
return [
|
||||
filters.search,
|
||||
filters.category,
|
||||
filters.level,
|
||||
filters.provider,
|
||||
filters.windowMinutes > 0 ? filters.windowMinutes : "",
|
||||
filters.attentionOnly ? "attention" : "",
|
||||
].filter(Boolean).length;
|
||||
}
|
||||
|
||||
export function FilterToolbar({ filters, providers, visibleCount, totalCount, anchorTimestamp, activeIncident, focusIncident, onFocusChange, onChange, onReset }: { filters: FilterState; providers: string[]; visibleCount: number; totalCount: number; anchorTimestamp: string | null; activeIncident: Incident | null; focusIncident: boolean; onFocusChange: (value: boolean) => void; onChange: (patch: Partial<FilterState>) => void; onReset: () => void }) {
|
||||
export function FilterToolbar({
|
||||
filters,
|
||||
providers,
|
||||
visibleCount,
|
||||
totalCount,
|
||||
anchorTimestamp,
|
||||
activeIncident,
|
||||
focusIncident,
|
||||
onFocusChange,
|
||||
onChange,
|
||||
onReset,
|
||||
}: {
|
||||
filters: FilterState;
|
||||
providers: string[];
|
||||
visibleCount: number;
|
||||
totalCount: number;
|
||||
anchorTimestamp: string | null;
|
||||
activeIncident: Incident | null;
|
||||
focusIncident: boolean;
|
||||
onFocusChange: (value: boolean) => void;
|
||||
onChange: (patch: Partial<FilterState>) => void;
|
||||
onReset: () => void;
|
||||
}) {
|
||||
const active = filterCount(filters);
|
||||
return <section className="filter-toolbar" aria-label="Timeline filters"><div className="filter-primary"><label className="search-field"><Icon name="search" /><span className="sr-only">Search normalized evidence</span><input aria-label="Search normalized evidence" value={filters.search} onChange={(event) => onChange({ search: event.target.value })} placeholder="Search evidence, paths, IDs, fields…" /></label><span className="result-count" role="status"><strong>{visibleCount.toLocaleString()}</strong> of {totalCount.toLocaleString()} visible</span></div><div className="filter-secondary"><label><span>Category</span><select aria-label="Filter by category" value={filters.category} onChange={(event) => onChange({ category: event.target.value })}><option value="">All categories</option>{CATEGORIES.map((value) => <option key={value}>{value}</option>)}</select></label><label><span>Level</span><select aria-label="Filter by level" value={filters.level} onChange={(event) => onChange({ level: event.target.value })}><option value="">All levels</option>{LEVELS.map((value) => <option key={value}>{value}</option>)}</select></label><label className="provider-filter"><span>Provider</span><select aria-label="Filter by provider" value={filters.provider} onChange={(event) => onChange({ provider: event.target.value })}><option value="">All providers</option>{providers.map((value) => <option key={value}>{value}</option>)}</select></label><label><span>Time window</span><select aria-label="Evidence time window" value={filters.windowMinutes} onChange={(event) => onChange({ windowMinutes: Number(event.target.value) })} disabled={!anchorTimestamp}><option value={0}>All time</option>{WINDOWS.filter(Boolean).map((value) => <option value={value} key={value}>± {value} min</option>)}</select></label></div><div className="filter-actions"><label className="toggle-control"><input type="checkbox" checked={filters.attentionOnly} onChange={(event) => onChange({ attentionOnly: event.target.checked })} /><span className="toggle-track" /><span>Hide informational noise</span></label><label className="toggle-control"><input type="checkbox" checked={focusIncident} onChange={(event) => onFocusChange(event.target.checked)} disabled={!activeIncident} /><span className="toggle-track" /><span>Focus incident</span></label><button type="button" className="reset-button" onClick={onReset} disabled={!active}><Icon name="reset" />Reset filters{active ? ` (${active})` : ""}</button></div>{active || (focusIncident && activeIncident) ? <div className="filter-chips" aria-label="Active filters">{filters.search ? <span>Search: {filters.search}</span> : null}{filters.category ? <span>Category: {filters.category}</span> : null}{filters.level ? <span>Level: {filters.level}</span> : null}{filters.provider ? <span>Provider: {filters.provider}</span> : null}{filters.windowMinutes ? <span>± {filters.windowMinutes} min</span> : null}{filters.attentionOnly ? <span>Informational hidden</span> : null}{focusIncident && activeIncident ? <span>Incident focus: {activeIncident.title}</span> : null}</div> : null}</section>;
|
||||
return (
|
||||
<section className="filter-toolbar" aria-label="Timeline filters">
|
||||
<div className="filter-primary">
|
||||
<label className="search-field">
|
||||
<Icon name="search" />
|
||||
<span className="sr-only">Search normalized evidence</span>
|
||||
<input
|
||||
aria-label="Search normalized evidence"
|
||||
value={filters.search}
|
||||
onChange={(event) => onChange({ search: event.target.value })}
|
||||
placeholder="Search evidence, paths, IDs, fields…"
|
||||
/>
|
||||
</label>
|
||||
<span className="result-count" role="status">
|
||||
<strong>{visibleCount.toLocaleString()}</strong> of {totalCount.toLocaleString()} visible
|
||||
</span>
|
||||
</div>
|
||||
<div className="filter-secondary">
|
||||
<label>
|
||||
<span>Category</span>
|
||||
<select
|
||||
aria-label="Filter by category"
|
||||
value={filters.category}
|
||||
onChange={(event) => onChange({ category: event.target.value })}
|
||||
>
|
||||
<option value="">All categories</option>
|
||||
{CATEGORIES.map((value) => (
|
||||
<option key={value}>{value}</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
<span>Level</span>
|
||||
<select
|
||||
aria-label="Filter by level"
|
||||
value={filters.level}
|
||||
onChange={(event) => onChange({ level: event.target.value })}
|
||||
>
|
||||
<option value="">All levels</option>
|
||||
{LEVELS.map((value) => (
|
||||
<option key={value}>{value}</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label className="provider-filter">
|
||||
<span>Provider</span>
|
||||
<select
|
||||
aria-label="Filter by provider"
|
||||
value={filters.provider}
|
||||
onChange={(event) => onChange({ provider: event.target.value })}
|
||||
>
|
||||
<option value="">All providers</option>
|
||||
{providers.map((value) => (
|
||||
<option key={value}>{value}</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
<span>Time window</span>
|
||||
<select
|
||||
aria-label="Evidence time window"
|
||||
value={filters.windowMinutes}
|
||||
onChange={(event) => onChange({ windowMinutes: Number(event.target.value) })}
|
||||
disabled={!anchorTimestamp}
|
||||
>
|
||||
<option value={0}>All time</option>
|
||||
{WINDOWS.filter(Boolean).map((value) => (
|
||||
<option value={value} key={value}>
|
||||
± {value} min
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<div className="filter-actions">
|
||||
<label className="toggle-control">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={filters.attentionOnly}
|
||||
onChange={(event) => onChange({ attentionOnly: event.target.checked })}
|
||||
/>
|
||||
<span className="toggle-track" />
|
||||
<span>Hide informational noise</span>
|
||||
</label>
|
||||
<label className="toggle-control">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={focusIncident}
|
||||
onChange={(event) => onFocusChange(event.target.checked)}
|
||||
disabled={!activeIncident}
|
||||
/>
|
||||
<span className="toggle-track" />
|
||||
<span>Focus incident</span>
|
||||
</label>
|
||||
<button type="button" className="reset-button" onClick={onReset} disabled={!active}>
|
||||
<Icon name="reset" />
|
||||
Reset filters{active ? ` (${active})` : ""}
|
||||
</button>
|
||||
</div>
|
||||
{active || (focusIncident && activeIncident) ? (
|
||||
<div className="filter-chips" aria-label="Active filters">
|
||||
{filters.search ? <span>Search: {filters.search}</span> : null}
|
||||
{filters.category ? <span>Category: {filters.category}</span> : null}
|
||||
{filters.level ? <span>Level: {filters.level}</span> : null}
|
||||
{filters.provider ? <span>Provider: {filters.provider}</span> : null}
|
||||
{filters.windowMinutes ? (
|
||||
<span title={filters.windowAnchor ?? undefined}>± {filters.windowMinutes} min around pinned evidence</span>
|
||||
) : null}
|
||||
{filters.attentionOnly ? <span>Informational hidden</span> : null}
|
||||
{focusIncident && activeIncident ? <span>Incident focus: {activeIncident.title}</span> : null}
|
||||
</div>
|
||||
) : null}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
export function IncidentContext({ incidents, activeIncidentId, focusIncident, onSelect, onFocus }: { incidents: Incident[]; activeIncidentId: string; focusIncident: boolean; onSelect: (id: string) => void; onFocus: (value: boolean) => void }) {
|
||||
export function IncidentContext({
|
||||
incidents,
|
||||
activeIncidentId,
|
||||
focusIncident,
|
||||
onSelect,
|
||||
onFocus,
|
||||
}: {
|
||||
incidents: Incident[];
|
||||
activeIncidentId: string;
|
||||
focusIncident: boolean;
|
||||
onSelect: (id: string) => void;
|
||||
onFocus: (value: boolean) => void;
|
||||
}) {
|
||||
if (!incidents.length) return null;
|
||||
const active = incidents.find((incident) => incident.id === activeIncidentId) ?? null;
|
||||
return <section className="incident-context"><label><span>Selected incident</span><select aria-label="Select incident" value={activeIncidentId} onChange={(event) => onSelect(event.target.value)}><option value="">No incident selected</option>{incidents.map((incident) => <option key={incident.id} value={incident.id}>{incident.title}</option>)}</select></label>{active ? <div className="incident-context-detail"><span className={`incident-focus-chip ${focusIncident ? "active" : ""}`}>{focusIncident ? "Focus active" : "Incident selected"}</span><span>{active.evidence_event_ids.length} linked evidence IDs</span><button type="button" className="text-button" onClick={() => onFocus(!focusIncident)}>{focusIncident ? "Stop focus" : "Focus evidence"}</button></div> : null}</section>;
|
||||
const options = incidents.length > MAX_INCIDENT_OPTIONS ? incidents.slice(0, MAX_INCIDENT_OPTIONS) : incidents;
|
||||
if (active && options !== incidents && !options.includes(active)) options.push(active);
|
||||
return (
|
||||
<section className="incident-context">
|
||||
<label>
|
||||
<span>Selected incident</span>
|
||||
<select
|
||||
aria-label="Select incident"
|
||||
value={activeIncidentId}
|
||||
onChange={(event) => onSelect(event.target.value)}
|
||||
>
|
||||
<option value="">No incident selected</option>
|
||||
{options.map((incident) => (
|
||||
<option key={incident.id} value={incident.id}>
|
||||
{incident.title}
|
||||
</option>
|
||||
))}
|
||||
{incidents.length > options.length ? (
|
||||
<option disabled value="__more">
|
||||
{(incidents.length - options.length).toLocaleString()} more incidents — open them from Analysis
|
||||
</option>
|
||||
) : null}
|
||||
</select>
|
||||
</label>
|
||||
{active ? (
|
||||
<div className="incident-context-detail">
|
||||
<span className={`incident-focus-chip ${focusIncident ? "active" : ""}`}>
|
||||
{focusIncident ? "Focus active" : "Incident selected"}
|
||||
</span>
|
||||
<span>{active.evidence_event_ids.length} linked evidence IDs</span>
|
||||
<button type="button" className="text-button" onClick={() => onFocus(!focusIncident)}>
|
||||
{focusIncident ? "Stop focus" : "Focus evidence"}
|
||||
</button>
|
||||
</div>
|
||||
) : null}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
function EventRow({ event, selected, position, total, rowHeight, timestampDisplay, onSelect }: { event: EventItem; selected: boolean; position: number; total: number; rowHeight: number; timestampDisplay: TimestampDisplay; onSelect: (event: EventItem) => void }) {
|
||||
return <div role="listitem" aria-posinset={position} aria-setsize={total} style={{ height: rowHeight }}><button type="button" className={`event-row ${selected ? "active" : ""}`} style={{ height: rowHeight }} aria-label={`${event.provider}, event ${event.event_id ?? "unknown"}, ${event.summary}`} onClick={() => onSelect(event)}><span className={`event-rail rail-${event.level}`} aria-hidden="true"><span /></span><time>{formatClock(event.timestamp, timestampDisplay)}</time><b className="event-id">{event.event_id ?? "—"}</b><span className="event-copy"><strong>{event.provider}</strong><span>{event.summary}</span></span><span className="event-host">{event.computer || "—"}</span><span className={`event-level level-${event.level}`}>{levelLabel(event.level)}</span></button></div>;
|
||||
function EventRow({
|
||||
event,
|
||||
selected,
|
||||
position,
|
||||
total,
|
||||
rowHeight,
|
||||
timestampDisplay,
|
||||
onSelect,
|
||||
}: {
|
||||
event: EventItem;
|
||||
selected: boolean;
|
||||
position: number;
|
||||
total: number;
|
||||
rowHeight: number;
|
||||
timestampDisplay: TimestampDisplay;
|
||||
onSelect: (event: EventItem) => void;
|
||||
}) {
|
||||
return (
|
||||
<div role="listitem" aria-posinset={position} aria-setsize={total} style={{ height: rowHeight }}>
|
||||
<button
|
||||
type="button"
|
||||
className={`event-row ${selected ? "active" : ""}`}
|
||||
style={{ height: rowHeight }}
|
||||
aria-label={`${event.provider}, event ${event.event_id ?? "unknown"}, ${event.summary}`}
|
||||
onClick={() => onSelect(event)}
|
||||
>
|
||||
<span className={`event-rail rail-${event.level}`} aria-hidden="true">
|
||||
<span />
|
||||
</span>
|
||||
<time>{formatClock(event.timestamp, timestampDisplay)}</time>
|
||||
<b className="event-id">{event.event_id ?? "—"}</b>
|
||||
<span className="event-copy">
|
||||
<strong>{event.provider}</strong>
|
||||
<span>{event.summary}</span>
|
||||
</span>
|
||||
<span className="event-host">{event.computer || "—"}</span>
|
||||
<span className={`event-level level-${event.level}`}>{levelLabel(event.level)}</span>
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function VirtualizedEventList({ events, selectedId, rowHeight, timestampDisplay, onSelect }: { events: EventItem[]; selectedId?: string | null; rowHeight: number; timestampDisplay: TimestampDisplay; onSelect: (event: EventItem) => void }) {
|
||||
export function VirtualizedEventList({
|
||||
events,
|
||||
selectedId,
|
||||
rowHeight,
|
||||
timestampDisplay,
|
||||
onSelect,
|
||||
}: {
|
||||
events: EventItem[];
|
||||
selectedId?: string | null;
|
||||
rowHeight: number;
|
||||
timestampDisplay: TimestampDisplay;
|
||||
onSelect: (event: EventItem) => void;
|
||||
}) {
|
||||
const [scrollTop, setScrollTop] = useState(0);
|
||||
const listRef = useRef<HTMLDivElement>(null);
|
||||
const [viewportHeight, setViewportHeight] = useState(520);
|
||||
@@ -36,11 +287,43 @@ export function VirtualizedEventList({ events, selectedId, rowHeight, timestampD
|
||||
observer.observe(node);
|
||||
return () => observer.disconnect();
|
||||
}, []);
|
||||
if (!events.length) return <div className="event-list empty-list"><p role="status">No events match the current filters. Reset a filter or show informational noise to continue.</p></div>;
|
||||
if (!events.length)
|
||||
return (
|
||||
<div className="event-list empty-list">
|
||||
<p role="status">
|
||||
No events match the current filters. Reset a filter or show informational noise to continue.
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
const first = Math.max(0, Math.floor(scrollTop / rowHeight) - OVERSCAN);
|
||||
const visibleCount = Math.ceil(viewportHeight / rowHeight) + OVERSCAN * 2;
|
||||
const last = Math.min(events.length, first + visibleCount);
|
||||
return <div className="event-list" ref={listRef} onScroll={(event) => setScrollTop(event.currentTarget.scrollTop)} role="list" aria-label="Normalized event timeline"><div className="event-list-inner" style={{ height: events.length * rowHeight }}><div className="event-list-window" style={{ transform: `translateY(${first * rowHeight}px)` }}>{events.slice(first, last).map((event, index) => <EventRow key={event.id} event={event} selected={selectedId === event.id} position={first + index + 1} total={events.length} rowHeight={rowHeight} timestampDisplay={timestampDisplay} onSelect={onSelect} />)}</div></div></div>;
|
||||
return (
|
||||
<div
|
||||
className="event-list"
|
||||
ref={listRef}
|
||||
onScroll={(event) => setScrollTop(event.currentTarget.scrollTop)}
|
||||
role="list"
|
||||
aria-label="Normalized event timeline"
|
||||
>
|
||||
<div className="event-list-inner" style={{ height: events.length * rowHeight }}>
|
||||
<div className="event-list-window" style={{ transform: `translateY(${first * rowHeight}px)` }}>
|
||||
{events.slice(first, last).map((event, index) => (
|
||||
<EventRow
|
||||
key={event.id}
|
||||
event={event}
|
||||
selected={selectedId === event.id}
|
||||
position={first + index + 1}
|
||||
total={events.length}
|
||||
rowHeight={rowHeight}
|
||||
timestampDisplay={timestampDisplay}
|
||||
onSelect={onSelect}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export type InspectorProps = {
|
||||
@@ -56,14 +339,275 @@ export type InspectorProps = {
|
||||
onOpenTimeline?: () => void;
|
||||
};
|
||||
|
||||
export function EvidenceInspector({ data, event, visibleEvents, activeIncident, timestampDisplay, tab, onTab, onSelectEvent, onMove, onOpenTimeline }: InspectorProps) {
|
||||
export function EvidenceInspector({
|
||||
data,
|
||||
event,
|
||||
visibleEvents,
|
||||
activeIncident,
|
||||
timestampDisplay,
|
||||
tab,
|
||||
onTab,
|
||||
onSelectEvent,
|
||||
onMove,
|
||||
onOpenTimeline,
|
||||
}: InspectorProps) {
|
||||
const selectedIndex = event ? visibleEvents.findIndex((item) => item.id === event.id) : -1;
|
||||
const relatedIncident = event ? data.incidents.find((incident) => incident.evidence_event_ids.includes(event.id)) ?? activeIncident : activeIncident;
|
||||
const relatedEvents = relatedIncident ? data.events.filter((item) => relatedIncident.evidence_event_ids.includes(item.id)) : [];
|
||||
const copy = async (value: string) => { if (navigator.clipboard) await navigator.clipboard.writeText(value); };
|
||||
return <aside className="inspector-panel"><header className="panel-header"><div><p className="eyebrow">Evidence</p><h2>Inspector</h2></div><div className="inspector-navigation"><button type="button" aria-label="Previous evidence" onClick={() => onMove(-1)} disabled={!visibleEvents.length || selectedIndex <= 0}><Icon name="arrow-left" /></button><span>{selectedIndex >= 0 ? selectedIndex + 1 : 0} of {visibleEvents.length}</span><button type="button" aria-label="Next evidence" onClick={() => onMove(1)} disabled={!visibleEvents.length || selectedIndex === visibleEvents.length - 1}><Icon name="arrow-right" /></button></div></header>{event ? <><div className="inspector-title"><div><h3>{event.summary}</h3><p>Event ID {event.event_id ?? "—"} · {event.provider}</p></div><span className={`event-level level-${event.level}`}>{levelLabel(event.level)}</span></div>{onOpenTimeline ? <div className="inspector-actions"><button type="button" className="text-button" onClick={onOpenTimeline}>Open in Timeline <Icon name="arrow-right" /></button></div> : null}<div className="inspector-tabs" role="tablist" aria-label="Evidence views"><button type="button" role="tab" aria-selected={tab === "details"} className={tab === "details" ? "active" : ""} onClick={() => onTab("details")}>Details</button><button type="button" role="tab" aria-selected={tab === "raw"} className={tab === "raw" ? "active" : ""} onClick={() => onTab("raw")}>Normalized JSON</button><button type="button" role="tab" aria-selected={tab === "related"} className={tab === "related" ? "active" : ""} onClick={() => onTab("related")}>Related ({relatedEvents.length})</button><button type="button" role="tab" aria-selected={tab === "insights"} className={tab === "insights" ? "active" : ""} onClick={() => onTab("insights")}>Insights</button></div>{tab === "details" ? <div className="inspector-content"><div className="copy-row"><button type="button" className="quiet-button" onClick={() => void copy(event.id)}>Copy event ID</button><button type="button" className="quiet-button" onClick={() => void copy(JSON.stringify(event, null, 2))}>Copy JSON</button></div><dl className="fact-grid"><div><dt>Timestamp</dt><dd>{formatDateTime(event.timestamp, timestampDisplay)}</dd></div><div><dt>Timestamp source</dt><dd>{event.timestamp_source ?? (event.timestamp ? "event" : "missing")} · {event.timestamp_valid === false ? "unreliable" : "valid"}</dd></div><div><dt>Provider</dt><dd>{event.provider}</dd></div><div><dt>Event ID</dt><dd>{event.event_id ?? "—"}</dd></div><div><dt>Level</dt><dd><span className={`level-dot ${event.level}`} />{event.level}</dd></div><div><dt>Category</dt><dd>{event.category}</dd></div><div><dt>Channel</dt><dd>{event.channel || "—"}</dd></div><div><dt>Computer</dt><dd>{event.computer || "—"}</dd></div></dl><section className="normalized-fields"><header><b>Normalized fields</b><span>{Object.keys(event.fields ?? {}).length}</span></header>{Object.keys(event.fields ?? {}).length ? <div>{Object.entries(event.fields ?? {}).map(([key, value]) => <p key={key}><code>{key.replace(/^EventData\./, "").replace(/^UserData\./, "")}</code><span>{value}</span></p>)}</div> : <p className="muted-copy">No additional normalized fields.</p>}</section></div> : null}{tab === "raw" ? <pre className="inspector-raw">{JSON.stringify(event, null, 2)}</pre> : null}{tab === "related" ? <div className="inspector-content related-events">{relatedIncident ? <><p className="muted-copy">{relatedIncident.title} · {relatedIncident.rule_id}</p>{relatedEvents.map((related) => <button type="button" className={related.id === event.id ? "related-event active" : "related-event"} key={related.id} onClick={() => onSelectEvent(related)}><span>{formatClock(related.timestamp, timestampDisplay)}</span><strong>{related.event_id ?? "—"}</strong><span>{related.summary}</span></button>)}</> : <p className="muted-copy">Select an incident to inspect related evidence.</p>}</div> : null}{tab === "insights" ? <div className="inspector-content insight-copy"><p><strong>Evidence relationship</strong></p><p>{relatedIncident ? relatedIncident.reasons[0] ?? "This event is linked by a deterministic rule." : "This event is not currently linked to a selected incident."}</p><p>EventLens describes evidence-supported temporal or semantic relationships. It does not claim causality.</p></div> : null}</> : <div className="inspector-placeholder"><p>No visible event is selected.</p><span>Clear a filter or show informational noise to continue.</span></div>}</aside>;
|
||||
const index = analysisIndex(data);
|
||||
const relatedIncident = event ? (index.incidentByEvent.get(event.id) ?? activeIncident) : activeIncident;
|
||||
const relatedEvents = evidenceEvents(data, relatedIncident);
|
||||
const relatedCampaign = relatedIncident?.campaign_id
|
||||
? (index.campaignById.get(relatedIncident.campaign_id) ?? null)
|
||||
: null;
|
||||
const copy = async (value: string) => {
|
||||
if (navigator.clipboard) await navigator.clipboard.writeText(value);
|
||||
};
|
||||
return (
|
||||
<aside className="inspector-panel">
|
||||
<header className="panel-header">
|
||||
<div>
|
||||
<p className="eyebrow">Evidence</p>
|
||||
<h2>Inspector</h2>
|
||||
</div>
|
||||
<div className="inspector-navigation">
|
||||
<button
|
||||
type="button"
|
||||
aria-label="Previous evidence"
|
||||
onClick={() => onMove(-1)}
|
||||
disabled={!visibleEvents.length || selectedIndex <= 0}
|
||||
>
|
||||
<Icon name="arrow-left" />
|
||||
</button>
|
||||
<span>
|
||||
{selectedIndex >= 0 ? selectedIndex + 1 : 0} of {visibleEvents.length}
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
aria-label="Next evidence"
|
||||
onClick={() => onMove(1)}
|
||||
disabled={!visibleEvents.length || selectedIndex === visibleEvents.length - 1}
|
||||
>
|
||||
<Icon name="arrow-right" />
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
{event ? (
|
||||
<>
|
||||
<div className="inspector-title">
|
||||
<div>
|
||||
<h3>{event.summary}</h3>
|
||||
<p>
|
||||
Event ID {event.event_id ?? "—"} · {event.provider}
|
||||
</p>
|
||||
</div>
|
||||
<span className={`event-level level-${event.level}`}>{levelLabel(event.level)}</span>
|
||||
</div>
|
||||
{onOpenTimeline ? (
|
||||
<div className="inspector-actions">
|
||||
<button type="button" className="text-button" onClick={onOpenTimeline}>
|
||||
Open in Timeline <Icon name="arrow-right" />
|
||||
</button>
|
||||
</div>
|
||||
) : null}
|
||||
<div className="inspector-tabs" role="tablist" aria-label="Evidence views">
|
||||
<button
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={tab === "details"}
|
||||
className={tab === "details" ? "active" : ""}
|
||||
onClick={() => onTab("details")}
|
||||
>
|
||||
Details
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={tab === "raw"}
|
||||
className={tab === "raw" ? "active" : ""}
|
||||
onClick={() => onTab("raw")}
|
||||
>
|
||||
Normalized JSON
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={tab === "related"}
|
||||
className={tab === "related" ? "active" : ""}
|
||||
onClick={() => onTab("related")}
|
||||
>
|
||||
Related ({relatedEvents.length})
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={tab === "insights"}
|
||||
className={tab === "insights" ? "active" : ""}
|
||||
onClick={() => onTab("insights")}
|
||||
>
|
||||
Insights
|
||||
</button>
|
||||
</div>
|
||||
{tab === "details" ? (
|
||||
<div className="inspector-content">
|
||||
<div className="copy-row">
|
||||
<button type="button" className="quiet-button" onClick={() => void copy(event.id)}>
|
||||
Copy event ID
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="quiet-button"
|
||||
onClick={() => void copy(JSON.stringify(event, null, 2))}
|
||||
>
|
||||
Copy JSON
|
||||
</button>
|
||||
</div>
|
||||
<dl className="fact-grid">
|
||||
<div>
|
||||
<dt>Timestamp</dt>
|
||||
<dd>{formatDateTime(event.timestamp, timestampDisplay)}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Timestamp source</dt>
|
||||
<dd>
|
||||
{event.timestamp_source ?? (event.timestamp ? "event" : "missing")} ·{" "}
|
||||
{event.timestamp_valid === false ? "unreliable" : "valid"}
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Provider</dt>
|
||||
<dd>{event.provider}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Event ID</dt>
|
||||
<dd>{event.event_id ?? "—"}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Level</dt>
|
||||
<dd>
|
||||
<span className={`level-dot ${event.level}`} />
|
||||
{event.level}
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Category</dt>
|
||||
<dd>{event.category}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Channel</dt>
|
||||
<dd>{event.channel || "—"}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Computer</dt>
|
||||
<dd>{event.computer || "—"}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<section className="normalized-fields">
|
||||
<header>
|
||||
<b>Normalized fields</b>
|
||||
<span>{Object.keys(event.fields ?? {}).length}</span>
|
||||
</header>
|
||||
{Object.keys(event.fields ?? {}).length ? (
|
||||
<div>
|
||||
{Object.entries(event.fields ?? {}).map(([key, value]) => (
|
||||
<p key={key}>
|
||||
<code>{key.replace(/^EventData\./, "").replace(/^UserData\./, "")}</code>
|
||||
<span>{value}</span>
|
||||
</p>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<p className="muted-copy">No additional normalized fields.</p>
|
||||
)}
|
||||
</section>
|
||||
</div>
|
||||
) : null}
|
||||
{tab === "raw" ? <pre className="inspector-raw">{JSON.stringify(event, null, 2)}</pre> : null}
|
||||
{tab === "related" ? (
|
||||
<div className="inspector-content related-events">
|
||||
{relatedIncident ? (
|
||||
<>
|
||||
<p className="muted-copy">
|
||||
{relatedIncident.title} · {relatedIncident.rule_id}
|
||||
</p>
|
||||
{relatedCampaign ? (
|
||||
<p className="campaign-note">
|
||||
<Icon name="clock" /> Part of a recurring campaign: {relatedCampaign.incident_ids.length} adjacent
|
||||
windows, {relatedCampaign.event_count.toLocaleString()} events.
|
||||
</p>
|
||||
) : null}
|
||||
{relatedEvents.map((related) => (
|
||||
<button
|
||||
type="button"
|
||||
className={related.id === event.id ? "related-event active" : "related-event"}
|
||||
key={related.id}
|
||||
onClick={() => onSelectEvent(related)}
|
||||
>
|
||||
<span>{formatClock(related.timestamp, timestampDisplay)}</span>
|
||||
<strong>{related.event_id ?? "—"}</strong>
|
||||
<span>{related.summary}</span>
|
||||
</button>
|
||||
))}
|
||||
</>
|
||||
) : (
|
||||
<p className="muted-copy">Select an incident to inspect related evidence.</p>
|
||||
)}
|
||||
</div>
|
||||
) : null}
|
||||
{tab === "insights" ? (
|
||||
<div className="inspector-content insight-copy">
|
||||
<p>
|
||||
<strong>Evidence relationship</strong>
|
||||
</p>
|
||||
<p>
|
||||
{relatedIncident
|
||||
? (relatedIncident.reasons[0] ?? "This event is linked by a deterministic rule.")
|
||||
: "This event is not currently linked to a selected incident."}
|
||||
</p>
|
||||
<p>
|
||||
EventLens describes evidence-supported temporal or semantic relationships. It does not claim causality.
|
||||
</p>
|
||||
</div>
|
||||
) : null}
|
||||
</>
|
||||
) : (
|
||||
<div className="inspector-placeholder">
|
||||
<p>No visible event is selected.</p>
|
||||
<span>Clear a filter or show informational noise to continue.</span>
|
||||
</div>
|
||||
)}
|
||||
</aside>
|
||||
);
|
||||
}
|
||||
|
||||
export function TimelinePanel({ events, selectedId, rowHeight, timestampDisplay, onSelect }: { events: EventItem[]; selectedId: string | null; rowHeight: number; timestampDisplay: TimestampDisplay; onSelect: (event: EventItem) => void }) {
|
||||
return <article className="timeline-panel panel"><header className="panel-header"><div><p className="eyebrow">Chronological evidence</p><h2>Event timeline</h2></div><span className="panel-count">{events.length.toLocaleString()} visible</span></header><div className="date-band">{formatDate(events[0]?.timestamp ?? null, timestampDisplay)}</div><VirtualizedEventList events={events} selectedId={selectedId} rowHeight={rowHeight} timestampDisplay={timestampDisplay} onSelect={onSelect} /></article>;
|
||||
export function TimelinePanel({
|
||||
events,
|
||||
selectedId,
|
||||
rowHeight,
|
||||
timestampDisplay,
|
||||
onSelect,
|
||||
}: {
|
||||
events: EventItem[];
|
||||
selectedId: string | null;
|
||||
rowHeight: number;
|
||||
timestampDisplay: TimestampDisplay;
|
||||
onSelect: (event: EventItem) => void;
|
||||
}) {
|
||||
return (
|
||||
<article className="timeline-panel panel">
|
||||
<header className="panel-header">
|
||||
<div>
|
||||
<p className="eyebrow">Chronological evidence</p>
|
||||
<h2>Event timeline</h2>
|
||||
</div>
|
||||
<span className="panel-count">{events.length.toLocaleString()} visible</span>
|
||||
</header>
|
||||
<div className="date-band">{formatDate(events[0]?.timestamp ?? null, timestampDisplay)}</div>
|
||||
<VirtualizedEventList
|
||||
events={events}
|
||||
selectedId={selectedId}
|
||||
rowHeight={rowHeight}
|
||||
timestampDisplay={timestampDisplay}
|
||||
onSelect={onSelect}
|
||||
/>
|
||||
</article>
|
||||
);
|
||||
}
|
||||
@@ -2,12 +2,28 @@ import { describe, expect, it } from "vitest";
|
||||
import { analysisToMarkdown, prepareExport } from "./export";
|
||||
import type { Analysis } from "./types";
|
||||
|
||||
const analysis: Analysis = { source:"demo.evtx", incidents:[], events:[{id:"1",timestamp:"2026-09-09T10:00:00Z",provider:"Security",event_id:4625,level:"warning",category:"authentication",summary:"Login for admin@example.com",computer:"PC-01",fields:{"EventData.TargetUserName":"admin"}}] };
|
||||
const analysis: Analysis = {
|
||||
source: "demo.evtx",
|
||||
incidents: [],
|
||||
events: [
|
||||
{
|
||||
id: "1",
|
||||
timestamp: "2026-09-09T10:00:00Z",
|
||||
provider: "Security",
|
||||
event_id: 4625,
|
||||
level: "warning",
|
||||
category: "authentication",
|
||||
summary: "Login for admin@example.com",
|
||||
computer: "PC-01",
|
||||
fields: { "EventData.TargetUserName": "admin" },
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
describe("export", () => {
|
||||
it("redacts by default", () => {
|
||||
const prepared = prepareExport(analysis, true);
|
||||
expect(prepared.analysis.events[0].computer).toBe("[REDACTED_HOST]");
|
||||
expect(prepared.analysis.events[0].computer).toMatch(/^\[REDACTED_HOST_\d+\]$/);
|
||||
expect(prepared.analysis.source).toBe("[REDACTED_SOURCE].evtx");
|
||||
expect(prepared.redaction?.total).toBeGreaterThan(0);
|
||||
});
|
||||
@@ -15,15 +31,40 @@ describe("export", () => {
|
||||
it("produces an incident/evidence markdown report", () => {
|
||||
const markdown = analysisToMarkdown(analysis, true);
|
||||
expect(markdown).toContain("# EventLens incident report — [REDACTED_SOURCE].evtx");
|
||||
expect(markdown).toContain("[REDACTED_EMAIL]");
|
||||
expect(markdown).toMatch(/\[REDACTED_EMAIL_\d+\]/);
|
||||
expect(markdown).toContain("## Evidence events");
|
||||
});
|
||||
|
||||
it("escapes markdown control syntax from untrusted event text", () => {
|
||||
const malicious: Analysis = {
|
||||
source: "report#](https://example.invalid).evtx",
|
||||
incidents: [{ id: "i", rule_id: "rule|x", start: null, end: null, title: "# heading", category: "other", severity: "warning", reasons: [" <img src=x> ``` | table |"], evidence_event_ids: ["1"], original_count: 1, compressed_count: 1 }],
|
||||
events: [{ id: "1", timestamp: null, provider: "Provider", event_id: 1, level: "warning", category: "other", summary: "# heading [click](https://example.invalid) <script>alert(1)</script>", fields: { payload: "```\n| remote |" } }],
|
||||
incidents: [
|
||||
{
|
||||
id: "i",
|
||||
rule_id: "rule|x",
|
||||
start: null,
|
||||
end: null,
|
||||
title: "# heading",
|
||||
category: "other",
|
||||
severity: "warning",
|
||||
reasons: [" <img src=x> ``` | table |"],
|
||||
evidence_event_ids: ["1"],
|
||||
original_count: 1,
|
||||
compressed_count: 1,
|
||||
},
|
||||
],
|
||||
events: [
|
||||
{
|
||||
id: "1",
|
||||
timestamp: null,
|
||||
provider: "Provider",
|
||||
event_id: 1,
|
||||
level: "warning",
|
||||
category: "other",
|
||||
summary: "# heading [click](https://example.invalid) <script>alert(1)</script>",
|
||||
fields: { payload: "```\n| remote |" },
|
||||
},
|
||||
],
|
||||
};
|
||||
const markdown = analysisToMarkdown(malicious, false);
|
||||
expect(markdown).not.toContain("\n");
|
||||
@@ -46,7 +87,14 @@ describe("export", () => {
|
||||
truncated: true,
|
||||
truncation_reason: "event_limit_reached",
|
||||
duration_ms: 12,
|
||||
issues: [{ code: "event_limit_reached", record_id: 4, message: "later records were not analyzed", skipped_record: true }],
|
||||
issues: [
|
||||
{
|
||||
code: "event_limit_reached",
|
||||
record_id: 4,
|
||||
message: "later records were not analyzed",
|
||||
skipped_record: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
const json = prepareExport(partial, false).analysis;
|
||||
|
||||
+57
-20
@@ -1,29 +1,33 @@
|
||||
import { formatBytes } from "./app/format";
|
||||
import { redactAnalysis, type RedactionSummary } from "./redact";
|
||||
import type { Analysis, Incident, ParseIssue } from "./types";
|
||||
|
||||
export type PreparedExport = { analysis: Analysis; redaction: RedactionSummary | null };
|
||||
|
||||
const REDACTION_TOKEN_RE = /^\[REDACTED_[A-Z]+\](?:\.evtx)?$/;
|
||||
const REDACTION_TOKEN_RE = /^\[REDACTED_[A-Z]+(?:_\d+)?\](?:\.evtx)?$/;
|
||||
|
||||
function markdownText(value: string): string {
|
||||
const compact = value.replace(/[\r\n]+/g, " ");
|
||||
return compact.split(/(\[REDACTED_[A-Z]+\])/g).map((part) => {
|
||||
if (REDACTION_TOKEN_RE.test(part)) return part;
|
||||
return part
|
||||
.replaceAll("\\", "\\\\")
|
||||
.replaceAll("`", "\\`")
|
||||
.replaceAll("*", "\\*")
|
||||
.replaceAll("_", "\\_")
|
||||
.replaceAll("[", "\\[")
|
||||
.replaceAll("]", "\\]")
|
||||
.replaceAll("(", "\\(")
|
||||
.replaceAll(")", "\\)")
|
||||
.replaceAll("!", "\\!")
|
||||
.replaceAll("#", "\\#")
|
||||
.replaceAll(">", "\\>")
|
||||
.replaceAll("<", "\\<")
|
||||
.replaceAll("|", "\\|");
|
||||
}).join("");
|
||||
return compact
|
||||
.split(/(\[REDACTED_[A-Z]+(?:_\d+)?\])/g)
|
||||
.map((part) => {
|
||||
if (REDACTION_TOKEN_RE.test(part)) return part;
|
||||
return part
|
||||
.replaceAll("\\", "\\\\")
|
||||
.replaceAll("`", "\\`")
|
||||
.replaceAll("*", "\\*")
|
||||
.replaceAll("_", "\\_")
|
||||
.replaceAll("[", "\\[")
|
||||
.replaceAll("]", "\\]")
|
||||
.replaceAll("(", "\\(")
|
||||
.replaceAll(")", "\\)")
|
||||
.replaceAll("!", "\\!")
|
||||
.replaceAll("#", "\\#")
|
||||
.replaceAll(">", "\\>")
|
||||
.replaceAll("<", "\\<")
|
||||
.replaceAll("|", "\\|");
|
||||
})
|
||||
.join("");
|
||||
}
|
||||
|
||||
function markdownCode(value: string): string {
|
||||
@@ -53,13 +57,21 @@ export function prepareExport(source: Analysis, redact: boolean): PreparedExport
|
||||
}
|
||||
|
||||
export function analysisToMarkdown(source: Analysis, redact = true): string {
|
||||
const prepared = prepareExport(source, redact);
|
||||
return markdownFromPrepared(prepareExport(source, redact), redact);
|
||||
}
|
||||
|
||||
export function markdownFromPrepared(prepared: PreparedExport, redact: boolean): string {
|
||||
const analysis = prepared.analysis;
|
||||
const campaigns = analysis.campaigns ?? [];
|
||||
const lines = [
|
||||
`# EventLens incident report — ${markdownText(analysis.source)}`,
|
||||
"",
|
||||
`- Events: ${analysis.events.length}`,
|
||||
`- Incidents: ${analysis.incidents.length}`,
|
||||
`- Campaigns (recurring incidents): ${campaigns.length}`,
|
||||
analysis.source_info
|
||||
? `- Source SHA-256: ${markdownCode(analysis.source_info.sha256)} (${formatBytes(analysis.source_info.size_bytes)})`
|
||||
: "",
|
||||
`- Redaction: ${redact ? `enabled (${prepared.redaction?.total ?? 0} replacement(s))` : "disabled"}`,
|
||||
analysis.parse
|
||||
? `- Parser status: ${analysis.parse.status}; records seen ${analysis.parse.records_seen}; parsed ${analysis.parse.parsed_events}; skipped ${analysis.parse.skipped_records}; issues ${analysis.parse.issue_count}; truncated ${analysis.parse.truncated ? "yes" : "no"}`
|
||||
@@ -71,7 +83,30 @@ export function analysisToMarkdown(source: Analysis, redact = true): string {
|
||||
"",
|
||||
];
|
||||
if (analysis.parse?.issues.length) {
|
||||
lines.push("## Parser issues", "", ...analysis.parse.issues.map(issueLine), "");
|
||||
lines.push("## Parser issues", "");
|
||||
const counts = Object.entries(analysis.parse.issue_counts ?? {});
|
||||
if (counts.length) lines.push(...counts.map(([code, count]) => `- ${markdownCode(code)}: ${count}`), "");
|
||||
lines.push(...analysis.parse.issues.map(issueLine));
|
||||
if (analysis.parse.issues_truncated) {
|
||||
lines.push(
|
||||
`- … ${analysis.parse.issue_count - analysis.parse.issues.length} further issue(s) are counted above but not listed individually.`,
|
||||
);
|
||||
}
|
||||
lines.push("");
|
||||
}
|
||||
if (campaigns.length) {
|
||||
lines.push("## Campaigns", "");
|
||||
for (const campaign of campaigns) {
|
||||
lines.push(
|
||||
`### ${markdownText(campaign.title)}`,
|
||||
`- Rule: ${markdownCode(campaign.rule_id)}`,
|
||||
`- Severity: ${markdownText(campaign.severity)}`,
|
||||
`- Window: ${markdownCode(`${campaign.start} → ${campaign.end}`)}`,
|
||||
`- Incidents: ${campaign.incident_ids.length} · evidence events: ${campaign.event_count}`,
|
||||
...campaign.reasons.map((reason) => `- Reason: ${markdownCode(reason)}`),
|
||||
"",
|
||||
);
|
||||
}
|
||||
}
|
||||
lines.push("## Incidents", "");
|
||||
for (const incident of analysis.incidents) {
|
||||
@@ -81,6 +116,7 @@ export function analysisToMarkdown(source: Analysis, redact = true): string {
|
||||
`- Severity: ${markdownText(incident.severity)}`,
|
||||
`- Window: ${markdownCode(incidentWindow(incident))}`,
|
||||
`- Evidence: ${markdownCode(incident.evidence_event_ids.join(", "))}`,
|
||||
...(incident.campaign_id ? [`- Campaign: ${markdownCode(incident.campaign_id)}`] : []),
|
||||
...incident.reasons.map((reason) => `- Reason: ${markdownCode(reason)}`),
|
||||
"",
|
||||
);
|
||||
@@ -93,6 +129,7 @@ export function analysisToMarkdown(source: Analysis, redact = true): string {
|
||||
`- Provider: ${markdownCode(event.provider)}`,
|
||||
`- Event ID: ${event.event_id ?? "—"}`,
|
||||
`- Level: ${markdownText(event.level)}`,
|
||||
...(event.outcome ? [`- Audit outcome: ${markdownText(event.outcome)}`] : []),
|
||||
`- Category: ${markdownText(event.category)}`,
|
||||
`- Computer: ${markdownCode(event.computer || "—")}`,
|
||||
`- Timestamp source: ${markdownCode(event.timestamp_source ?? (event.timestamp ? "event" : "missing"))}`,
|
||||
|
||||
@@ -19,7 +19,13 @@ describe("large result performance", () => {
|
||||
it("searches 100,000 normalized events within a deterministic budget", () => {
|
||||
const events = makeEvents(100_000);
|
||||
const started = performance.now();
|
||||
const result = filterEvents(events, { search: "needle-value", category: "", level: "", provider: "", noiseMode: "all" });
|
||||
const result = filterEvents(events, {
|
||||
search: "needle-value",
|
||||
category: "",
|
||||
level: "",
|
||||
provider: "",
|
||||
noiseMode: "all",
|
||||
});
|
||||
const elapsed = performance.now() - started;
|
||||
expect(result.map((event) => event.id)).toEqual(["99999"]);
|
||||
expect(elapsed).toBeLessThan(3_000);
|
||||
|
||||
@@ -3,9 +3,37 @@ import { filterEvents, uniqueProviders } from "./filter";
|
||||
import type { EventItem } from "./types";
|
||||
|
||||
const events: EventItem[] = [
|
||||
{ id: "1", timestamp: "2026-09-09T10:00:00Z", provider: "DNS Client", event_id: 1014, level: "warning", category: "network", summary: "DNS timeout", computer: "PC-01", fields: { Query: "api.example.test" } },
|
||||
{ id: "2", timestamp: "2026-09-09T10:00:10Z", provider: "Kernel General", event_id: 12, level: "information", category: "system", summary: "System started", computer: "PC-01" },
|
||||
{ id: "3", timestamp: "2026-09-09T10:10:20Z", provider: "Application Error", event_id: 1000, level: "error", category: "crash", summary: "Example.exe crashed", computer: "PC-01" },
|
||||
{
|
||||
id: "1",
|
||||
timestamp: "2026-09-09T10:00:00Z",
|
||||
provider: "DNS Client",
|
||||
event_id: 1014,
|
||||
level: "warning",
|
||||
category: "network",
|
||||
summary: "DNS timeout",
|
||||
computer: "PC-01",
|
||||
fields: { Query: "api.example.test" },
|
||||
},
|
||||
{
|
||||
id: "2",
|
||||
timestamp: "2026-09-09T10:00:10Z",
|
||||
provider: "Kernel General",
|
||||
event_id: 12,
|
||||
level: "information",
|
||||
category: "system",
|
||||
summary: "System started",
|
||||
computer: "PC-01",
|
||||
},
|
||||
{
|
||||
id: "3",
|
||||
timestamp: "2026-09-09T10:10:20Z",
|
||||
provider: "Application Error",
|
||||
event_id: 1000,
|
||||
level: "error",
|
||||
category: "crash",
|
||||
summary: "Example.exe crashed",
|
||||
computer: "PC-01",
|
||||
},
|
||||
];
|
||||
|
||||
const base = { search: "", category: "", level: "", provider: "", noiseMode: "all" as const };
|
||||
@@ -29,11 +57,17 @@ describe("event filters", () => {
|
||||
});
|
||||
|
||||
it("keeps informational incident evidence when focus overrides noise suppression", () => {
|
||||
expect(filterEvents(events, { ...base, noiseMode: "attention", evidenceIds: new Set(["2"]) }).map((event) => event.id)).toEqual(["2"]);
|
||||
expect(
|
||||
filterEvents(events, { ...base, noiseMode: "attention", evidenceIds: new Set(["2"]) }).map((event) => event.id),
|
||||
).toEqual(["2"]);
|
||||
});
|
||||
|
||||
it("applies a symmetric time window around selected evidence", () => {
|
||||
expect(filterEvents(events, { ...base, anchorTimestamp: "2026-09-09T10:00:10Z", windowMinutes: 1 }).map((event) => event.id)).toEqual(["1", "2"]);
|
||||
expect(
|
||||
filterEvents(events, { ...base, anchorTimestamp: "2026-09-09T10:00:10Z", windowMinutes: 1 }).map(
|
||||
(event) => event.id,
|
||||
),
|
||||
).toEqual(["1", "2"]);
|
||||
});
|
||||
|
||||
it("returns stable sorted provider options", () => {
|
||||
|
||||
+16
-2
@@ -14,6 +14,11 @@ export type EventFilters = {
|
||||
};
|
||||
|
||||
const ATTENTION_LEVELS = new Set(["critical", "error", "warning"]);
|
||||
|
||||
/** Errors/warnings, plus Security audit failures (which Windows logs at level 0). */
|
||||
export function needsAttention(event: EventItem): boolean {
|
||||
return ATTENTION_LEVELS.has(event.level.toLowerCase()) || event.outcome === "failure";
|
||||
}
|
||||
const searchDocuments = new WeakMap<EventItem, string>();
|
||||
|
||||
function searchDocument(event: EventItem): string {
|
||||
@@ -22,7 +27,16 @@ function searchDocument(event: EventItem): string {
|
||||
const fieldText = Object.entries(event.fields ?? {})
|
||||
.map(([key, value]) => `${key} ${value}`)
|
||||
.join(" ");
|
||||
const document = [event.id, event.summary, event.provider, event.event_id ?? "", event.category, event.channel ?? "", event.computer ?? "", fieldText]
|
||||
const document = [
|
||||
event.id,
|
||||
event.summary,
|
||||
event.provider,
|
||||
event.event_id ?? "",
|
||||
event.category,
|
||||
event.channel ?? "",
|
||||
event.computer ?? "",
|
||||
fieldText,
|
||||
]
|
||||
.join(" ")
|
||||
.toLowerCase();
|
||||
searchDocuments.set(event, document);
|
||||
@@ -39,7 +53,7 @@ export function filterEvents(events: EventItem[], filters: EventFilters): EventI
|
||||
if (filters.category && event.category !== filters.category) return false;
|
||||
if (filters.level && event.level.toLowerCase() !== filters.level.toLowerCase()) return false;
|
||||
if (filters.provider && event.provider !== filters.provider) return false;
|
||||
if (filters.noiseMode === "attention" && !filters.evidenceIds && !ATTENTION_LEVELS.has(event.level.toLowerCase())) return false;
|
||||
if (filters.noiseMode === "attention" && !filters.evidenceIds && !needsAttention(event)) return false;
|
||||
if (anchor !== null && windowMs !== null) {
|
||||
if (!event.timestamp) return false;
|
||||
const eventTime = Date.parse(event.timestamp);
|
||||
|
||||
@@ -6,4 +6,8 @@ import "./styles.css";
|
||||
const rootElement = document.getElementById("root");
|
||||
if (!rootElement) throw new Error("App root element was not found");
|
||||
|
||||
createRoot(rootElement).render(<React.StrictMode><App /></React.StrictMode>);
|
||||
createRoot(rootElement).render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>,
|
||||
);
|
||||
+88
-51
@@ -4,20 +4,50 @@ import type { Analysis } from "./types";
|
||||
|
||||
const source: Analysis = {
|
||||
source: "Security.evtx",
|
||||
incidents: [{ id:"i1", rule_id:"windows.auth.failed-logon", start:"2026-09-09T10:00:00Z", end:"2026-09-09T10:00:01Z", title:"Failed login", category:"authentication", severity:"warning", reasons:["Connection from 192.168.1.15"], evidence_event_ids:["1"], original_count:1, compressed_count:1 }],
|
||||
events: [{ id:"1", timestamp:"2026-09-09T10:00:00Z", provider:"Security", event_id:4625, level:"warning", category:"authentication", summary:"C:\\Users\\jens\\tool.exe contacted admin@example.com at 192.168.1.15", computer:"DEMO-PC", fields:{"EventData.TargetUserName":"jens","EventData.IpAddress":"10.0.0.5","EventData.ProcessName":"C:\\Windows\\System32\\cmd.exe"} }],
|
||||
incidents: [
|
||||
{
|
||||
id: "i1",
|
||||
rule_id: "windows.auth.failed-logon",
|
||||
start: "2026-09-09T10:00:00Z",
|
||||
end: "2026-09-09T10:00:01Z",
|
||||
title: "Failed login",
|
||||
category: "authentication",
|
||||
severity: "warning",
|
||||
reasons: ["Connection from 192.168.1.15"],
|
||||
evidence_event_ids: ["1"],
|
||||
original_count: 1,
|
||||
compressed_count: 1,
|
||||
},
|
||||
],
|
||||
events: [
|
||||
{
|
||||
id: "1",
|
||||
timestamp: "2026-09-09T10:00:00Z",
|
||||
provider: "Security",
|
||||
event_id: 4625,
|
||||
level: "warning",
|
||||
category: "authentication",
|
||||
summary: "C:\\Users\\jens\\tool.exe contacted admin@example.com at 192.168.1.15",
|
||||
computer: "DEMO-PC",
|
||||
fields: {
|
||||
"EventData.TargetUserName": "jens",
|
||||
"EventData.IpAddress": "10.0.0.5",
|
||||
"EventData.ProcessName": "C:\\Windows\\System32\\cmd.exe",
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
describe("redaction", () => {
|
||||
it("redacts sensitive event values without mutating the source", () => {
|
||||
const result = redactAnalysis(source);
|
||||
const event = result.analysis.events[0];
|
||||
expect(event.computer).toBe("[REDACTED_HOST]");
|
||||
expect(event.fields?.["EventData.TargetUserName"]).toBe("[REDACTED_IDENTITY]");
|
||||
expect(event.fields?.["EventData.IpAddress"]).toBe("[REDACTED_IP]");
|
||||
expect(event.fields?.["EventData.ProcessName"]).toBe("[REDACTED_PATH]");
|
||||
expect(event.summary).toContain("[REDACTED_EMAIL]");
|
||||
expect(event.summary).toContain("[REDACTED_IP]");
|
||||
expect(event.computer).toMatch(/^\[REDACTED_HOST_\d+\]$/);
|
||||
expect(event.fields?.["EventData.TargetUserName"]).toMatch(/^\[REDACTED_IDENTITY_\d+\]$/);
|
||||
expect(event.fields?.["EventData.IpAddress"]).toMatch(/^\[REDACTED_IP_\d+\]$/);
|
||||
expect(event.fields?.["EventData.ProcessName"]).toMatch(/^\[REDACTED_PATH_\d+\]$/);
|
||||
expect(event.summary).toMatch(/\[REDACTED_EMAIL_\d+\]/);
|
||||
expect(event.summary).toMatch(/\[REDACTED_IP_\d+\]/);
|
||||
expect(source.events[0].computer).toBe("DEMO-PC");
|
||||
expect(result.summary.total).toBeGreaterThanOrEqual(6);
|
||||
});
|
||||
@@ -25,37 +55,42 @@ describe("redaction", () => {
|
||||
it("propagates identities and redacts Windows/UNC paths and IPv6 in free-form text", () => {
|
||||
const sensitive: Analysis = {
|
||||
source: "private.evtx",
|
||||
incidents: [{
|
||||
id: "incident-1",
|
||||
rule_id: "windows.auth.failed-logon",
|
||||
start: "2026-09-09T10:00:00Z",
|
||||
end: "2026-09-09T10:00:01Z",
|
||||
title: "Failed sign-in for jens",
|
||||
category: "authentication",
|
||||
severity: "warning",
|
||||
reasons: ["jens used C:\\Program Files\\SecretTool\\agent.exe from 2001:db8::42"],
|
||||
evidence_event_ids: ["1"],
|
||||
original_count: 1,
|
||||
compressed_count: 1,
|
||||
}],
|
||||
events: [{
|
||||
id: "1",
|
||||
timestamp: "2026-09-09T10:00:00Z",
|
||||
provider: "Security",
|
||||
event_id: 4625,
|
||||
level: "warning",
|
||||
category: "authentication",
|
||||
summary: "Failed sign-in for DOMAIN\\jens at C:\\Program Files\\SecretTool\\agent.exe from 2001:db8::42, fe80::1 and ::ffff:192.0.2.1; SID S-1-5-21-123-456-789-1001; machine BUILD01$; UNC \\\\server\\Share With Space\\agent.exe",
|
||||
computer: "DEMO-PC",
|
||||
fields: {
|
||||
"EventData.TargetUserName": "jens",
|
||||
"EventData.SubjectUserName": "DOMAIN\\jens",
|
||||
"EventData.ProcessName": "C:\\Program Files\\SecretTool\\agent.exe",
|
||||
"EventData.UncPath": "\\\\server\\Share With Space\\agent.exe",
|
||||
"EventData.MachineAccount": "DOMAIN\\BUILD01$",
|
||||
"EventData.Sid": "S-1-5-21-123-456-789-1001",
|
||||
incidents: [
|
||||
{
|
||||
id: "incident-1",
|
||||
rule_id: "windows.auth.failed-logon",
|
||||
start: "2026-09-09T10:00:00Z",
|
||||
end: "2026-09-09T10:00:01Z",
|
||||
title: "Failed sign-in for jens",
|
||||
category: "authentication",
|
||||
severity: "warning",
|
||||
reasons: ["jens used C:\\Program Files\\SecretTool\\agent.exe from 2001:db8::42"],
|
||||
evidence_event_ids: ["1"],
|
||||
original_count: 1,
|
||||
compressed_count: 1,
|
||||
},
|
||||
}],
|
||||
],
|
||||
events: [
|
||||
{
|
||||
id: "1",
|
||||
timestamp: "2026-09-09T10:00:00Z",
|
||||
provider: "Security",
|
||||
event_id: 4625,
|
||||
level: "warning",
|
||||
category: "authentication",
|
||||
summary:
|
||||
"Failed sign-in for DOMAIN\\jens at C:\\Program Files\\SecretTool\\agent.exe from 2001:db8::42, fe80::1 and ::ffff:192.0.2.1; SID S-1-5-21-123-456-789-1001; machine BUILD01$; UNC \\\\server\\Share With Space\\agent.exe",
|
||||
computer: "DEMO-PC",
|
||||
fields: {
|
||||
"EventData.TargetUserName": "jens",
|
||||
"EventData.SubjectUserName": "DOMAIN\\jens",
|
||||
"EventData.ProcessName": "C:\\Program Files\\SecretTool\\agent.exe",
|
||||
"EventData.UncPath": "\\\\server\\Share With Space\\agent.exe",
|
||||
"EventData.MachineAccount": "DOMAIN\\BUILD01$",
|
||||
"EventData.Sid": "S-1-5-21-123-456-789-1001",
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
const result = redactAnalysis(sensitive);
|
||||
const serialized = JSON.stringify(result.analysis);
|
||||
@@ -67,7 +102,7 @@ describe("redaction", () => {
|
||||
expect(serialized).not.toContain("192.0.2.1");
|
||||
expect(serialized).not.toContain("BUILD01$");
|
||||
expect(serialized).not.toContain("S-1-5-21");
|
||||
expect(result.analysis.incidents[0].title).toContain("[REDACTED_IDENTITY]");
|
||||
expect(result.analysis.incidents[0].title).toMatch(/\[REDACTED_IDENTITY_\d+\]/);
|
||||
expect(result.summary.paths).toBeGreaterThan(0);
|
||||
expect(result.summary.ips).toBeGreaterThanOrEqual(3);
|
||||
});
|
||||
@@ -76,20 +111,22 @@ describe("redaction", () => {
|
||||
const sourceField: Analysis = {
|
||||
source: "private.evtx",
|
||||
incidents: [],
|
||||
events: [{
|
||||
id: "1",
|
||||
timestamp: null,
|
||||
provider: "Security",
|
||||
event_id: 1,
|
||||
level: "information",
|
||||
category: "other",
|
||||
summary: "Observed source Collector-A",
|
||||
computer: "",
|
||||
fields: { "EventData.SourceName": "Collector-A" },
|
||||
}],
|
||||
events: [
|
||||
{
|
||||
id: "1",
|
||||
timestamp: null,
|
||||
provider: "Security",
|
||||
event_id: 1,
|
||||
level: "information",
|
||||
category: "other",
|
||||
summary: "Observed source Collector-A",
|
||||
computer: "",
|
||||
fields: { "EventData.SourceName": "Collector-A" },
|
||||
},
|
||||
],
|
||||
};
|
||||
const result = redactAnalysis(sourceField);
|
||||
expect(result.analysis.events[0].summary).toContain("[REDACTED_SOURCE]");
|
||||
expect(result.analysis.events[0].summary).toMatch(/\[REDACTED_SOURCE_\d+\]/);
|
||||
expect(result.summary.sources).toBeGreaterThan(1);
|
||||
});
|
||||
});
|
||||
+170
-80
@@ -1,4 +1,4 @@
|
||||
import type { Analysis, EventItem } from "./types";
|
||||
import type { Analysis, Campaign, EventItem } from "./types";
|
||||
|
||||
export type RedactionSummary = {
|
||||
hosts: number;
|
||||
@@ -6,12 +6,29 @@ export type RedactionSummary = {
|
||||
emails: number;
|
||||
ips: number;
|
||||
paths: number;
|
||||
domains: number;
|
||||
sources: number;
|
||||
total: number;
|
||||
/** Field keys whose non-empty values were exported unchanged in at least one event. */
|
||||
untouchedFieldKeys: string[];
|
||||
/** Number of distinct pseudonyms per category, e.g. 3 hosts → [REDACTED_HOST_1..3]. */
|
||||
distinct: Record<RedactionCategory, number>;
|
||||
};
|
||||
export type RedactionResult = { analysis: Analysis; summary: RedactionSummary };
|
||||
type RedactionCategory = keyof Omit<RedactionSummary, "total">;
|
||||
type KnownValue = { value: string; replacement: string; category: RedactionCategory };
|
||||
export type RedactionCategory = "hosts" | "identities" | "emails" | "ips" | "paths" | "domains" | "sources";
|
||||
|
||||
type KnownValue = { value: string; category: RedactionCategory };
|
||||
|
||||
const LABELS: Record<RedactionCategory, string> = {
|
||||
hosts: "HOST",
|
||||
identities: "IDENTITY",
|
||||
emails: "EMAIL",
|
||||
ips: "IP",
|
||||
paths: "PATH",
|
||||
domains: "DOMAIN",
|
||||
sources: "SOURCE",
|
||||
};
|
||||
export const MAX_UNTOUCHED_KEYS = 50;
|
||||
|
||||
const EMAIL_RE = /\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/gi;
|
||||
const DOMAIN_IDENTITY_RE = /(?<![\w:])[A-Za-z0-9][A-Za-z0-9._-]{1,}\\[A-Za-z0-9._-]{1,}\$?(?![\w])/g;
|
||||
@@ -21,27 +38,58 @@ const IPV4_RE = /(?<![\d.])(?:\d{1,3}\.){3}\d{1,3}(?![\d.])/g;
|
||||
const IPV4_MAPPED_IPV6_RE = /(?<![0-9A-Fa-f:])(?:[0-9A-Fa-f]{0,4}:){2,8}(?:\d{1,3}\.){3}\d{1,3}(?![\w:])/gi;
|
||||
const IPV6_RE = /(?<![0-9A-Fa-f:])(?:[0-9A-Fa-f]{0,4}:){2,8}[0-9A-Fa-f]{0,4}(?![0-9A-Fa-f:])/g;
|
||||
const QUOTED_PATH_RE = /(["'])(?=((?:[A-Za-z]:\\|\\\\)))([\s\S]*?)\1/g;
|
||||
const UNQUOTED_PATH_RE = /(?<![\w])(?:[A-Za-z]:\\|\\\\)(?:[^\\/:*?"<>|\r\n]+\\)+[^\\/:*?"<>|\r\n]*?\.[A-Za-z0-9]{1,8}(?=$|[\s,;:!?)]|["'])/g;
|
||||
const IDENTITY_KEY_RE = /(user(name)?|account|upn|principal|subject.*user|target.*user|machineaccount|sid|email)/i;
|
||||
const UNQUOTED_PATH_RE =
|
||||
/(?<![\w])(?:[A-Za-z]:\\|\\\\)(?:[^\\/:*?"<>|\r\n]+\\)+[^\\/:*?"<>|\r\n]*?\.[A-Za-z0-9]{1,8}(?=$|[\s,;:!?)]|["'])/g;
|
||||
// Three or more DNS labels ending in an alphabetic TLD (fileserver.corp.example).
|
||||
// Two-label names are skipped on purpose so file names such as app.exe survive.
|
||||
const FQDN_RE =
|
||||
/(?<![\w.-])(?:[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?\.){2,}[A-Za-z][A-Za-z0-9-]{1,62}(?![\w.-])/g;
|
||||
const IDENTITY_KEY_RE =
|
||||
/(user(name)?|account|upn|principal|subject.*user|target.*user|machineaccount|sid|email|membername)/i;
|
||||
const EMAIL_KEY_RE = /(email|mail)/i;
|
||||
const HOST_KEY_RE = /(computer|host(name)?|workstation|machine)/i;
|
||||
const HOST_KEY_RE = /(computer|host(name)?|workstation|machine|servername|dnshostname)/i;
|
||||
const DOMAIN_KEY_RE = /(domain(name)?|queryname|(^|[._])query$|realm)$/i;
|
||||
const PATH_KEY_RE = /(path|filename|image|executable|process(name)?|command(line)?)/i;
|
||||
const IP_KEY_RE = /(^|[._])(ip|ipaddress|sourceaddress|destinationaddress|remoteaddress)$/i;
|
||||
const IP_KEY_RE = /(^|[._])(ip|ipaddress|sourceaddress|destinationaddress|remoteaddress|clientaddress|address)$/i;
|
||||
const SOURCE_KEY_RE = /(^|[._])(source|sourcename|sourcefile|logfile)$/i;
|
||||
const REPLACEMENT_RE = /^\[REDACTED_[A-Z]+\]$/;
|
||||
const REPLACEMENT_RE = /^\[REDACTED_[A-Z]+(?:_\d+)?\]$/;
|
||||
const PATTERNED_RE = /\[REDACTED_[A-Z]+(?:_\d+)?\]/;
|
||||
|
||||
/** Consistent pseudonyms: the same value always maps to the same numbered token. */
|
||||
class Pseudonyms {
|
||||
private readonly tokens = new Map<string, string>();
|
||||
readonly distinct: Record<RedactionCategory, number> = {
|
||||
hosts: 0,
|
||||
identities: 0,
|
||||
emails: 0,
|
||||
ips: 0,
|
||||
paths: 0,
|
||||
domains: 0,
|
||||
sources: 0,
|
||||
};
|
||||
|
||||
token(category: RedactionCategory, value: string): string {
|
||||
const key = `${category}\u0000${value.trim().toLocaleLowerCase()}`;
|
||||
const existing = this.tokens.get(key);
|
||||
if (existing) return existing;
|
||||
this.distinct[category] += 1;
|
||||
const token = `[REDACTED_${LABELS[category]}_${this.distinct[category]}]`;
|
||||
this.tokens.set(key, token);
|
||||
return token;
|
||||
}
|
||||
}
|
||||
|
||||
type Context = { names: Pseudonyms; summary: RedactionSummary; known: KnownMatcher | null };
|
||||
|
||||
function increment(summary: RedactionSummary, category: RedactionCategory): void {
|
||||
summary[category] += 1;
|
||||
summary.total += 1;
|
||||
}
|
||||
|
||||
function replacementFor(category: RedactionCategory): string {
|
||||
return `[REDACTED_${category === "ips" ? "IP" : category === "emails" ? "EMAIL" : category === "hosts" ? "HOST" : category === "paths" ? "PATH" : category === "sources" ? "SOURCE" : "IDENTITY"}]`;
|
||||
}
|
||||
|
||||
function fieldCategory(key: string): RedactionCategory | null {
|
||||
export function fieldCategory(key: string): RedactionCategory | null {
|
||||
if (EMAIL_KEY_RE.test(key)) return "emails";
|
||||
if (IDENTITY_KEY_RE.test(key)) return "identities";
|
||||
if (DOMAIN_KEY_RE.test(key)) return "domains";
|
||||
if (HOST_KEY_RE.test(key)) return "hosts";
|
||||
if (PATH_KEY_RE.test(key)) return "paths";
|
||||
if (IP_KEY_RE.test(key)) return "ips";
|
||||
@@ -49,40 +97,50 @@ function fieldCategory(key: string): RedactionCategory | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
function addKnown(known: Map<string, KnownValue>, value: string, category: RedactionCategory): void {
|
||||
const candidate = value.trim();
|
||||
if (candidate.length < 2 || REPLACEMENT_RE.test(candidate)) return;
|
||||
const key = `${category}\u0000${candidate.toLocaleLowerCase()}`;
|
||||
if (!known.has(key)) known.set(key, { value: candidate, category, replacement: replacementFor(category) });
|
||||
}
|
||||
|
||||
function collectKnownValues(source: Analysis): Map<string, KnownValue> {
|
||||
const known = new Map<string, KnownValue>();
|
||||
for (const event of source.events) {
|
||||
addKnown(known, event.computer ?? "", "hosts");
|
||||
for (const [key, value] of Object.entries(event.fields ?? {})) {
|
||||
const category = fieldCategory(key);
|
||||
if (category) addKnown(known, value, category);
|
||||
}
|
||||
}
|
||||
return known;
|
||||
}
|
||||
|
||||
function escapeRegExp(value: string): string {
|
||||
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||
}
|
||||
|
||||
function replaceKnownValues(value: string, known: Map<string, KnownValue>, summary: RedactionSummary): string {
|
||||
let next = value;
|
||||
const values = [...known.values()].sort((a, b) => b.value.length - a.value.length);
|
||||
for (const item of values) {
|
||||
const pattern = new RegExp(`(?<![A-Za-z0-9_])${escapeRegExp(item.value)}(?![A-Za-z0-9_])`, "gi");
|
||||
next = next.replace(pattern, () => {
|
||||
increment(summary, item.category);
|
||||
return item.replacement;
|
||||
});
|
||||
/**
|
||||
* Matches every known structured value in one pass. Building a single
|
||||
* alternation once per redaction run replaces the previous per-string,
|
||||
* per-value RegExp construction that made redaction quadratic.
|
||||
*/
|
||||
type KnownMatcher = { pattern: RegExp; byValue: Map<string, KnownValue> };
|
||||
|
||||
function collectKnownValues(source: Analysis): KnownMatcher | null {
|
||||
const byValue = new Map<string, KnownValue>();
|
||||
const add = (value: string, category: RedactionCategory) => {
|
||||
const candidate = value.trim();
|
||||
if (candidate.length < 2 || REPLACEMENT_RE.test(candidate)) return;
|
||||
const key = candidate.toLocaleLowerCase();
|
||||
if (!byValue.has(key)) byValue.set(key, { value: candidate, category });
|
||||
};
|
||||
for (const event of source.events) {
|
||||
add(event.computer ?? "", "hosts");
|
||||
for (const [key, value] of Object.entries(event.fields ?? {})) {
|
||||
const category = fieldCategory(key);
|
||||
if (category) add(value, category);
|
||||
}
|
||||
}
|
||||
return next;
|
||||
if (!byValue.size) return null;
|
||||
const alternatives = [...byValue.values()]
|
||||
.map((item) => item.value)
|
||||
.sort((a, b) => b.length - a.length)
|
||||
.map(escapeRegExp);
|
||||
return { pattern: new RegExp(`(?<![A-Za-z0-9_])(?:${alternatives.join("|")})(?![A-Za-z0-9_])`, "gi"), byValue };
|
||||
}
|
||||
|
||||
function replaceKnownValues(value: string, context: Context): string {
|
||||
if (!context.known) return value;
|
||||
const { pattern, byValue } = context.known;
|
||||
pattern.lastIndex = 0;
|
||||
return value.replace(pattern, (match) => {
|
||||
const item = byValue.get(match.toLocaleLowerCase());
|
||||
if (!item) return match;
|
||||
increment(context.summary, item.category);
|
||||
return context.names.token(item.category, item.value);
|
||||
});
|
||||
}
|
||||
|
||||
function isValidIpv4(value: string): boolean {
|
||||
@@ -101,77 +159,109 @@ function isValidIpv6(value: string): boolean {
|
||||
return count + 1;
|
||||
}, 0);
|
||||
if (hasCompression ? expandedCount >= 8 : expandedCount !== 8) return false;
|
||||
return pieces.filter(Boolean).every((piece) => piece.includes(".") ? isValidIpv4(piece) : /^[0-9A-Fa-f]{1,4}$/.test(piece));
|
||||
return pieces
|
||||
.filter(Boolean)
|
||||
.every((piece) => (piece.includes(".") ? isValidIpv4(piece) : /^[0-9A-Fa-f]{1,4}$/.test(piece)));
|
||||
}
|
||||
|
||||
function replacePattern(
|
||||
value: string,
|
||||
pattern: RegExp,
|
||||
replacement: string,
|
||||
category: RedactionCategory,
|
||||
summary: RedactionSummary,
|
||||
context: Context,
|
||||
validate?: (match: string) => boolean,
|
||||
): string {
|
||||
return value.replace(pattern, (match) => {
|
||||
return value.replace(pattern, (match: string) => {
|
||||
if (validate && !validate(match)) return match;
|
||||
increment(summary, category);
|
||||
return replacement;
|
||||
increment(context.summary, category);
|
||||
return context.names.token(category, match);
|
||||
});
|
||||
}
|
||||
|
||||
function redactPaths(value: string, summary: RedactionSummary): string {
|
||||
const next = value.replace(QUOTED_PATH_RE, (match, _quote: string, _root: string, path: string) => {
|
||||
function redactPaths(value: string, context: Context): string {
|
||||
const next = value.replace(QUOTED_PATH_RE, (match: string, _quote: string, _root: string, path: string) => {
|
||||
if (!path) return match;
|
||||
increment(summary, "paths");
|
||||
return "[REDACTED_PATH]";
|
||||
increment(context.summary, "paths");
|
||||
return context.names.token("paths", path);
|
||||
});
|
||||
return next.replace(UNQUOTED_PATH_RE, () => {
|
||||
increment(summary, "paths");
|
||||
return "[REDACTED_PATH]";
|
||||
return next.replace(UNQUOTED_PATH_RE, (match: string) => {
|
||||
increment(context.summary, "paths");
|
||||
return context.names.token("paths", match);
|
||||
});
|
||||
}
|
||||
|
||||
function redactText(value: string, known: Map<string, KnownValue>, summary: RedactionSummary): string {
|
||||
let next = redactPaths(value, summary);
|
||||
next = replacePattern(next, EMAIL_RE, "[REDACTED_EMAIL]", "emails", summary);
|
||||
next = replacePattern(next, DOMAIN_IDENTITY_RE, "[REDACTED_IDENTITY]", "identities", summary);
|
||||
next = replacePattern(next, SID_RE, "[REDACTED_IDENTITY]", "identities", summary);
|
||||
next = replacePattern(next, MACHINE_ACCOUNT_RE, "[REDACTED_IDENTITY]", "identities", summary);
|
||||
next = replacePattern(next, IPV4_MAPPED_IPV6_RE, "[REDACTED_IP]", "ips", summary, isValidIpv6);
|
||||
next = replacePattern(next, IPV4_RE, "[REDACTED_IP]", "ips", summary, isValidIpv4);
|
||||
next = replacePattern(next, IPV6_RE, "[REDACTED_IP]", "ips", summary, isValidIpv6);
|
||||
return replaceKnownValues(next, known, summary);
|
||||
function redactText(value: string, context: Context): string {
|
||||
if (!value) return value;
|
||||
let next = redactPaths(value, context);
|
||||
next = replacePattern(next, EMAIL_RE, "emails", context);
|
||||
next = replacePattern(next, DOMAIN_IDENTITY_RE, "identities", context);
|
||||
next = replacePattern(next, SID_RE, "identities", context);
|
||||
next = replacePattern(next, MACHINE_ACCOUNT_RE, "identities", context);
|
||||
next = replacePattern(next, IPV4_MAPPED_IPV6_RE, "ips", context, isValidIpv6);
|
||||
next = replacePattern(next, IPV4_RE, "ips", context, isValidIpv4);
|
||||
next = replacePattern(next, IPV6_RE, "ips", context, isValidIpv6);
|
||||
next = replaceKnownValues(next, context);
|
||||
return replacePattern(next, FQDN_RE, "domains", context);
|
||||
}
|
||||
|
||||
function redactField(key: string, value: string, known: Map<string, KnownValue>, summary: RedactionSummary): string {
|
||||
function redactField(key: string, value: string, context: Context, untouched: Set<string>): string {
|
||||
const category = fieldCategory(key);
|
||||
if (category && value) {
|
||||
increment(summary, category);
|
||||
return replacementFor(category);
|
||||
increment(context.summary, category);
|
||||
return context.names.token(category, value);
|
||||
}
|
||||
return redactText(value, known, summary);
|
||||
const next = redactText(value, context);
|
||||
if (value && next === value && !PATTERNED_RE.test(value)) untouched.add(key);
|
||||
return next;
|
||||
}
|
||||
|
||||
function redactEvent(event: EventItem, known: Map<string, KnownValue>, summary: RedactionSummary): EventItem {
|
||||
function redactEvent(event: EventItem, context: Context, untouched: Set<string>): EventItem {
|
||||
const fields = Object.fromEntries(
|
||||
Object.entries(event.fields ?? {}).map(([key, value]) => [key, redactField(key, value, known, summary)]),
|
||||
Object.entries(event.fields ?? {}).map(([key, value]) => [key, redactField(key, value, context, untouched)]),
|
||||
);
|
||||
let computer = event.computer ?? "";
|
||||
if (computer) {
|
||||
increment(summary, "hosts");
|
||||
computer = "[REDACTED_HOST]";
|
||||
increment(context.summary, "hosts");
|
||||
computer = context.names.token("hosts", computer);
|
||||
}
|
||||
return { ...event, computer, summary: redactText(event.summary, known, summary), fields };
|
||||
return { ...event, computer, summary: redactText(event.summary, context), fields };
|
||||
}
|
||||
|
||||
function redactCampaign(campaign: Campaign, context: Context): Campaign {
|
||||
return {
|
||||
...campaign,
|
||||
title: redactText(campaign.title, context),
|
||||
reasons: campaign.reasons.map((reason) => redactText(reason, context)),
|
||||
};
|
||||
}
|
||||
|
||||
export function redactAnalysis(source: Analysis): RedactionResult {
|
||||
const summary: RedactionSummary = { hosts: 0, identities: 0, emails: 0, ips: 0, paths: 0, sources: source.source ? 1 : 0, total: source.source ? 1 : 0 };
|
||||
const known = collectKnownValues(source);
|
||||
const events = source.events.map((event) => redactEvent(event, known, summary));
|
||||
const names = new Pseudonyms();
|
||||
const summary: RedactionSummary = {
|
||||
hosts: 0,
|
||||
identities: 0,
|
||||
emails: 0,
|
||||
ips: 0,
|
||||
paths: 0,
|
||||
domains: 0,
|
||||
sources: source.source ? 1 : 0,
|
||||
total: source.source ? 1 : 0,
|
||||
untouchedFieldKeys: [],
|
||||
distinct: names.distinct,
|
||||
};
|
||||
const context: Context = { names, summary, known: collectKnownValues(source) };
|
||||
const untouched = new Set<string>();
|
||||
const events = source.events.map((event) => redactEvent(event, context, untouched));
|
||||
const incidents = source.incidents.map((incident) => ({
|
||||
...incident,
|
||||
title: redactText(incident.title, known, summary),
|
||||
reasons: incident.reasons.map((reason) => redactText(reason, known, summary)),
|
||||
title: redactText(incident.title, context),
|
||||
reasons: incident.reasons.map((reason) => redactText(reason, context)),
|
||||
}));
|
||||
return { analysis: { ...source, source: "[REDACTED_SOURCE].evtx", events, incidents }, summary };
|
||||
const campaigns = source.campaigns?.map((campaign) => redactCampaign(campaign, context));
|
||||
summary.untouchedFieldKeys = [...untouched].sort((a, b) => a.localeCompare(b)).slice(0, MAX_UNTOUCHED_KEYS);
|
||||
summary.distinct = { ...names.distinct };
|
||||
return {
|
||||
analysis: { ...source, source: "[REDACTED_SOURCE].evtx", events, incidents, ...(campaigns ? { campaigns } : {}) },
|
||||
summary,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
import { redactAnalysis, type RedactionResult } from "./redact";
|
||||
import type { Analysis } from "./types";
|
||||
|
||||
const results = new WeakMap<Analysis, Promise<RedactionResult>>();
|
||||
|
||||
function runInline(analysis: Analysis): Promise<RedactionResult> {
|
||||
try {
|
||||
return Promise.resolve(redactAnalysis(analysis));
|
||||
} catch (reason) {
|
||||
return Promise.reject(reason);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Redact in a Web Worker so large analyses never block the UI thread.
|
||||
* Results are cached per loaded analysis; the original object is never mutated.
|
||||
*/
|
||||
export function redactInBackground(analysis: Analysis): Promise<RedactionResult> {
|
||||
const cached = results.get(analysis);
|
||||
if (cached) return cached;
|
||||
const pending =
|
||||
typeof Worker === "undefined"
|
||||
? runInline(analysis)
|
||||
: new Promise<RedactionResult>((resolve, reject) => {
|
||||
let worker: Worker;
|
||||
try {
|
||||
worker = new Worker(new URL("./workers/redact.worker.ts", import.meta.url), { type: "module" });
|
||||
} catch {
|
||||
runInline(analysis).then(resolve, reject);
|
||||
return;
|
||||
}
|
||||
worker.onmessage = (message: MessageEvent<RedactionResult>) => {
|
||||
worker.terminate();
|
||||
resolve(message.data);
|
||||
};
|
||||
worker.onerror = (event) => {
|
||||
event.preventDefault();
|
||||
worker.terminate();
|
||||
runInline(analysis).then(resolve, reject);
|
||||
};
|
||||
worker.postMessage(analysis);
|
||||
});
|
||||
results.set(analysis, pending);
|
||||
pending.catch(() => results.delete(analysis));
|
||||
return pending;
|
||||
}
|
||||
+2463
-460
File diff suppressed because it is too large.
Load diff
@@ -10,6 +10,7 @@ export type EventItem = {
|
||||
computer?: string;
|
||||
category: string;
|
||||
summary: string;
|
||||
outcome?: "success" | "failure" | null;
|
||||
fields?: Record<string, string>;
|
||||
};
|
||||
|
||||
@@ -25,6 +26,25 @@ export type Incident = {
|
||||
evidence_event_ids: string[];
|
||||
original_count: number;
|
||||
compressed_count: number;
|
||||
campaign_id?: string | null;
|
||||
};
|
||||
|
||||
export type Campaign = {
|
||||
id: string;
|
||||
rule_id: string;
|
||||
title: string;
|
||||
category: string;
|
||||
severity: string;
|
||||
start: string;
|
||||
end: string;
|
||||
incident_ids: string[];
|
||||
event_count: number;
|
||||
reasons: string[];
|
||||
};
|
||||
|
||||
export type SourceInfo = {
|
||||
sha256: string;
|
||||
size_bytes: number;
|
||||
};
|
||||
|
||||
export type ParseStats = {
|
||||
@@ -38,6 +58,8 @@ export type ParseStats = {
|
||||
truncation_reason?: string | null;
|
||||
duration_ms: number;
|
||||
issues: ParseIssue[];
|
||||
issues_truncated?: boolean;
|
||||
issue_counts?: Record<string, number>;
|
||||
};
|
||||
|
||||
export type ParseIssue = {
|
||||
@@ -51,5 +73,7 @@ export type Analysis = {
|
||||
source: string;
|
||||
events: EventItem[];
|
||||
incidents: Incident[];
|
||||
campaigns?: Campaign[];
|
||||
parse?: ParseStats | null;
|
||||
source_info?: SourceInfo | null;
|
||||
};
|
||||
@@ -0,0 +1,6 @@
|
||||
import { redactAnalysis } from "../redact";
|
||||
import type { Analysis } from "../types";
|
||||
|
||||
self.onmessage = (message: MessageEvent<Analysis>) => {
|
||||
self.postMessage(redactAnalysis(message.data));
|
||||
};
|
||||
@@ -1,12 +1,200 @@
|
||||
import type { Analysis, Incident } from "../types";
|
||||
import { statusLabel } from "../app/format";
|
||||
import { useState } from "react";
|
||||
import type { Analysis, Campaign, Incident } from "../types";
|
||||
import { formatRange, statusLabel } from "../app/format";
|
||||
import { analysisIndex } from "../app/indexes";
|
||||
import type { TimestampDisplay } from "../app/model";
|
||||
import { Icon } from "../components/icons";
|
||||
import { EmptyState, IncidentCard, MetricCard, WorkspaceHeader } from "../components/states";
|
||||
|
||||
export function AnalysisView({ data, timestampDisplay, activeIncidentId, onOpen, onOpenFile, onDemo }: { data: Analysis | null; timestampDisplay: TimestampDisplay; activeIncidentId: string; onOpen: (incident: Incident) => void; onOpenFile: () => void; onDemo: () => void }) {
|
||||
if (!data) return <><WorkspaceHeader eyebrow="Workspace 01" title="Analysis" description="A compact overview of the current event-log reconstruction." /><EmptyState onOpen={onOpenFile} onDemo={onDemo} /></>;
|
||||
const statusDetail = data.parse ? `${data.parse.skipped_records} skipped · ${data.parse.issue_count} parser issue${data.parse.issue_count === 1 ? "" : "s"}` : "Deterministic demo fixture";
|
||||
const PAGE_SIZE = 60;
|
||||
const SEVERITY_RANK: Record<string, number> = { critical: 3, error: 2, warning: 1, info: 0 };
|
||||
|
||||
function CampaignCard({
|
||||
campaign,
|
||||
timestampDisplay,
|
||||
onOpen,
|
||||
}: {
|
||||
campaign: Campaign;
|
||||
timestampDisplay: TimestampDisplay;
|
||||
onOpen: () => void;
|
||||
}) {
|
||||
const tone =
|
||||
campaign.severity === "critical" || campaign.severity === "error"
|
||||
? "high"
|
||||
: campaign.severity === "warning"
|
||||
? "medium"
|
||||
: "info";
|
||||
return (
|
||||
<button type="button" className={`incident-card campaign-card severity-${tone}`} onClick={onOpen}>
|
||||
<div className="incident-card-heading">
|
||||
<span className="incident-icon">
|
||||
<Icon name="clock" />
|
||||
</span>
|
||||
<strong>{campaign.title}</strong>
|
||||
<span className="severity-pill">{campaign.incident_ids.length} windows</span>
|
||||
</div>
|
||||
<p>{campaign.reasons[0]}</p>
|
||||
<footer>
|
||||
<span>{formatRange(campaign.start, campaign.end, timestampDisplay)}</span>
|
||||
<b>{campaign.event_count.toLocaleString()} events</b>
|
||||
</footer>
|
||||
<span className="incident-card-action">
|
||||
Inspect first window <Icon name="arrow-right" />
|
||||
</span>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
export function AnalysisView({
|
||||
data,
|
||||
timestampDisplay,
|
||||
activeIncidentId,
|
||||
onOpen,
|
||||
onOpenFile,
|
||||
onDemo,
|
||||
}: {
|
||||
data: Analysis | null;
|
||||
timestampDisplay: TimestampDisplay;
|
||||
activeIncidentId: string;
|
||||
onOpen: (incident: Incident) => void;
|
||||
onOpenFile: () => void;
|
||||
onDemo: () => void;
|
||||
}) {
|
||||
const [visible, setVisible] = useState(PAGE_SIZE);
|
||||
if (!data)
|
||||
return (
|
||||
<>
|
||||
<WorkspaceHeader
|
||||
eyebrow="Workspace 01"
|
||||
title="Analysis"
|
||||
description="A compact overview of the current event-log reconstruction."
|
||||
/>
|
||||
<EmptyState onOpen={onOpenFile} onDemo={onDemo} />
|
||||
</>
|
||||
);
|
||||
const statusDetail = data.parse
|
||||
? `${data.parse.skipped_records} skipped · ${data.parse.issue_count} parser issue${data.parse.issue_count === 1 ? "" : "s"}`
|
||||
: "Deterministic demo fixture";
|
||||
const sourceMode = data.parse ? "EVTX file" : "Demo fixture";
|
||||
return <><WorkspaceHeader eyebrow="Workspace 01 · Overview" title="Analysis" description="Understand completeness and incident windows before opening the evidence timeline." /><section className="analysis-summary" aria-label="Analysis summary"><div className={`analysis-status-card status-${data.parse?.status ?? "complete"}`}><span className="eyebrow">Analysis status</span><strong>{statusLabel(data)}</strong><p>{statusDetail}</p></div><div className="metric-grid"><MetricCard icon={<Icon name="file" />} value={data.events.length.toLocaleString()} label="events parsed" /><MetricCard icon={<Icon name="warning" />} value={data.incidents.length} label="incident windows" tone={data.incidents.length ? "amber" : "green"} /><MetricCard icon={<Icon name="clock" />} value={sourceMode} label="source mode" /></div></section><section className="analysis-section"><div className="section-heading"><div><p className="eyebrow">Deterministic reconstruction</p><h2>Incident windows</h2></div><span className="section-count">{data.incidents.length} found</span></div>{data.incidents.length ? <div className="incident-grid">{data.incidents.map((incident) => <IncidentCard key={incident.id} incident={incident} timestampDisplay={timestampDisplay} selected={activeIncidentId === incident.id} onOpen={onOpen} />)}</div> : <div className="quiet-empty"><h3>No incident windows found</h3><p>Warning and error evidence remains available in Timeline and Hunting for manual review.</p></div>}</section>{!data.parse ? <section className="analysis-note analysis-note-demo"><Icon name="info" /><div><strong>How to continue</strong><p>Select an incident to open its linked evidence in Timeline, or use Hunting to search the complete normalized event set.</p></div></section> : null}</>;
|
||||
const campaigns = data.campaigns ?? [];
|
||||
const index = analysisIndex(data);
|
||||
// Incidents inside a campaign are summarized by the campaign card; the rest are ranked by severity, then time.
|
||||
const standalone = data.incidents
|
||||
.filter((incident) => !incident.campaign_id)
|
||||
.map((incident, order) => ({ incident, order }))
|
||||
.sort(
|
||||
(a, b) =>
|
||||
(SEVERITY_RANK[b.incident.severity] ?? 0) - (SEVERITY_RANK[a.incident.severity] ?? 0) || a.order - b.order,
|
||||
)
|
||||
.map(({ incident }) => incident);
|
||||
const shown = standalone.slice(0, visible);
|
||||
return (
|
||||
<>
|
||||
<WorkspaceHeader
|
||||
eyebrow="Workspace 01 · Overview"
|
||||
title="Analysis"
|
||||
description="Understand completeness and incident windows before opening the evidence timeline."
|
||||
/>
|
||||
<section className="analysis-summary" aria-label="Analysis summary">
|
||||
<div className={`analysis-status-card status-${data.parse?.status ?? "complete"}`}>
|
||||
<span className="eyebrow">Analysis status</span>
|
||||
<strong>{statusLabel(data)}</strong>
|
||||
<p>{statusDetail}</p>
|
||||
</div>
|
||||
<div className="metric-grid">
|
||||
<MetricCard icon={<Icon name="file" />} value={data.events.length.toLocaleString()} label="events parsed" />
|
||||
<MetricCard
|
||||
icon={<Icon name="warning" />}
|
||||
value={data.incidents.length.toLocaleString()}
|
||||
label="incident windows"
|
||||
tone={data.incidents.length ? "amber" : "green"}
|
||||
/>
|
||||
<MetricCard
|
||||
icon={<Icon name="clock" />}
|
||||
value={campaigns.length.toLocaleString()}
|
||||
label="recurring campaigns"
|
||||
/>
|
||||
<MetricCard icon={<Icon name="clock" />} value={sourceMode} label="source mode" />
|
||||
</div>
|
||||
</section>
|
||||
{campaigns.length ? (
|
||||
<section className="analysis-section">
|
||||
<div className="section-heading">
|
||||
<div>
|
||||
<p className="eyebrow">Recurring activity</p>
|
||||
<h2>Campaigns</h2>
|
||||
</div>
|
||||
<span className="section-count">{campaigns.length.toLocaleString()} found</span>
|
||||
</div>
|
||||
<div className="incident-grid">
|
||||
{campaigns.map((campaign) => (
|
||||
<CampaignCard
|
||||
key={campaign.id}
|
||||
campaign={campaign}
|
||||
timestampDisplay={timestampDisplay}
|
||||
onOpen={() => {
|
||||
const first = index.incidentById.get(campaign.incident_ids[0]);
|
||||
if (first) onOpen(first);
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
) : null}
|
||||
<section className="analysis-section">
|
||||
<div className="section-heading">
|
||||
<div>
|
||||
<p className="eyebrow">Deterministic reconstruction</p>
|
||||
<h2>Incident windows</h2>
|
||||
{campaigns.length ? (
|
||||
<p className="muted-copy">Windows that belong to a campaign are summarized above.</p>
|
||||
) : null}
|
||||
</div>
|
||||
<span className="section-count">{standalone.length.toLocaleString()} found</span>
|
||||
</div>
|
||||
{standalone.length ? (
|
||||
<>
|
||||
<div className="incident-grid">
|
||||
{shown.map((incident) => (
|
||||
<IncidentCard
|
||||
key={incident.id}
|
||||
incident={incident}
|
||||
timestampDisplay={timestampDisplay}
|
||||
selected={activeIncidentId === incident.id}
|
||||
onOpen={onOpen}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
{standalone.length > shown.length ? (
|
||||
<button
|
||||
type="button"
|
||||
className="secondary-button show-more"
|
||||
onClick={() => setVisible((count) => count + PAGE_SIZE)}
|
||||
>
|
||||
Show {Math.min(PAGE_SIZE, standalone.length - shown.length)} more of{" "}
|
||||
{(standalone.length - shown.length).toLocaleString()} remaining
|
||||
</button>
|
||||
) : null}
|
||||
</>
|
||||
) : (
|
||||
<div className="quiet-empty">
|
||||
<h3>{campaigns.length ? "No other incident windows" : "No incident windows found"}</h3>
|
||||
<p>Warning and error evidence remains available in Timeline and Hunting for manual review.</p>
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
{!data.parse ? (
|
||||
<section className="analysis-note analysis-note-demo">
|
||||
<Icon name="info" />
|
||||
<div>
|
||||
<strong>How to continue</strong>
|
||||
<p>
|
||||
Select an incident to open its linked evidence in Timeline, or use Hunting to search the complete
|
||||
normalized event set.
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
) : null}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,12 +1,274 @@
|
||||
import { useState } from "react";
|
||||
import type { Analysis, EventItem, Incident } from "../types";
|
||||
|
||||
export const HUNTING_PAGE_SIZE = 200;
|
||||
import { CATEGORIES, LEVELS, WINDOWS, type HuntingState, type InspectorTab, type TimestampDisplay } from "../app/model";
|
||||
import { formatClock, formatDate, levelLabel } from "../app/format";
|
||||
import { Icon } from "../components/icons";
|
||||
import { EmptyState, WorkspaceHeader } from "../components/states";
|
||||
import { EvidenceInspector } from "../components/timeline";
|
||||
|
||||
export function HuntingView({ data, state, providers, results, selected, activeIncident, timestampDisplay, inspectorTab, incidentEventIds, onChange, onReset, onSelectEvent, onMove, onTab, onOpenTimeline, onOpenFile, onDemo }: { data: Analysis | null; state: HuntingState; providers: string[]; results: EventItem[]; selected: EventItem | null; activeIncident: Incident | null; timestampDisplay: TimestampDisplay; inspectorTab: InspectorTab; incidentEventIds: Set<string>; onChange: (patch: Partial<HuntingState>) => void; onReset: () => void; onSelectEvent: (event: EventItem) => void; onMove: (delta: number) => void; onTab: (tab: InspectorTab) => void; onOpenTimeline: () => void; onOpenFile: () => void; onDemo: () => void }) {
|
||||
if (!data) return <><WorkspaceHeader eyebrow="Workspace 03 · Exploration" title="Hunting" description="Search the loaded normalized event set with compact investigative facets." /><EmptyState onOpen={onOpenFile} onDemo={onDemo} /></>;
|
||||
const active = Boolean(state.search || state.eventId || state.provider || state.category || state.level || state.computer || state.windowMinutes || state.incidentOnly);
|
||||
return <><WorkspaceHeader eyebrow="Workspace 03 · Exploration" title="Hunting" description="Combine event, provider, host and severity facets to find evidence without changing the source analysis." /><section className="hunting-query panel"><div className="hunting-query-main"><label className="search-field large"><Icon name="search" /><span className="sr-only">Search hunting evidence</span><input aria-label="Search hunting evidence" value={state.search} onChange={(event) => onChange({ search: event.target.value })} placeholder="Search summaries, fields, paths, IDs or providers…" /></label><span className="result-count" role="status"><strong>{results.length.toLocaleString()}</strong> of {data.events.length.toLocaleString()} matching events</span></div><div className="hunting-facets"><label><span>Event ID</span><input aria-label="Hunting event ID" inputMode="numeric" value={state.eventId} onChange={(event) => onChange({ eventId: event.target.value.replace(/[^0-9]/g, "") })} placeholder="4625" /></label><label><span>Provider</span><select aria-label="Hunting provider" value={state.provider} onChange={(event) => onChange({ provider: event.target.value })}><option value="">All providers</option>{providers.map((provider) => <option key={provider}>{provider}</option>)}</select></label><label><span>Category</span><select aria-label="Hunting category" value={state.category} onChange={(event) => onChange({ category: event.target.value })}><option value="">All categories</option>{CATEGORIES.map((category) => <option key={category}>{category}</option>)}</select></label><label><span>Level</span><select aria-label="Hunting level" value={state.level} onChange={(event) => onChange({ level: event.target.value })}><option value="">All levels</option>{LEVELS.map((level) => <option key={level}>{level}</option>)}</select></label><label><span>Computer / host</span><input aria-label="Hunting computer" value={state.computer} onChange={(event) => onChange({ computer: event.target.value })} placeholder="DEMO-PC" /></label><label><span>Time window</span><select aria-label="Hunting time window" value={state.windowMinutes} onChange={(event) => onChange({ windowMinutes: Number(event.target.value) })} disabled={!selected?.timestamp}><option value={0}>All time</option>{WINDOWS.filter(Boolean).map((value) => <option value={value} key={value}>± {value} min</option>)}</select></label><label className="toggle-control facet-toggle"><input type="checkbox" checked={state.incidentOnly} onChange={(event) => onChange({ incidentOnly: event.target.checked })} /><span className="toggle-track" /><span>Known incident evidence only</span></label><button type="button" className="reset-button" onClick={onReset} disabled={!active}><Icon name="reset" />Reset hunting</button></div></section><section className="hunting-layout"><article className="hunting-results panel"><header className="panel-header"><div><p className="eyebrow">Normalized event set</p><h2>Results</h2></div><span className="panel-count">{results.length.toLocaleString()} found</span></header>{results.length ? <div className="hunting-result-list" role="list">{results.map((event) => <div role="listitem" key={event.id}><button type="button" className={`hunting-result ${selected?.id === event.id ? "active" : ""}`} onClick={() => onSelectEvent(event)}><span className="result-time">{formatDate(event.timestamp, timestampDisplay)}<br />{formatClock(event.timestamp, timestampDisplay)}</span><strong>{event.event_id ?? "—"}</strong><span className="result-main"><b>{event.provider}</b><span>{event.summary}</span></span><span className="result-meta">{event.computer || "—"}<br /><small className={`level-text level-${event.level}`}>{levelLabel(event.level)}</small></span><span className={`membership-dot ${incidentEventIds.has(event.id) ? "known" : ""}`} title={incidentEventIds.has(event.id) ? "Known incident evidence" : "Unlinked event"} aria-label={incidentEventIds.has(event.id) ? "Known incident evidence" : "Unlinked event"} /></button></div>)}</div> : <div className="quiet-empty"><h3>No matching events</h3><p>Try clearing a facet or search the complete normalized dataset.</p>{active ? <button type="button" className="text-button" onClick={onReset}>Reset hunting filters</button> : null}</div>}</article><EvidenceInspector data={data} event={selected} visibleEvents={results} activeIncident={activeIncident} timestampDisplay={timestampDisplay} tab={inspectorTab} onTab={onTab} onSelectEvent={onSelectEvent} onMove={onMove} onOpenTimeline={onOpenTimeline} /></section><p className="hunting-hint"><Icon name="info" /> Results are local normalized evidence. A known-incident marker means the event is linked by an existing deterministic rule; it does not establish causality.</p></>;
|
||||
export function HuntingView({
|
||||
data,
|
||||
anchorCandidate,
|
||||
state,
|
||||
providers,
|
||||
results,
|
||||
selected,
|
||||
activeIncident,
|
||||
timestampDisplay,
|
||||
inspectorTab,
|
||||
incidentEventIds,
|
||||
onChange,
|
||||
onReset,
|
||||
onSelectEvent,
|
||||
onMove,
|
||||
onTab,
|
||||
onOpenTimeline,
|
||||
onOpenFile,
|
||||
onDemo,
|
||||
}: {
|
||||
data: Analysis | null;
|
||||
anchorCandidate: string | null;
|
||||
state: HuntingState;
|
||||
providers: string[];
|
||||
results: EventItem[];
|
||||
selected: EventItem | null;
|
||||
activeIncident: Incident | null;
|
||||
timestampDisplay: TimestampDisplay;
|
||||
inspectorTab: InspectorTab;
|
||||
incidentEventIds: Set<string>;
|
||||
onChange: (patch: Partial<HuntingState>) => void;
|
||||
onReset: () => void;
|
||||
onSelectEvent: (event: EventItem) => void;
|
||||
onMove: (delta: number) => void;
|
||||
onTab: (tab: InspectorTab) => void;
|
||||
onOpenTimeline: () => void;
|
||||
onOpenFile: () => void;
|
||||
onDemo: () => void;
|
||||
}) {
|
||||
// Results are rendered in pages so a broad query over 100,000 events does not create 100,000 DOM rows.
|
||||
const [page, setPage] = useState({ results, limit: HUNTING_PAGE_SIZE });
|
||||
const limit = page.results === results ? page.limit : HUNTING_PAGE_SIZE;
|
||||
if (!data)
|
||||
return (
|
||||
<>
|
||||
<WorkspaceHeader
|
||||
eyebrow="Workspace 03 · Exploration"
|
||||
title="Hunting"
|
||||
description="Search the loaded normalized event set with compact investigative facets."
|
||||
/>
|
||||
<EmptyState onOpen={onOpenFile} onDemo={onDemo} />
|
||||
</>
|
||||
);
|
||||
const selectedIndex = selected ? results.indexOf(selected) : -1;
|
||||
const shown = results.slice(0, Math.max(limit, selectedIndex + 1));
|
||||
const active = Boolean(
|
||||
state.search ||
|
||||
state.eventId ||
|
||||
state.provider ||
|
||||
state.category ||
|
||||
state.level ||
|
||||
state.computer ||
|
||||
state.windowMinutes ||
|
||||
state.incidentOnly,
|
||||
);
|
||||
return (
|
||||
<>
|
||||
<WorkspaceHeader
|
||||
eyebrow="Workspace 03 · Exploration"
|
||||
title="Hunting"
|
||||
description="Combine event, provider, host and severity facets to find evidence without changing the source analysis."
|
||||
/>
|
||||
<section className="hunting-query panel">
|
||||
<div className="hunting-query-main">
|
||||
<label className="search-field large">
|
||||
<Icon name="search" />
|
||||
<span className="sr-only">Search hunting evidence</span>
|
||||
<input
|
||||
aria-label="Search hunting evidence"
|
||||
value={state.search}
|
||||
onChange={(event) => onChange({ search: event.target.value })}
|
||||
placeholder="Search summaries, fields, paths, IDs or providers…"
|
||||
/>
|
||||
</label>
|
||||
<span className="result-count" role="status">
|
||||
<strong>{results.length.toLocaleString()}</strong> of {data.events.length.toLocaleString()} matching events
|
||||
</span>
|
||||
</div>
|
||||
<div className="hunting-facets">
|
||||
<label>
|
||||
<span>Event ID</span>
|
||||
<input
|
||||
aria-label="Hunting event ID"
|
||||
inputMode="numeric"
|
||||
value={state.eventId}
|
||||
onChange={(event) => onChange({ eventId: event.target.value.replace(/[^0-9]/g, "") })}
|
||||
placeholder="4625"
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
<span>Provider</span>
|
||||
<select
|
||||
aria-label="Hunting provider"
|
||||
value={state.provider}
|
||||
onChange={(event) => onChange({ provider: event.target.value })}
|
||||
>
|
||||
<option value="">All providers</option>
|
||||
{providers.map((provider) => (
|
||||
<option key={provider}>{provider}</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
<span>Category</span>
|
||||
<select
|
||||
aria-label="Hunting category"
|
||||
value={state.category}
|
||||
onChange={(event) => onChange({ category: event.target.value })}
|
||||
>
|
||||
<option value="">All categories</option>
|
||||
{CATEGORIES.map((category) => (
|
||||
<option key={category}>{category}</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
<span>Level</span>
|
||||
<select
|
||||
aria-label="Hunting level"
|
||||
value={state.level}
|
||||
onChange={(event) => onChange({ level: event.target.value })}
|
||||
>
|
||||
<option value="">All levels</option>
|
||||
{LEVELS.map((level) => (
|
||||
<option key={level}>{level}</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
<span>Computer / host</span>
|
||||
<input
|
||||
aria-label="Hunting computer"
|
||||
value={state.computer}
|
||||
onChange={(event) => onChange({ computer: event.target.value })}
|
||||
placeholder="DEMO-PC"
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
<span>Time window</span>
|
||||
<select
|
||||
aria-label="Hunting time window"
|
||||
value={state.windowMinutes}
|
||||
onChange={(event) => onChange({ windowMinutes: Number(event.target.value) })}
|
||||
disabled={!state.windowAnchor && !anchorCandidate}
|
||||
>
|
||||
<option value={0}>All time</option>
|
||||
{WINDOWS.filter(Boolean).map((value) => (
|
||||
<option value={value} key={value}>
|
||||
± {value} min
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label className="toggle-control facet-toggle">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={state.incidentOnly}
|
||||
onChange={(event) => onChange({ incidentOnly: event.target.checked })}
|
||||
/>
|
||||
<span className="toggle-track" />
|
||||
<span>Known incident evidence only</span>
|
||||
</label>
|
||||
<button type="button" className="reset-button" onClick={onReset} disabled={!active}>
|
||||
<Icon name="reset" />
|
||||
Reset hunting
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
<section className="hunting-layout">
|
||||
<article className="hunting-results panel">
|
||||
<header className="panel-header">
|
||||
<div>
|
||||
<p className="eyebrow">Normalized event set</p>
|
||||
<h2>Results</h2>
|
||||
</div>
|
||||
<span className="panel-count">{results.length.toLocaleString()} found</span>
|
||||
</header>
|
||||
{results.length ? (
|
||||
<>
|
||||
<div className="hunting-result-list" role="list">
|
||||
{shown.map((event) => (
|
||||
<div role="listitem" key={event.id}>
|
||||
<button
|
||||
type="button"
|
||||
className={`hunting-result ${selected?.id === event.id ? "active" : ""}`}
|
||||
onClick={() => onSelectEvent(event)}
|
||||
>
|
||||
<span className="result-time">
|
||||
{formatDate(event.timestamp, timestampDisplay)}
|
||||
<br />
|
||||
{formatClock(event.timestamp, timestampDisplay)}
|
||||
</span>
|
||||
<strong>{event.event_id ?? "—"}</strong>
|
||||
<span className="result-main">
|
||||
<b>{event.provider}</b>
|
||||
<span>{event.summary}</span>
|
||||
</span>
|
||||
<span className="result-meta">
|
||||
{event.computer || "—"}
|
||||
<br />
|
||||
<small className={`level-text level-${event.level}`}>{levelLabel(event.level)}</small>
|
||||
</span>
|
||||
<span
|
||||
className={`membership-dot ${incidentEventIds.has(event.id) ? "known" : ""}`}
|
||||
title={incidentEventIds.has(event.id) ? "Known incident evidence" : "Unlinked event"}
|
||||
aria-label={incidentEventIds.has(event.id) ? "Known incident evidence" : "Unlinked event"}
|
||||
/>
|
||||
</button>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
{results.length > shown.length ? (
|
||||
<button
|
||||
type="button"
|
||||
className="secondary-button show-more"
|
||||
onClick={() => setPage({ results, limit: shown.length + HUNTING_PAGE_SIZE })}
|
||||
>
|
||||
Show {Math.min(HUNTING_PAGE_SIZE, results.length - shown.length).toLocaleString()} more of{" "}
|
||||
{(results.length - shown.length).toLocaleString()} remaining
|
||||
</button>
|
||||
) : null}
|
||||
</>
|
||||
) : (
|
||||
<div className="quiet-empty">
|
||||
<h3>No matching events</h3>
|
||||
<p>Try clearing a facet or search the complete normalized dataset.</p>
|
||||
{active ? (
|
||||
<button type="button" className="text-button" onClick={onReset}>
|
||||
Reset hunting filters
|
||||
</button>
|
||||
) : null}
|
||||
</div>
|
||||
)}
|
||||
</article>
|
||||
<EvidenceInspector
|
||||
data={data}
|
||||
event={selected}
|
||||
visibleEvents={results}
|
||||
activeIncident={activeIncident}
|
||||
timestampDisplay={timestampDisplay}
|
||||
tab={inspectorTab}
|
||||
onTab={onTab}
|
||||
onSelectEvent={onSelectEvent}
|
||||
onMove={onMove}
|
||||
onOpenTimeline={onOpenTimeline}
|
||||
/>
|
||||
</section>
|
||||
<p className="hunting-hint">
|
||||
<Icon name="info" /> Results are local normalized evidence. A known-incident marker means the event is linked by
|
||||
an existing deterministic rule; it does not establish causality.
|
||||
</p>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,13 +1,291 @@
|
||||
import { prepareExport } from "../export";
|
||||
import type { RedactionSummary } from "../redact";
|
||||
import type { Analysis } from "../types";
|
||||
import { sourceLabel, statusLabel } from "../app/format";
|
||||
import { formatBytes, sourceLabel, statusLabel } from "../app/format";
|
||||
import type { TimestampDisplay } from "../app/model";
|
||||
import { Icon } from "../components/icons";
|
||||
import { EmptyState, WorkspaceHeader } from "../components/states";
|
||||
|
||||
export function ReportsView({ data, redactExports, redactionPreview, onRedactionChange, onExportJson, onExportMarkdown, timestampDisplay, onOpenFile, onDemo }: { data: Analysis | null; redactExports: boolean; redactionPreview: ReturnType<typeof prepareExport>["redaction"]; onRedactionChange: (value: boolean) => void; onExportJson: () => void; onExportMarkdown: () => void; timestampDisplay: TimestampDisplay; onOpenFile: () => void; onDemo: () => void }) {
|
||||
if (!data) return <><WorkspaceHeader eyebrow="Workspace 04 · Output" title="Reports" description="Review completeness and privacy choices before exporting an investigation." /><EmptyState onOpen={onOpenFile} onDemo={onDemo} /></>;
|
||||
export function ReportsView({
|
||||
data,
|
||||
redactExports,
|
||||
redactionPreview,
|
||||
redactionPending,
|
||||
redactionFailed,
|
||||
exporting,
|
||||
onRedactionChange,
|
||||
onExportJson,
|
||||
onExportMarkdown,
|
||||
timestampDisplay,
|
||||
onOpenFile,
|
||||
onDemo,
|
||||
}: {
|
||||
data: Analysis | null;
|
||||
redactExports: boolean;
|
||||
redactionPreview: RedactionSummary | null;
|
||||
redactionPending: boolean;
|
||||
redactionFailed: boolean;
|
||||
exporting: boolean;
|
||||
onRedactionChange: (value: boolean) => void;
|
||||
onExportJson: () => void;
|
||||
onExportMarkdown: () => void;
|
||||
timestampDisplay: TimestampDisplay;
|
||||
onOpenFile: () => void;
|
||||
onDemo: () => void;
|
||||
}) {
|
||||
if (!data)
|
||||
return (
|
||||
<>
|
||||
<WorkspaceHeader
|
||||
eyebrow="Workspace 04 · Output"
|
||||
title="Reports"
|
||||
description="Review completeness and privacy choices before exporting an investigation."
|
||||
/>
|
||||
<EmptyState onOpen={onOpenFile} onDemo={onDemo} />
|
||||
</>
|
||||
);
|
||||
const parse = data.parse;
|
||||
const readiness = parse?.status === "partial" ? "Review completeness before sharing" : redactExports ? "Ready for review/export" : "Privacy review recommended";
|
||||
return <><WorkspaceHeader eyebrow="Workspace 04 · Output" title="Reports" description="Review the exact analysis metadata, parser issues and redaction behavior before sharing." /><section className={`export-readiness ${parse?.status === "partial" ? "partial" : redactExports ? "ready" : "caution"}`}><Icon name={parse?.status === "partial" || !redactExports ? "warning" : "export"} /><div><strong>{readiness}</strong><span>{parse?.status === "partial" ? "The parser retained a partial result; incident reconstruction may be incomplete." : redactExports ? "Redaction substitutions are enabled. Review the generated output before sharing." : "Raw normalized evidence will be exported unless redaction is enabled."}</span></div></section><div className="report-grid"><section className="report-card panel"><div className="section-heading"><div><p className="eyebrow">Investigation summary</p><h2>Analysis metadata</h2></div></div><dl className="report-facts"><div><dt>Source</dt><dd title={data.source}>{sourceLabel(data.source)}</dd></div><div><dt>Version</dt><dd>EventLens v{import.meta.env.VITE_EVENTLENS_VERSION ?? "development"}</dd></div><div><dt>Events</dt><dd>{data.events.length.toLocaleString()}</dd></div><div><dt>Incidents</dt><dd>{data.incidents.length}</dd></div><div><dt>Timestamp display</dt><dd>{timestampDisplay === "utc" ? "UTC" : "Local browser time"}</dd></div></dl></section><section className="report-card panel"><div className="section-heading"><div><p className="eyebrow">Completeness</p><h2>Parser status</h2></div><span className={`status-badge status-${parse?.status ?? "demo"}`}>{statusLabel(data)}</span></div><div className="completeness-summary"><strong>{parse ? `${parse.parsed_events.toLocaleString()} retained` : "Demo fixture loaded"}</strong><span>{parse ? `${parse.records_seen.toLocaleString()} records seen · ${parse.skipped_records.toLocaleString()} skipped · ${parse.issue_count.toLocaleString()} issue(s)` : "The bundled demo is deterministic and bypasses raw EVTX parsing."}</span></div>{parse?.truncation_reason ? <p className="warning-copy">Truncation reason: <code>{parse.truncation_reason}</code></p> : null}{parse?.issues.length ? <ul className="issue-list">{parse.issues.map((issue, index) => <li key={`${issue.code}-${index}`}><code>{issue.code}</code><span>{issue.message}</span></li>)}</ul> : <p className="muted-copy">No parser issues were reported.</p>}</section><section className="report-card panel privacy-card"><div className="section-heading"><div><p className="eyebrow">Privacy before sharing</p><h2>Redaction preview</h2></div><label className="toggle-control"><input type="checkbox" checked={redactExports} onChange={(event) => onRedactionChange(event.target.checked)} /><span className="toggle-track" /><span>Redact export</span></label></div><p>Redaction is best effort. It propagates known structured values into summaries and applies conservative patterns; review the exported file before sharing.</p>{redactExports ? <div className="redaction-stats">{([["replacements", redactionPreview?.total ?? 0], ["hosts", redactionPreview?.hosts ?? 0], ["identities", redactionPreview?.identities ?? 0], ["emails", redactionPreview?.emails ?? 0], ["IPs", redactionPreview?.ips ?? 0], ["paths", redactionPreview?.paths ?? 0], ["sources", redactionPreview?.sources ?? 0]] as const).map(([label, value]) => <span key={label}><strong>{value}</strong>{label}</span>)}</div> : <div className="raw-export-warning"><Icon name="warning" /><span>Raw normalized evidence will be exported. Review carefully before sharing.</span></div>}</section><section className="report-card panel export-card"><div className="section-heading"><div><p className="eyebrow">Portable output</p><h2>Export report</h2></div></div><p>JSON preserves the analysis contract. Markdown is formatted for human review. Both include completeness metadata, parser issues and evidence IDs.</p><div className="export-actions"><button type="button" className="primary-button" onClick={onExportMarkdown}><Icon name="export" />Export Markdown</button><button type="button" className="secondary-button" onClick={onExportJson}><Icon name="export" />Export JSON</button></div></section></div></>;
|
||||
const readiness =
|
||||
parse?.status === "partial"
|
||||
? "Review completeness before sharing"
|
||||
: redactExports
|
||||
? "Ready for review/export"
|
||||
: "Privacy review recommended";
|
||||
return (
|
||||
<>
|
||||
<WorkspaceHeader
|
||||
eyebrow="Workspace 04 · Output"
|
||||
title="Reports"
|
||||
description="Review the exact analysis metadata, parser issues and redaction behavior before sharing."
|
||||
/>
|
||||
<section
|
||||
className={`export-readiness ${parse?.status === "partial" ? "partial" : redactExports ? "ready" : "caution"}`}
|
||||
>
|
||||
<Icon name={parse?.status === "partial" || !redactExports ? "warning" : "export"} />
|
||||
<div>
|
||||
<strong>{readiness}</strong>
|
||||
<span>
|
||||
{parse?.status === "partial"
|
||||
? "The parser retained a partial result; incident reconstruction may be incomplete."
|
||||
: redactExports
|
||||
? "Redaction substitutions are enabled. Review the generated output before sharing."
|
||||
: "Raw normalized evidence will be exported unless redaction is enabled."}
|
||||
</span>
|
||||
</div>
|
||||
</section>
|
||||
<div className="report-grid">
|
||||
<section className="report-card panel">
|
||||
<div className="section-heading">
|
||||
<div>
|
||||
<p className="eyebrow">Investigation summary</p>
|
||||
<h2>Analysis metadata</h2>
|
||||
</div>
|
||||
</div>
|
||||
<dl className="report-facts">
|
||||
<div>
|
||||
<dt>Source</dt>
|
||||
<dd title={data.source}>{sourceLabel(data.source)}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Version</dt>
|
||||
<dd>EventLens v{import.meta.env.VITE_EVENTLENS_VERSION ?? "development"}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Events</dt>
|
||||
<dd>{data.events.length.toLocaleString()}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Incidents</dt>
|
||||
<dd>{data.incidents.length.toLocaleString()}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Campaigns</dt>
|
||||
<dd>{(data.campaigns ?? []).length.toLocaleString()}</dd>
|
||||
</div>
|
||||
{data.source_info ? (
|
||||
<div className="source-hash">
|
||||
<dt>Source SHA-256</dt>
|
||||
<dd>
|
||||
<code title="SHA-256 of the uploaded bytes, computed in memory before parsing">
|
||||
{data.source_info.sha256}
|
||||
</code>
|
||||
<small>{formatBytes(data.source_info.size_bytes)}</small>
|
||||
</dd>
|
||||
</div>
|
||||
) : (
|
||||
<div>
|
||||
<dt>Source integrity</dt>
|
||||
<dd>Demo fixture — no uploaded bytes</dd>
|
||||
</div>
|
||||
)}
|
||||
<div>
|
||||
<dt>Timestamp display</dt>
|
||||
<dd>{timestampDisplay === "utc" ? "UTC" : "Local browser time"}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</section>
|
||||
<section className="report-card panel">
|
||||
<div className="section-heading">
|
||||
<div>
|
||||
<p className="eyebrow">Completeness</p>
|
||||
<h2>Parser status</h2>
|
||||
</div>
|
||||
<span className={`status-badge status-${parse?.status ?? "demo"}`}>{statusLabel(data)}</span>
|
||||
</div>
|
||||
<div className="completeness-summary">
|
||||
<strong>{parse ? `${parse.parsed_events.toLocaleString()} retained` : "Demo fixture loaded"}</strong>
|
||||
<span>
|
||||
{parse
|
||||
? `${parse.records_seen.toLocaleString()} records seen · ${parse.skipped_records.toLocaleString()} skipped · ${parse.issue_count.toLocaleString()} issue(s)`
|
||||
: "The bundled demo is deterministic and bypasses raw EVTX parsing."}
|
||||
</span>
|
||||
</div>
|
||||
{parse?.truncation_reason ? (
|
||||
<p className="warning-copy">
|
||||
Truncation reason: <code>{parse.truncation_reason}</code>
|
||||
</p>
|
||||
) : null}
|
||||
{parse && Object.keys(parse.issue_counts ?? {}).length ? (
|
||||
<div className="issue-counts">
|
||||
{Object.entries(parse.issue_counts ?? {}).map(([code, count]) => (
|
||||
<span key={code}>
|
||||
<code>{code}</code>
|
||||
<strong>{count.toLocaleString()}</strong>
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
) : null}
|
||||
{parse?.issues.length ? (
|
||||
<ul className="issue-list">
|
||||
{parse.issues.map((issue, index) => (
|
||||
<li key={`${issue.code}-${index}`}>
|
||||
<code>{issue.code}</code>
|
||||
<span>{issue.message}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
) : (
|
||||
<p className="muted-copy">No parser issues were reported.</p>
|
||||
)}
|
||||
{parse?.issues_truncated ? (
|
||||
<p className="muted-copy">
|
||||
Showing the first {parse.issues.length.toLocaleString()} of {parse.issue_count.toLocaleString()} issues;
|
||||
the counts above include all of them.
|
||||
</p>
|
||||
) : null}
|
||||
</section>
|
||||
<section className="report-card panel privacy-card">
|
||||
<div className="section-heading">
|
||||
<div>
|
||||
<p className="eyebrow">Privacy before sharing</p>
|
||||
<h2>Redaction preview</h2>
|
||||
</div>
|
||||
<label className="toggle-control">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={redactExports}
|
||||
onChange={(event) => onRedactionChange(event.target.checked)}
|
||||
/>
|
||||
<span className="toggle-track" />
|
||||
<span>Redact export</span>
|
||||
</label>
|
||||
</div>
|
||||
<p>
|
||||
Redaction is best effort. It propagates known structured values into summaries and applies conservative
|
||||
patterns; review the exported file before sharing.
|
||||
</p>
|
||||
{redactExports && redactionFailed ? (
|
||||
<div className="raw-export-warning" role="alert">
|
||||
<Icon name="warning" />
|
||||
<span>
|
||||
The redaction preview could not be computed. Exports stay blocked from raw fallback; retry or disable
|
||||
redaction deliberately.
|
||||
</span>
|
||||
</div>
|
||||
) : redactExports && redactionPending ? (
|
||||
<div className="redaction-pending" role="status">
|
||||
<span className="loading-spinner" aria-hidden="true" />
|
||||
Preparing redaction preview in the background…
|
||||
</div>
|
||||
) : redactExports ? (
|
||||
<>
|
||||
<div className="redaction-stats">
|
||||
{(
|
||||
[
|
||||
["replacements", redactionPreview?.total ?? 0],
|
||||
["hosts", redactionPreview?.hosts ?? 0],
|
||||
["identities", redactionPreview?.identities ?? 0],
|
||||
["emails", redactionPreview?.emails ?? 0],
|
||||
["IPs", redactionPreview?.ips ?? 0],
|
||||
["paths", redactionPreview?.paths ?? 0],
|
||||
["domains", redactionPreview?.domains ?? 0],
|
||||
["sources", redactionPreview?.sources ?? 0],
|
||||
] as const
|
||||
).map(([label, value]) => (
|
||||
<span key={label}>
|
||||
<strong>{value.toLocaleString()}</strong>
|
||||
{label}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
<p className="muted-copy">
|
||||
Values become consistent pseudonyms such as <code>[REDACTED_HOST_1]</code>, so relationships stay
|
||||
readable without exposing the original.
|
||||
</p>
|
||||
{redactionPreview?.untouchedFieldKeys.length ? (
|
||||
<details className="untouched-fields">
|
||||
<summary>
|
||||
{redactionPreview.untouchedFieldKeys.length} field name(s) exported without masking — review these
|
||||
</summary>
|
||||
<ul>
|
||||
{redactionPreview.untouchedFieldKeys.map((key) => (
|
||||
<li key={key}>
|
||||
<code>{key}</code>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</details>
|
||||
) : null}
|
||||
</>
|
||||
) : (
|
||||
<div className="raw-export-warning">
|
||||
<Icon name="warning" />
|
||||
<span>Raw normalized evidence will be exported. Review carefully before sharing.</span>
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
<section className="report-card panel export-card">
|
||||
<div className="section-heading">
|
||||
<div>
|
||||
<p className="eyebrow">Portable output</p>
|
||||
<h2>Export report</h2>
|
||||
</div>
|
||||
</div>
|
||||
<p>
|
||||
JSON preserves the analysis contract. Markdown is formatted for human review. Both include completeness
|
||||
metadata, parser issues and evidence IDs.
|
||||
</p>
|
||||
<div className="export-actions">
|
||||
<button
|
||||
type="button"
|
||||
className="primary-button"
|
||||
onClick={onExportMarkdown}
|
||||
disabled={exporting || (redactExports && redactionFailed)}
|
||||
>
|
||||
<Icon name="export" />
|
||||
{exporting ? "Preparing…" : "Export Markdown"}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="secondary-button"
|
||||
onClick={onExportJson}
|
||||
disabled={exporting || (redactExports && redactionFailed)}
|
||||
>
|
||||
<Icon name="export" />
|
||||
Export JSON
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -33,11 +33,25 @@ function OptionCard({ checked, description, name, onChange, title }: OptionCardP
|
||||
);
|
||||
}
|
||||
|
||||
export function SettingsView({ settings, saveNotice, storageFailed, storageConfirmed, onChange, onReset }: SettingsViewProps) {
|
||||
export function SettingsView({
|
||||
settings,
|
||||
saveNotice,
|
||||
storageFailed,
|
||||
storageConfirmed,
|
||||
onChange,
|
||||
onReset,
|
||||
}: SettingsViewProps) {
|
||||
const headerAction = (
|
||||
<div className="settings-header-status">
|
||||
{storageConfirmed && !storageFailed ? <span className="settings-saved-automatically"><Icon name="check" />Saved automatically in this browser</span> : null}
|
||||
<span className="settings-save-feedback" role="status" aria-live="polite">{saveNotice}</span>
|
||||
{storageConfirmed && !storageFailed ? (
|
||||
<span className="settings-saved-automatically">
|
||||
<Icon name="check" />
|
||||
Saved automatically in this browser
|
||||
</span>
|
||||
) : null}
|
||||
<span className="settings-save-feedback" role="status" aria-live="polite">
|
||||
{saveNotice}
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -62,15 +76,39 @@ export function SettingsView({ settings, saveNotice, storageFailed, storageConfi
|
||||
<fieldset>
|
||||
<legend>Timestamp display</legend>
|
||||
<div className="preference-option-grid">
|
||||
<OptionCard name="timestamp-display" title="UTC" description="Stable forensic reference time" checked={settings.timestampDisplay === "utc"} onChange={() => onChange({ timestampDisplay: "utc" })} />
|
||||
<OptionCard name="timestamp-display" title="Local browser time" description="Useful for local investigation context" checked={settings.timestampDisplay === "local"} onChange={() => onChange({ timestampDisplay: "local" })} />
|
||||
<OptionCard
|
||||
name="timestamp-display"
|
||||
title="UTC"
|
||||
description="Stable forensic reference time"
|
||||
checked={settings.timestampDisplay === "utc"}
|
||||
onChange={() => onChange({ timestampDisplay: "utc" })}
|
||||
/>
|
||||
<OptionCard
|
||||
name="timestamp-display"
|
||||
title="Local browser time"
|
||||
description="Useful for local investigation context"
|
||||
checked={settings.timestampDisplay === "local"}
|
||||
onChange={() => onChange({ timestampDisplay: "local" })}
|
||||
/>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>Interface density</legend>
|
||||
<div className="preference-option-grid">
|
||||
<OptionCard name="density" title="Comfortable" description="More breathing room for review" checked={settings.density === "comfortable"} onChange={() => onChange({ density: "comfortable" })} />
|
||||
<OptionCard name="density" title="Compact" description="More evidence visible at once" checked={settings.density === "compact"} onChange={() => onChange({ density: "compact" })} />
|
||||
<OptionCard
|
||||
name="density"
|
||||
title="Comfortable"
|
||||
description="More breathing room for review"
|
||||
checked={settings.density === "comfortable"}
|
||||
onChange={() => onChange({ density: "comfortable" })}
|
||||
/>
|
||||
<OptionCard
|
||||
name="density"
|
||||
title="Compact"
|
||||
description="More evidence visible at once"
|
||||
checked={settings.density === "compact"}
|
||||
onChange={() => onChange({ density: "compact" })}
|
||||
/>
|
||||
</div>
|
||||
</fieldset>
|
||||
</section>
|
||||
@@ -89,7 +127,11 @@ export function SettingsView({ settings, saveNotice, storageFailed, storageConfi
|
||||
<strong>Informational noise</strong>
|
||||
<small>Hide routine informational events by default and update the current Timeline filter.</small>
|
||||
</span>
|
||||
<select aria-label="Default noise mode" value={settings.defaultNoise} onChange={(event) => onChange({ defaultNoise: event.target.value as UiSettings["defaultNoise"] })}>
|
||||
<select
|
||||
aria-label="Default noise mode"
|
||||
value={settings.defaultNoise}
|
||||
onChange={(event) => onChange({ defaultNoise: event.target.value as UiSettings["defaultNoise"] })}
|
||||
>
|
||||
<option value="attention">Hide by default</option>
|
||||
<option value="all">Show by default</option>
|
||||
</select>
|
||||
@@ -99,8 +141,18 @@ export function SettingsView({ settings, saveNotice, storageFailed, storageConfi
|
||||
<strong>Default workspace</strong>
|
||||
<small>Workspace opened when EventLens starts without a deep link.</small>
|
||||
</span>
|
||||
<select aria-label="Default workspace" value={settings.defaultWorkspace} onChange={(event) => onChange({ defaultWorkspace: event.target.value as UiSettings["defaultWorkspace"] })}>
|
||||
{WORKSPACES.map((workspace) => <option key={workspace} value={workspace}>{workspace[0].toUpperCase() + workspace.slice(1)}</option>)}
|
||||
<select
|
||||
aria-label="Default workspace"
|
||||
value={settings.defaultWorkspace}
|
||||
onChange={(event) =>
|
||||
onChange({ defaultWorkspace: event.target.value as UiSettings["defaultWorkspace"] })
|
||||
}
|
||||
>
|
||||
{WORKSPACES.map((workspace) => (
|
||||
<option key={workspace} value={workspace}>
|
||||
{workspace[0].toUpperCase() + workspace.slice(1)}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label className="preference-row preference-switch-row">
|
||||
@@ -109,8 +161,17 @@ export function SettingsView({ settings, saveNotice, storageFailed, storageConfi
|
||||
<small>Recommended · Redaction remains best effort and should be reviewed.</small>
|
||||
</span>
|
||||
<span className="preference-switch">
|
||||
<input className="sr-only" type="checkbox" role="switch" aria-label="Export redaction by default" checked={settings.defaultRedaction} onChange={(event) => onChange({ defaultRedaction: event.target.checked })} />
|
||||
<span className="preference-switch-track" aria-hidden="true"><span /></span>
|
||||
<input
|
||||
className="sr-only"
|
||||
type="checkbox"
|
||||
role="switch"
|
||||
aria-label="Export redaction by default"
|
||||
checked={settings.defaultRedaction}
|
||||
onChange={(event) => onChange({ defaultRedaction: event.target.checked })}
|
||||
/>
|
||||
<span className="preference-switch-track" aria-hidden="true">
|
||||
<span />
|
||||
</span>
|
||||
<b aria-hidden="true">{settings.defaultRedaction ? "On" : "Off"}</b>
|
||||
</span>
|
||||
</label>
|
||||
@@ -126,7 +187,11 @@ export function SettingsView({ settings, saveNotice, storageFailed, storageConfi
|
||||
<h2 id="local-privacy-heading">Local data & privacy</h2>
|
||||
</div>
|
||||
</header>
|
||||
<p className="privacy-lead">{storageFailed ? "Preferences are available for this session only because browser storage is unavailable." : "Only your interface preferences remain in this browser."}</p>
|
||||
<p className="privacy-lead">
|
||||
{storageFailed
|
||||
? "Preferences are available for this session only because browser storage is unavailable."
|
||||
: "Only your interface preferences remain in this browser."}
|
||||
</p>
|
||||
<div className="privacy-facts">
|
||||
<section>
|
||||
<strong>{storageFailed ? "Not saved to browser storage" : "Stored locally"}</strong>
|
||||
@@ -144,11 +209,16 @@ export function SettingsView({ settings, saveNotice, storageFailed, storageConfi
|
||||
</div>
|
||||
<details className="settings-technical-details">
|
||||
<summary>Technical details</summary>
|
||||
<p>{storageFailed ? "When browser storage is available, preferences use this validated record:" : "The browser uses one validated preference record:"}</p>
|
||||
<p>
|
||||
{storageFailed
|
||||
? "When browser storage is available, preferences use this validated record:"
|
||||
: "The browser uses one validated preference record:"}
|
||||
</p>
|
||||
<code>eventlens.preferences.v1</code>
|
||||
</details>
|
||||
<button type="button" className="secondary-button settings-reset" onClick={onReset}>
|
||||
<Icon name="reset" />Reset all preferences
|
||||
<Icon name="reset" />
|
||||
Reset all preferences
|
||||
</button>
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
@@ -3,7 +3,108 @@ import type { FilterState, InspectorTab, TimestampDisplay } from "../app/model";
|
||||
import { EmptyState, WorkspaceHeader } from "../components/states";
|
||||
import { EvidenceInspector, FilterToolbar, IncidentContext, TimelinePanel } from "../components/timeline";
|
||||
|
||||
export function TimelineView({ data, filters, providers, visibleEvents, selected, activeIncident, activeIncidentId, focusIncident, timestampDisplay, rowHeight, inspectorTab, onFilterChange, onResetFilters, onFocusChange, onSelectIncident, onSelectEvent, onMove, onTab, onOpenFile, onDemo }: { data: Analysis | null; filters: FilterState; providers: string[]; visibleEvents: EventItem[]; selected: EventItem | null; activeIncident: Incident | null; activeIncidentId: string; focusIncident: boolean; timestampDisplay: TimestampDisplay; rowHeight: number; inspectorTab: InspectorTab; onFilterChange: (patch: Partial<FilterState>) => void; onResetFilters: () => void; onFocusChange: (value: boolean) => void; onSelectIncident: (id: string) => void; onSelectEvent: (event: EventItem) => void; onMove: (delta: number) => void; onTab: (tab: InspectorTab) => void; onOpenFile: () => void; onDemo: () => void }) {
|
||||
if (!data) return <><WorkspaceHeader eyebrow="Workspace 02 · Investigation" title="Timeline" description="Search and inspect normalized evidence in chronological context." /><EmptyState onOpen={onOpenFile} onDemo={onDemo} /></>;
|
||||
return <><WorkspaceHeader eyebrow="Workspace 02 · Investigation" title="Timeline" description="The primary forensic workspace for event sequence, incident evidence and normalized details." /><IncidentContext incidents={data.incidents} activeIncidentId={activeIncidentId} focusIncident={focusIncident} onSelect={onSelectIncident} onFocus={onFocusChange} /><FilterToolbar filters={filters} providers={providers} visibleCount={visibleEvents.length} totalCount={data.events.length} anchorTimestamp={selected?.timestamp ?? activeIncident?.start ?? null} activeIncident={activeIncident} focusIncident={focusIncident} onFocusChange={onFocusChange} onChange={onFilterChange} onReset={onResetFilters} /><section className="timeline-layout"><TimelinePanel events={visibleEvents} selectedId={selected?.id ?? null} rowHeight={rowHeight} timestampDisplay={timestampDisplay} onSelect={onSelectEvent} /><EvidenceInspector data={data} event={selected} visibleEvents={visibleEvents} activeIncident={activeIncident} timestampDisplay={timestampDisplay} tab={inspectorTab} onTab={onTab} onSelectEvent={onSelectEvent} onMove={onMove} /></section></>;
|
||||
export function TimelineView({
|
||||
data,
|
||||
anchorCandidate,
|
||||
filters,
|
||||
providers,
|
||||
visibleEvents,
|
||||
selected,
|
||||
activeIncident,
|
||||
activeIncidentId,
|
||||
focusIncident,
|
||||
timestampDisplay,
|
||||
rowHeight,
|
||||
inspectorTab,
|
||||
onFilterChange,
|
||||
onResetFilters,
|
||||
onFocusChange,
|
||||
onSelectIncident,
|
||||
onSelectEvent,
|
||||
onMove,
|
||||
onTab,
|
||||
onOpenFile,
|
||||
onDemo,
|
||||
}: {
|
||||
data: Analysis | null;
|
||||
anchorCandidate: string | null;
|
||||
filters: FilterState;
|
||||
providers: string[];
|
||||
visibleEvents: EventItem[];
|
||||
selected: EventItem | null;
|
||||
activeIncident: Incident | null;
|
||||
activeIncidentId: string;
|
||||
focusIncident: boolean;
|
||||
timestampDisplay: TimestampDisplay;
|
||||
rowHeight: number;
|
||||
inspectorTab: InspectorTab;
|
||||
onFilterChange: (patch: Partial<FilterState>) => void;
|
||||
onResetFilters: () => void;
|
||||
onFocusChange: (value: boolean) => void;
|
||||
onSelectIncident: (id: string) => void;
|
||||
onSelectEvent: (event: EventItem) => void;
|
||||
onMove: (delta: number) => void;
|
||||
onTab: (tab: InspectorTab) => void;
|
||||
onOpenFile: () => void;
|
||||
onDemo: () => void;
|
||||
}) {
|
||||
if (!data)
|
||||
return (
|
||||
<>
|
||||
<WorkspaceHeader
|
||||
eyebrow="Workspace 02 · Investigation"
|
||||
title="Timeline"
|
||||
description="Search and inspect normalized evidence in chronological context."
|
||||
/>
|
||||
<EmptyState onOpen={onOpenFile} onDemo={onDemo} />
|
||||
</>
|
||||
);
|
||||
return (
|
||||
<>
|
||||
<WorkspaceHeader
|
||||
eyebrow="Workspace 02 · Investigation"
|
||||
title="Timeline"
|
||||
description="The primary forensic workspace for event sequence, incident evidence and normalized details."
|
||||
/>
|
||||
<IncidentContext
|
||||
incidents={data.incidents}
|
||||
activeIncidentId={activeIncidentId}
|
||||
focusIncident={focusIncident}
|
||||
onSelect={onSelectIncident}
|
||||
onFocus={onFocusChange}
|
||||
/>
|
||||
<FilterToolbar
|
||||
filters={filters}
|
||||
providers={providers}
|
||||
visibleCount={visibleEvents.length}
|
||||
totalCount={data.events.length}
|
||||
anchorTimestamp={filters.windowAnchor ?? anchorCandidate}
|
||||
activeIncident={activeIncident}
|
||||
focusIncident={focusIncident}
|
||||
onFocusChange={onFocusChange}
|
||||
onChange={onFilterChange}
|
||||
onReset={onResetFilters}
|
||||
/>
|
||||
<section className="timeline-layout">
|
||||
<TimelinePanel
|
||||
events={visibleEvents}
|
||||
selectedId={selected?.id ?? null}
|
||||
rowHeight={rowHeight}
|
||||
timestampDisplay={timestampDisplay}
|
||||
onSelect={onSelectEvent}
|
||||
/>
|
||||
<EvidenceInspector
|
||||
data={data}
|
||||
event={selected}
|
||||
visibleEvents={visibleEvents}
|
||||
activeIncident={activeIncident}
|
||||
timestampDisplay={timestampDisplay}
|
||||
tab={inspectorTab}
|
||||
onTab={onTab}
|
||||
onSelectEvent={onSelectEvent}
|
||||
onMove={onMove}
|
||||
/>
|
||||
</section>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -6,6 +6,9 @@ import { fileURLToPath } from "node:url";
|
||||
const version = readFileSync(resolve(fileURLToPath(new URL(".", import.meta.url)), "../VERSION"), "utf-8").trim();
|
||||
|
||||
export default defineConfig({
|
||||
worker: {
|
||||
format: "es",
|
||||
},
|
||||
define: {
|
||||
"import.meta.env.VITE_EVENTLENS_VERSION": JSON.stringify(version),
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user