From 3164a970db9479bfc3c8d2223e7f8f975de6ed63 Mon Sep 17 00:00:00 2001 From: yangwei999 <348134071@qq.com> Date: Wed, 16 Jul 2025 14:38:30 +0800 Subject: [PATCH] optimize release cve --- cve-vulner-manager/common/analysis.go | 1 + cve-vulner-manager/models/cve_web.go | 6 ++++-- cve-vulner-manager/taskhandler/excel.go | 19 +++++++------------ 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/cve-vulner-manager/common/analysis.go b/cve-vulner-manager/common/analysis.go index dde7774..29a2aab 100644 --- a/cve-vulner-manager/common/analysis.go +++ b/cve-vulner-manager/common/analysis.go @@ -15,6 +15,7 @@ const ( AnalysisNotExecute = "不受影响-漏洞代码不在执行路径" AnalysisCodeNotPresent = "不受影响-漏洞代码不存在" + TypeFixed = "Fixed" TypeAffected = "Affected" TypeUnaffected = "Unaffected" TypeUnderInvestigation = "Under Investigation" diff --git a/cve-vulner-manager/models/cve_web.go b/cve-vulner-manager/models/cve_web.go index 170ce1d..a53b87c 100644 --- a/cve-vulner-manager/models/cve_web.go +++ b/cve-vulner-manager/models/cve_web.go @@ -1,5 +1,7 @@ package models +import "cvevulner/common" + type RespCommon struct { Code int Msg string @@ -16,7 +18,7 @@ type CveDetail struct { } func (d CveDetail) IsFixed() bool { - return d.Status == "Fixed" + return d.Status == common.TypeFixed } type RespCveDetail struct { @@ -36,7 +38,7 @@ type CveProduct struct { // IsFixed checks if the status of the CveProduct is "Fixed". func (c CveProduct) IsFixed() bool { - return c.Status == "Fixed" + return c.Status == common.TypeFixed } type Cve struct { diff --git a/cve-vulner-manager/taskhandler/excel.go b/cve-vulner-manager/taskhandler/excel.go index f7ef021..ba84315 100644 --- a/cve-vulner-manager/taskhandler/excel.go +++ b/cve-vulner-manager/taskhandler/excel.go @@ -493,16 +493,12 @@ func UnaffectIssueProc(affectBranch string, cvrfFileList map[string][]string, } } - var status string - var released bool - issueExist, _ := GetCveSecurityNotice(v.CveNum, v.Repo, true) - if issueExist { - // 没发布过的分支都要发布 - released, status = IsProductReleased(v.CveNum, v.Repo, affectBranch) - if released && status != common.TypeUnderInvestigation { - continue - } + // 发布过且为fixed就不需要发布了 + _, status := IsProductReleased(v.CveNum, v.Repo, affectBranch) + if status == common.TypeFixed { + continue } + if len(cves) != 0 && !filterDataInSlice(v.CveNum, cves) { continue } @@ -517,10 +513,9 @@ func UnaffectIssueProc(affectBranch string, cvrfFileList map[string][]string, continue } - // 发布过的分支状态如果是调查中,要被其他状态覆盖;覆盖时,如果该分支还是调查中,则忽略,不生成 + // 发布过的除fixed可能被修改,官网数据需要被覆盖,状态一致则忽略 if vx.IsIssueWithAnalysisVersion() && - status == common.TypeUnderInvestigation && - vx.GetReasonByVersion(affectBranch) == "" { + vx.AffectType(affectBranch) == status { continue } -- Gitee