@@ -20,7 +20,6 @@ import (
2020 "github.com/future-architect/vuls/gost"
2121 "github.com/future-architect/vuls/logging"
2222 "github.com/future-architect/vuls/models"
23- "github.com/future-architect/vuls/oval"
2423 "github.com/future-architect/vuls/reporter"
2524 "github.com/future-architect/vuls/util"
2625 cvemodels "github.com/vulsio/go-cve-dictionary/models"
@@ -51,7 +50,7 @@ func Detect(rs []models.ScanResult, dir string) ([]models.ScanResult, error) {
5150 return nil , xerrors .Errorf ("Failed to fill with Library dependency: %w" , err )
5251 }
5352
54- if err := DetectPkgCves (& r , config .Conf .OvalDict , config . Conf . Gost , config .Conf .Vuls2 , config .Conf .LogOpts , config .Conf .NoProgress ); err != nil {
53+ if err := DetectPkgCves (& r , config .Conf .Gost , config .Conf .Vuls2 , config .Conf .LogOpts , config .Conf .NoProgress ); err != nil {
5554 return nil , xerrors .Errorf ("Failed to detect Pkg CVE: %w" , err )
5655 }
5756
@@ -318,19 +317,14 @@ func Detect(rs []models.ScanResult, dir string) ([]models.ScanResult, error) {
318317}
319318
320319// DetectPkgCves detects OS pkg cves
321- // pass 3 configs
322- func DetectPkgCves (r * models.ScanResult , ovalCnf config.GovalDictConf , gostCnf config.GostConf , vuls2Conf config.Vuls2Conf , logOpts logging.LogOpts , noProgress bool ) error {
320+ func DetectPkgCves (r * models.ScanResult , gostCnf config.GostConf , vuls2Conf config.Vuls2Conf , logOpts logging.LogOpts , noProgress bool ) error {
323321 if isPkgCvesDetactable (r ) {
324322 switch r .Family {
325- case constant .RedHat , constant .CentOS , constant .Fedora , constant .Alma , constant .Rocky , constant .Oracle , constant .Alpine , constant .Ubuntu ,
323+ case constant .RedHat , constant .CentOS , constant .Fedora , constant .Alma , constant .Rocky , constant .Oracle , constant .Alpine , constant .Amazon , constant . Ubuntu ,
326324 constant .OpenSUSE , constant .OpenSUSELeap , constant .SUSEEnterpriseServer , constant .SUSEEnterpriseDesktop :
327325 if err := vuls2 .Detect (r , vuls2Conf , noProgress ); err != nil {
328326 return xerrors .Errorf ("Failed to detect CVE with Vuls2: %w" , err )
329327 }
330- case constant .Amazon :
331- if err := detectPkgsCvesWithOval (ovalCnf , r , logOpts ); err != nil {
332- return xerrors .Errorf ("Failed to detect CVE with OVAL: %w" , err )
333- }
334328 case constant .Debian , constant .Raspbian , constant .Windows :
335329 // gost(Debian Security Tracker) does not support Package for Raspbian, so skip it.
336330 if r .Family == constant .Raspbian {
@@ -375,27 +369,27 @@ func DetectPkgCves(r *models.ScanResult, ovalCnf config.GovalDictConf, gostCnf c
375369 return nil
376370}
377371
378- // isPkgCvesDetactable checks whether CVEs is detactable with gost and oval from the result
372+ // isPkgCvesDetactable checks whether CVEs is detactable with gost and vuls2 from the result
379373func isPkgCvesDetactable (r * models.ScanResult ) bool {
380374 switch r .Family {
381375 case constant .FreeBSD , constant .MacOSX , constant .MacOSXServer , constant .MacOS , constant .MacOSServer , constant .ServerTypePseudo :
382- logging .Log .Infof ("%s type. Skip OVAL, gost and vuls2 detection" , r .Family )
376+ logging .Log .Infof ("%s type. Skip gost and vuls2 detection" , r .Family )
383377 return false
384378 case constant .Windows :
385379 return true
386380 default :
387381 if r .ScannedVia == "trivy" {
388- logging .Log .Infof ("r.ScannedVia is trivy. Skip OVAL, gost and vuls2 detection" )
382+ logging .Log .Infof ("r.ScannedVia is trivy. Skip gost and vuls2 detection" )
389383 return false
390384 }
391385
392386 if r .Release == "" {
393- logging .Log .Infof ("r.Release is empty. Skip OVAL, gost and vuls2 detection" )
387+ logging .Log .Infof ("r.Release is empty. Skip gost and vuls2 detection" )
394388 return false
395389 }
396390
397391 if len (r .Packages )+ len (r .SrcPackages ) == 0 {
398- logging .Log .Infof ("Number of packages is 0. Skip OVAL, gost and vuls2 detection" )
392+ logging .Log .Infof ("Number of packages is 0. Skip gost and vuls2 detection" )
399393 return false
400394 }
401395 return true
@@ -538,43 +532,6 @@ func fillCertAlerts(cvedetail *cvemodels.CveDetail) (dict models.AlertDict) {
538532 return dict
539533}
540534
541- func detectPkgsCvesWithOval (cnf config.GovalDictConf , r * models.ScanResult , logOpts logging.LogOpts ) error {
542- client , err := oval .NewOVALClient (r .Family , cnf , logOpts )
543- if err != nil {
544- return xerrors .Errorf ("Failed to new OVAL client. err: %w" , err )
545- }
546- defer func () {
547- if err := client .CloseDB (); err != nil {
548- logging .Log .Errorf ("Failed to close the OVAL DB. err: %+v" , err )
549- }
550- }()
551-
552- logging .Log .Debugf ("Check if oval fetched: %s %s" , r .Family , r .Release )
553- ok , err := client .CheckIfOvalFetched (r .Family , r .Release )
554- if err != nil {
555- return xerrors .Errorf ("Failed to check if oval fetched: %w" , err )
556- }
557- if ! ok {
558- return xerrors .Errorf ("OVAL entries of %s %s are not found. Fetch OVAL before reporting. For details, see `https://github.com/vulsio/goval-dictionary#usage`" , r .Family , r .Release )
559- }
560-
561- logging .Log .Debugf ("Check if oval fresh: %s %s" , r .Family , r .Release )
562- _ , err = client .CheckIfOvalFresh (r .Family , r .Release )
563- if err != nil {
564- return xerrors .Errorf ("Failed to check if oval fresh: %w" , err )
565- }
566-
567- logging .Log .Debugf ("Fill with oval: %s %s" , r .Family , r .Release )
568- nCVEs , err := client .FillWithOval (r )
569- if err != nil {
570- return xerrors .Errorf ("Failed to fill with oval: %w" , err )
571- }
572-
573- logging .Log .Infof ("%s: %d CVEs are detected with OVAL" , r .FormatServerName (), nCVEs )
574-
575- return nil
576- }
577-
578535func detectPkgsCvesWithGost (cnf config.GostConf , r * models.ScanResult , logOpts logging.LogOpts ) error {
579536 client , err := gost .NewGostClient (cnf , r .Family , logOpts )
580537 if err != nil {
0 commit comments