Publish EventLens v1.1.0 (#1)

This commit was merged in pull request #1.
This commit is contained in:
Jens committed 2026-11-20 12:20:18 +00:00
1 parent c0ade21029
commit 87432f3283
63 files changed
+7381 -1420

No files matched your search

+88 -51
View File
@@ -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);
});
});