for Amazon Linux image (#896)
* fit amazon linux image's version to OVAL * add Arch to SrcPackage * lint go.mod * make fmt
This commit is contained in:
committed by
Kota Kanbe
parent
b7ca5e5590
commit
af58122c91
@@ -20,6 +20,7 @@ package scan
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/aquasecurity/fanal/analyzer"
|
||||
@@ -93,8 +94,16 @@ func detectContainerImage(c config.ServerInfo) (itsMe bool, containerImage osTyp
|
||||
return false, newDummyOS(c), err
|
||||
}
|
||||
|
||||
osName := os.Name
|
||||
switch os.Family {
|
||||
case fanalos.Amazon:
|
||||
osName = "1"
|
||||
if strings.HasPrefix(os.Family, "2") {
|
||||
osName = "2"
|
||||
}
|
||||
}
|
||||
p := newContainerImage(c, pkgs, libScanners)
|
||||
p.setDistro(os.Family, os.Name)
|
||||
p.setDistro(os.Family, osName)
|
||||
return true, p, nil
|
||||
}
|
||||
|
||||
@@ -164,6 +173,7 @@ func convertFanalToVulsPkg(pkgs []analyzer.Package) (map[string]models.Package,
|
||||
modelSrcPkgs[pkg.SrcName] = models.SrcPackage{
|
||||
Name: pkg.SrcName,
|
||||
Version: pkg.SrcVersion,
|
||||
Arch: pkg.Arch,
|
||||
BinaryNames: []string{pkg.Name},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user