Remove empty CveContent output to JSON with Alpine Linux scan (#550)

This commit is contained in:
Kota Kanbe
2017-12-04 12:52:32 +09:00
committed by GitHub
parent 76a9c37e6b
commit 383220f384
3 changed files with 35 additions and 22 deletions

View File

@@ -21,7 +21,6 @@ import (
"github.com/future-architect/vuls/config"
"github.com/future-architect/vuls/models"
"github.com/future-architect/vuls/util"
ovalmodels "github.com/kotakanbe/goval-dictionary/models"
)
// Alpine is the struct of Alpine Linux
@@ -58,15 +57,13 @@ func (o Alpine) FillWithOval(r *models.ScanResult) (err error) {
}
func (o Alpine) update(r *models.ScanResult, defPacks defPacks) {
ovalContent := *o.convertToModel(&defPacks.def)
cveID := defPacks.def.Advisory.Cves[0].CveID
vinfo, ok := r.ScannedCves[cveID]
if !ok {
util.Log.Debugf("%s is newly detected by OVAL", cveID)
vinfo = models.VulnInfo{
CveID: cveID,
Confidence: models.OvalMatch,
CveContents: models.NewCveContents(ovalContent),
CveID: cveID,
Confidence: models.OvalMatch,
}
}
@@ -74,9 +71,3 @@ func (o Alpine) update(r *models.ScanResult, defPacks defPacks) {
vinfo.AffectedPackages.Sort()
r.ScannedCves[cveID] = vinfo
}
func (o Alpine) convertToModel(def *ovalmodels.Definition) *models.CveContent {
return &models.CveContent{
CveID: def.Advisory.Cves[0].CveID,
}
}