mirror of
https://github.com/RuoJi6/ARTEX.git
synced 2026-12-07 05:11:51 +08:00
feat: expose traffic IDs and filter finding statistics
This commit is contained in:
1 parent
459a484237
commit
8ee94f2215
14 files changed
+333
-70
No files matched your search
@@ -132,3 +132,30 @@ test("group dates use the latest matching finding after filters", async () => {
|
||||
assert.equal(result.items[0].task_id, "10");
|
||||
assert.equal(result.items[0].last_found_at, fixtures[8].ts);
|
||||
});
|
||||
|
||||
test("finding statistics follow combined filters and retain global choices", async () => {
|
||||
const route = { path: "/exploration/findings/stats" };
|
||||
const all = await read(route);
|
||||
const filtered = await read(route, {
|
||||
task_id: "10",
|
||||
severity: "high",
|
||||
status: "pending",
|
||||
vulnclass: "Demo",
|
||||
q: "needle",
|
||||
from: "2026-01-04T00:00:00Z",
|
||||
to: "2026-01-04T23:59:59Z",
|
||||
page: "2",
|
||||
limit: "1",
|
||||
});
|
||||
assert.equal(filtered.total, 1);
|
||||
assert.equal(filtered.distinct.total, 1);
|
||||
assert.equal(filtered.high, 1);
|
||||
assert.equal(filtered.critical, 0);
|
||||
assert.deepEqual(filtered.tasks, all.tasks);
|
||||
assert.deepEqual(filtered.vulnclasses, all.vulnclasses);
|
||||
const empty = await read(route, { q: "no matching fixture" });
|
||||
assert.equal(empty.total, 0);
|
||||
assert.equal(empty.distinct.total, 0);
|
||||
assert.equal(empty.high + empty.medium + empty.low + empty.critical, 0);
|
||||
assert.deepEqual(empty.tasks, all.tasks);
|
||||
});
|
||||
@@ -2001,6 +2001,7 @@ function route(m: string, path: string, seg: string[], q: URLSearchParams, b: Re
|
||||
// ── exploration ──
|
||||
if (path === "/exploration/frontier") return D.frontier;
|
||||
if (path === "/exploration/findings/stats") {
|
||||
const list = mockApplyAssetScope(mockFilterFindings(q), q.get("asset_scope"));
|
||||
const vulnclasses = Array.from(new Set(mockFindings.map((f) => f.vulnclass))).sort();
|
||||
// 「按任务」下拉:有漏洞的任务 + 描述 + 条数(mock 任务 id 是字符串,直接当 id 用)。
|
||||
const taskMap = new Map<string, { name: string; description: string; count: number }>();
|
||||
@@ -2017,12 +2018,13 @@ function route(m: string, path: string, seg: string[], q: URLSearchParams, b: Re
|
||||
}
|
||||
const tasks = Array.from(taskMap, ([id, v]) => ({ id, name: v.name, description: v.description, count: v.count }));
|
||||
return {
|
||||
total: mockFindings.length,
|
||||
pending: mockFindings.filter((f) => f.status === "pending").length,
|
||||
critical: mockFindings.filter((f) => f.severity === "critical").length,
|
||||
high: mockFindings.filter((f) => f.severity === "high").length,
|
||||
medium: mockFindings.filter((f) => f.severity === "medium").length,
|
||||
low: mockFindings.filter((f) => f.severity === "low").length,
|
||||
total: list.length,
|
||||
pending: list.filter((f) => f.status === "pending").length,
|
||||
critical: list.filter((f) => f.severity === "critical").length,
|
||||
high: list.filter((f) => f.severity === "high").length,
|
||||
medium: list.filter((f) => f.severity === "medium").length,
|
||||
low: list.filter((f) => f.severity === "low").length,
|
||||
distinct: { total: list.length, reports: list.length },
|
||||
vulnclasses,
|
||||
tasks,
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user