Documentation
¶
Index ¶
Constants ¶
const ( AdvisoriesSetResolved = "resolved" AdvisoriesSetAll = "all" AdvisoriesSetConcluded = "concluded" )
Variables ¶
var DefaultGrypeDBDir = path.Join(xdg.CacheHome, "wolfictl", "grype", "db")
var DefaultOptions = Options{ MaxAllowedBuildAge: 120 * time.Hour, }
DefaultOptions is the recommended default configuration for a new Scanner. These options are suitable for most use scanning cases.
var ValidAdvisoriesSets = []string{AdvisoriesSetResolved, AdvisoriesSetAll, AdvisoriesSetConcluded}
Functions ¶
func NewGrypeVulnerabilityMatcher ¶ added in v0.15.1
func NewGrypeVulnerabilityMatcher(vulnProvider vulnerability.Provider, useCPEs bool) *grype.VulnerabilityMatcher
Types ¶
type DataSource ¶ added in v0.32.0
type DataSource struct {
// Kind states the type of data source used during the scan (e.g. "grype-db").
// This field can be used to better interpret the specific values populating the
// other fields of this struct.
Kind string
// Schema describes the schema version of the underlying vulnerability data
// source.
Schema string
// Integrity should provide some kind of machine-readable way for consumers of
// scan data to validate the data integrity of the underlying data source. This
// could be a checksum, signature, etc.
Integrity string
// Date indicates how fresh the dats source's data is.
Date time.Time
}
DataSource describes the underlying data used during the vulnerability scan, in such a way that is intentionally abstracted from any specific scanner implementation, to avoid scanner-specific types and dependencies leaking into our scan results processing pipeline.
type Finding ¶
type Finding struct {
Package Package
Vulnerability Vulnerability
CGAID string `json:",omitempty"`
// Deprecated: This field will be removed soon. Plan to use CGAID to lookup the
// associated advisory out-of-band, instead of using this pointer.
Advisory *v2.Advisory `json:",omitempty"`
// Deprecated: This field will be removed soon.
TriageAssessments []TriageAssessment `json:",omitempty"`
}
Finding represents a vulnerability finding for a single package.
type Options ¶ added in v0.18.0
type Options struct {
// PathOfDatabaseArchiveToImport, if set, is the path to a Grype vulnerability
// database archive (.tar.gz file) from which a database will be loaded by
// Grype.
//
// If empty, the default Grype database loading behavior will be used (e.g.
// downloading the database from the Internet).
PathOfDatabaseArchiveToImport string
// PathOfDatabaseDestinationDirectory is the directory to which the Grype
// database will be extracted, and where the database will be loaded from at
// runtime. If empty, the value of DefaultGrypeDBDir will be used.
PathOfDatabaseDestinationDirectory string
// UseCPEs controls whether the scanner will use CPEs to match vulnerabilities
// for matcher types that default to not using CPE matching. Most consumers will
// probably want this set to false in order to avoid excessive noise from
// matching.
UseCPEs bool
// DisableDatabaseAgeValidation controls whether the scanner will validate the
// age of the vulnerability database before using it. If true, the scanner will
// not validate the age of the database. This bool should always be set to false
// except for testing purposes.
DisableDatabaseAgeValidation bool
// MaxAllowedBuildAge defines the maximum allowed age for the vulnerability database.
// If the database is older than this duration, it will be considered invalid unless
// DisableDatabaseAgeValidation is set to true. If not specified, the default value
// of 48 hours will be used.
MaxAllowedBuildAge time.Duration
// DisableSBOMCache controls whether the scanner will cache SBOMs generated from
// APKs. If true, the scanner will not cache SBOMs or use existing cached SBOMs.
DisableSBOMCache bool
}
Options determine the configuration for a new Scanner. The zero-value of this struct is a valid configuration.
type Result ¶ added in v0.1.0
type Result struct {
TargetAPK TargetAPK
Findings []Finding
DataSource DataSource
}
type Scanner ¶ added in v0.11.0
type Scanner struct {
// contains filtered or unexported fields
}
func NewScanner ¶ added in v0.11.0
NewScanner initializes the grype DB for reuse across multiple scans.
func (*Scanner) Close ¶ added in v0.23.4
func (s *Scanner) Close()
Close closes the scanner's database connection.
func (*Scanner) DatabaseBuiltAt ¶ added in v0.38.16
DatabaseBuiltAt returns the time when the vulnerability database was built.
type TargetAPK ¶ added in v0.1.0
type TargetAPK struct {
// Name of the package in the APK (i.e., the value of pkgname in PKGINFO).
// Example: "libcrypto3".
Name string
// Version of the package in the APK (i.e., the value of pkgver in PKGINFO).
// Example: "3.0.11-r0".
Version string
// OriginPackageName is the name of the origin package for the package (i.e.,
// the value of origin in PKGINFO), which, for non-subpackages, would be the
// same as Name. Example: "openssl".
OriginPackageName string
// Arch is the architecture of the package (i.e., the value of arch in PKGINFO).
// Should be "aarch64" or "x86_64".
Arch string
}
type TriageAssessment
deprecated
added in
v0.8.0
type TriageAssessment struct {
// Source is the name of the source of the triage assessment, e.g.
// "govulncheck".
Source string
// TruePositive indicates whether the vulnerability is a true positive. A value
// of false indicates that the vulnerability has been assessed to be a false
// positive.
TruePositive bool
// Reason is the explanation of the triage assessment.
Reason string
}
Deprecated: This type will be removed soon.