diff --git a/db/findings.go b/db/findings.go index 325b02d..23c1cc3 100644 --- a/db/findings.go +++ b/db/findings.go @@ -26,15 +26,20 @@ type DBFinding struct { // Finding triage states (findings.status). const ( FindingPending = "pending" // 待处理 + FindingInProgress = "in_progress" // 处理中 + FindingConfirmed = "confirmed" // 已确认(真实漏洞,未修复) + FindingResolved = "resolved" // 已处理(已修复) FindingFalsePositive = "false_positive" // 误报 FindingIgnored = "ignored" // 忽略 - FindingResolved = "resolved" // 已处理 + FindingDuplicate = "duplicate" // 重复 + FindingRiskAccepted = "risk_accepted" // 风险接受 ) // ValidFindingStatus reports whether s is a known triage state. func ValidFindingStatus(s string) bool { switch s { - case FindingPending, FindingFalsePositive, FindingIgnored, FindingResolved: + case FindingPending, FindingInProgress, FindingConfirmed, FindingResolved, + FindingFalsePositive, FindingIgnored, FindingDuplicate, FindingRiskAccepted: return true } return false diff --git a/db/schema.sql b/db/schema.sql index 098c21c..2662e43 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -545,7 +545,8 @@ CREATE TABLE IF NOT EXISTS findings ( evidence TEXT NOT NULL DEFAULT '', worker TEXT NOT NULL DEFAULT '', asset_ids JSONB NOT NULL DEFAULT '[]', - -- 处置状态:pending 待处理 / false_positive 误报 / ignored 忽略 / resolved 已处理。 + -- 处置状态:pending 待处理 / in_progress 处理中 / confirmed 已确认 / resolved 已处理 / + -- false_positive 误报 / ignored 忽略 / duplicate 重复 / risk_accepted 风险接受。 -- 取值不加 CHECK:旧库靠下面的 ALTER 补列,CHECK 无法回填,统一由 server 侧白名单校验。 status TEXT NOT NULL DEFAULT 'pending', created_at TIMESTAMPTZ NOT NULL DEFAULT now() diff --git a/web/src/app/(main)/function/findings/page.tsx b/web/src/app/(main)/function/findings/page.tsx index 48b2679..3061f27 100644 --- a/web/src/app/(main)/function/findings/page.tsx +++ b/web/src/app/(main)/function/findings/page.tsx @@ -40,9 +40,13 @@ import type { Finding, FindingStats, FindingStatus, Severity } from "@/lib/types const FINDING_STATUSES: FindingStatus[] = [ "pending", + "in_progress", + "confirmed", + "resolved", "false_positive", "ignored", - "resolved", + "duplicate", + "risk_accepted", ]; const EMPTY_STATS: FindingStats = { diff --git a/web/src/app/(main)/function/tasks/detail/_tabs/findings-tab.tsx b/web/src/app/(main)/function/tasks/detail/_tabs/findings-tab.tsx index 7be64c3..e1df1df 100644 --- a/web/src/app/(main)/function/tasks/detail/_tabs/findings-tab.tsx +++ b/web/src/app/(main)/function/tasks/detail/_tabs/findings-tab.tsx @@ -18,9 +18,13 @@ import type { Finding, FindingStatus } from "@/lib/types"; const FINDING_STATUSES: FindingStatus[] = [ "pending", + "in_progress", + "confirmed", + "resolved", "false_positive", "ignored", - "resolved", + "duplicate", + "risk_accepted", ]; function Row({ diff --git a/web/src/lib/status.ts b/web/src/lib/status.ts index daa3742..5d45ba2 100644 --- a/web/src/lib/status.ts +++ b/web/src/lib/status.ts @@ -65,9 +65,13 @@ const severity: Record = { const finding: Record = { pending: { label: "待处理", tone: "amber" }, + in_progress: { label: "处理中", tone: "blue" }, + confirmed: { label: "已确认", tone: "red" }, + resolved: { label: "已处理", tone: "green" }, false_positive: { label: "误报", tone: "slate" }, ignored: { label: "忽略", tone: "neutral" }, - resolved: { label: "已处理", tone: "green" }, + duplicate: { label: "重复", tone: "neutral" }, + risk_accepted: { label: "风险接受", tone: "violet" }, }; const engine: Record = { diff --git a/web/src/lib/types.ts b/web/src/lib/types.ts index 1a5f061..a199111 100644 --- a/web/src/lib/types.ts +++ b/web/src/lib/types.ts @@ -239,8 +239,16 @@ export interface TaskNode { // ---- Findings ---- export type Severity = "high" | "medium" | "low"; -// 漏洞处置状态:待处理 / 误报 / 忽略 / 已处理。 -export type FindingStatus = "pending" | "false_positive" | "ignored" | "resolved"; +// 漏洞处置状态:待处理 / 处理中 / 已确认 / 已处理 / 误报 / 忽略 / 重复 / 风险接受。 +export type FindingStatus = + | "pending" + | "in_progress" + | "confirmed" + | "resolved" + | "false_positive" + | "ignored" + | "duplicate" + | "risk_accepted"; // FindingAsset 是一个漏洞绑定的资产(已在后端预渲染 label)。 export interface FindingAsset {