@@ -130,19 +130,23 @@ func (ms Microsoft) DetectCVEs(r *models.ScanResult, _ bool) (nCVEs int, err err
130
130
131
131
for cveID , cve := range cves {
132
132
cveCont , mitigations := ms .ConvertToModel (& cve )
133
- advisories := []models. DistroAdvisory {}
133
+ uniqKB := map [ string ] struct {} {}
134
134
for _ , p := range cve .Products {
135
135
for _ , kb := range p .KBs {
136
- adv := models.DistroAdvisory {
137
- AdvisoryID : kb .Article ,
138
- Description : "Microsoft Knowledge Base" ,
139
- }
140
136
if _ , err := strconv .Atoi (kb .Article ); err == nil {
141
- adv .AdvisoryID = fmt .Sprintf ("KB%s" , kb .Article )
137
+ uniqKB [fmt .Sprintf ("KB%s" , kb .Article )] = struct {}{}
138
+ } else {
139
+ uniqKB [kb .Article ] = struct {}{}
142
140
}
143
- advisories = append (advisories , adv )
144
141
}
145
142
}
143
+ advisories := []models.DistroAdvisory {}
144
+ for kb := range uniqKB {
145
+ advisories = append (advisories , models.DistroAdvisory {
146
+ AdvisoryID : kb ,
147
+ Description : "Microsoft Knowledge Base" ,
148
+ })
149
+ }
146
150
147
151
r .ScannedCves [cveID ] = models.VulnInfo {
148
152
CveID : cveID ,
0 commit comments