diff --git a/cve-vulner-manager/common/analysis.go b/cve-vulner-manager/common/analysis.go index dde77746ea7f3fd66f983e4b4da03369ba3edf28..29a2aab165775bf027ef4b03e5e9723973180f28 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 170ce1d83f1b4b33c23b64c69cf028510545709d..a53b87cba6539543892f26a393bd7e7a9d7f5a48 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 f7ef021ba39da4cdbe39a28a6300d6a76029421e..ba843156f14b33d90909e5438237964967200a71 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 }