fix(scan): false positives in Debian Pkg for CVE-IDs already detected by Trivy (#1639)
* fix(scan): false positives in Debian Pkg for CVE-IDs already detected by Trivy * fix * Add detectionMethod only when detected by gost
This commit is contained in:
		@@ -160,42 +160,39 @@ func (deb Debian) detectCVEsWithFixState(r *models.ScanResult, fixStatus string)
 | 
			
		||||
					v.CveContents = models.NewCveContents(cve)
 | 
			
		||||
				} else {
 | 
			
		||||
					v.CveContents[models.DebianSecurityTracker] = []models.CveContent{cve}
 | 
			
		||||
					v.Confidences = models.Confidences{models.DebianSecurityTrackerMatch}
 | 
			
		||||
				}
 | 
			
		||||
			} else {
 | 
			
		||||
				v = models.VulnInfo{
 | 
			
		||||
					CveID:       cve.CveID,
 | 
			
		||||
					CveContents: models.NewCveContents(cve),
 | 
			
		||||
					Confidences: models.Confidences{models.DebianSecurityTrackerMatch},
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				if fixStatus == "resolved" {
 | 
			
		||||
					versionRelease := ""
 | 
			
		||||
					if p.isSrcPack {
 | 
			
		||||
						versionRelease = r.SrcPackages[p.packName].Version
 | 
			
		||||
					} else {
 | 
			
		||||
						versionRelease = r.Packages[p.packName].FormatVer()
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
					if versionRelease == "" {
 | 
			
		||||
						break
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
					affected, err := isGostDefAffected(versionRelease, p.fixes[i].FixedIn)
 | 
			
		||||
					if err != nil {
 | 
			
		||||
						logging.Log.Debugf("Failed to parse versions: %s, Ver: %s, Gost: %s",
 | 
			
		||||
							err, versionRelease, p.fixes[i].FixedIn)
 | 
			
		||||
						continue
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
					if !affected {
 | 
			
		||||
						continue
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				nCVEs++
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if fixStatus == "resolved" {
 | 
			
		||||
				versionRelease := ""
 | 
			
		||||
				if p.isSrcPack {
 | 
			
		||||
					versionRelease = r.SrcPackages[p.packName].Version
 | 
			
		||||
				} else {
 | 
			
		||||
					versionRelease = r.Packages[p.packName].FormatVer()
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				if versionRelease == "" {
 | 
			
		||||
					break
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				affected, err := isGostDefAffected(versionRelease, p.fixes[i].FixedIn)
 | 
			
		||||
				if err != nil {
 | 
			
		||||
					logging.Log.Debugf("Failed to parse versions: %s, Ver: %s, Gost: %s",
 | 
			
		||||
						err, versionRelease, p.fixes[i].FixedIn)
 | 
			
		||||
					continue
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				if !affected {
 | 
			
		||||
					continue
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			names := []string{}
 | 
			
		||||
			if p.isSrcPack {
 | 
			
		||||
				if srcPack, ok := r.SrcPackages[p.packName]; ok {
 | 
			
		||||
@@ -230,6 +227,7 @@ func (deb Debian) detectCVEsWithFixState(r *models.ScanResult, fixStatus string)
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			v.Confidences.AppendIfMissing(models.DebianSecurityTrackerMatch)
 | 
			
		||||
			r.ScannedCves[cve.CveID] = v
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user