Documentation
¶
Index ¶
- func DeployStagedUpdate(sourceDir, targetDir string) error
- func GetDatabaseStatus(scannerBin string, targetDir string) (string, time.Time, error)
- func GetGrypeUpdate(scannerBin, targetDir string) error
- func GetScannerVersion(scannerBin string) (string, error)
- func GrypeExeOutput[T any](cmd *exec.Cmd) (T, error)
- func GrypeTestScan(scannerBin, targetDir string) error
- func GrypeUpdateRequired(scannerBin, targetDir string) bool
- func ScanImage(task model.PharosScanTask, scanEngine *GrypeScanner, kvc *cache.PharosCache, ...) (model.PharosScanResult, []byte, []byte, error)
- func TranslateMessage(msg string) string
- type GrypeDbCheck
- type GrypeDbStatus
- type GrypeScanner
- type GrypeVersion
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeployStagedUpdate ¶
deploy staged update from sourceDir into targetDir
func GetDatabaseStatus ¶
check grype local database status, update DbState
func GetGrypeUpdate ¶
check if update is required, if so download to targetDir
func GetScannerVersion ¶
check grype binary version
func GrypeExeOutput ¶
run grype executable, parse result from json into T
func GrypeTestScan ¶
test scanner with actual scan of sample test sbom
func GrypeUpdateRequired ¶
check if local db in targetDir requires an update
func ScanImage ¶
func ScanImage(task model.PharosScanTask, scanEngine *GrypeScanner, kvc *cache.PharosCache, logger *zerolog.Logger) (model.PharosScanResult, []byte, []byte, error)
execute scan with grype scanner
func TranslateMessage ¶
Types ¶
type GrypeDbCheck ¶
type GrypeDbCheck struct {
UpdateAvailable bool `json:"updateAvailable"`
}
grype update check (from: grype db check -o json)
type GrypeDbStatus ¶
type GrypeDbStatus struct {
SchemaVersion string `json:"schemaVersion"`
From string `json:"from"`
Built time.Time `json:"built"`
Path string `json:"path"`
Valid bool `json:"valid"`
Error string `json:"error"`
}
grype local database status (from: grype db status -o json)
type GrypeScanner ¶
type GrypeScanner struct {
Engine string
HomeDir string
DbProdDir string // vuln db dir for production scanner
DbStageDir string // vuln db dir for staging new updates
ScannerBin string
ScanTimeout time.Duration
// version / status
ScannerVersion string
DatabaseVersion string
DatabaseUpdated time.Time
// contains filtered or unexported fields
}
grype vulnerability scanner
func NewGrypeScanner ¶
func NewGrypeScanner(scanTimeout time.Duration, updateDb bool, vulnDbDir string, logger *zerolog.Logger) (*GrypeScanner, error)
create grype scanner
func (*GrypeScanner) UpdateDatabase ¶
func (rx *GrypeScanner) UpdateDatabase() error
run grype database update (stage update first to keep scanner blocking minimal)
func (*GrypeScanner) VulnScanSbom ¶
func (rx *GrypeScanner) VulnScanSbom(sbom []byte) (grypetype.GrypeScanType, []byte, error)
scan cyclondex sbom with grype
Click to show internal directories.
Click to hide internal directories.