本卡屬 FR-137(母卡 CM-2714),實作卡 ④/5:SBOM 掃完比上一次,新出現 high 以上就寄給額外通知對象並留紀錄;專案內通知紀錄頁。前置:卡 ①(alert_recipients 欄位);可與 ②③ 平行。設計:docs/features/FR-137-2610-recurring-tasks-and-conditional-notify/design.md §6.1 ②、§6.5、§6.6、§6.7 通知紀錄;雛形頁 3 docs/features/FR-137-2610-recurring-tasks-and-conditional-notify/prototype/notify-log.html。

這張卡做什麼(白話)

SBOM 原始碼掃描跑完後,跟同一個任務的上一次掃描比:如果多出了「上次沒有、這次才有」的 CRITICAL 或 HIGH 弱點,就寄信給任務上設定的額外通知對象(例如 CRA 的通報聯絡人),每封都記一筆。同一批老弱點不重寄。專案概覽頁頂端多一顆「通知紀錄」,點進去看本專案寄過哪些。

套件:jedi-source-scan 加「掃完」回呼(D14)

BE:門檻判斷(§6.5)

BE:收件人解析(§6.6)

資料:新表 compliance.task_alert_notifications(主線 migration)

id bigserial PK | uid varchar(36) NOT NULL UNIQUE | tenant_id int NOT NULL | org_unit_id int
project_id bigint NOT NULL  FK → compliance.projects.id ON DELETE CASCADE
job_execution_id bigint NOT NULL | scan_uid varchar(36) NOT NULL | vs_scan_uid varchar(36) 可空(首掃空)
new_critical_count int NOT NULL DEFAULT 0 | new_high_count int NOT NULL DEFAULT 0
recipient_email varchar(320) NOT NULL | recipient_label varchar(255)
sent_at timestamptz | result varchar(16) NOT NULL DEFAULT 'pending'(pending/sent/failed) | error text
created_at / updated_at timestamptz NOT NULL DEFAULT now()
UNIQUE (scan_uid, recipient_email)