Documentation
¶
Index ¶
- func GetBatchVulns(ctx context.Context, purls []models.PurlDetail, ...) ([]models.ScanResultVulnerabilities, []models.UnprocessedComponent, error)
- func GetCPEDetail(sbm *sbom.SBOM, inputRefs []InputSbomRef) []string
- func GetMeta(ctx context.Context, vulns []models.ScanResultVulnerabilities) ([]models.ScanResultVulnerabilities, error)
- func GetOfflineCpeVulns(indices cache.InfoFile, cpes []string, iterator func(cur int, total int), ...) ([]models.ScanResultVulnerabilities, error)
- func GetOfflineMeta(indices cache.InfoFile, vulns []models.ScanResultVulnerabilities, ...) ([]models.ScanResultVulnerabilities, bool, error)
- func GetOfflineVulns(indices cache.InfoFile, purls []models.PurlDetail, ...) ([]models.ScanResultVulnerabilities, error)
- func GetPURLDetail(sbm *sbom.SBOM, inputRefs []InputSbomRef) []models.PurlDetail
- func GetSBOM(dir string, opts SBOMOptions) (*sbom.SBOM, error)
- func GetVulns(ctx context.Context, purls []models.PurlDetail, ...) ([]models.ScanResultVulnerabilities, error)
- func SaveSBOM(sbm *sbom.SBOM, file string) error
- func SortResults(vulns []models.ScanResultVulnerabilities)
- func ValidateEnrich(directives []string) error
- type InputSbomRef
- type SBOMOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBatchVulns ¶ added in v0.11.8
func GetBatchVulns(ctx context.Context, purls []models.PurlDetail, iterator func(cur int, total int)) ([]models.ScanResultVulnerabilities, []models.UnprocessedComponent, error)
GetBatchVulns looks up every purl and also returns the components the API could not assess. Those never appear in the findings, so a caller that ignores the second return cannot tell a partial scan from a clean one.
func GetCPEDetail ¶ added in v0.9.2
func GetCPEDetail(sbm *sbom.SBOM, inputRefs []InputSbomRef) []string
func GetMeta ¶
func GetMeta(ctx context.Context, vulns []models.ScanResultVulnerabilities) ([]models.ScanResultVulnerabilities, error)
func GetOfflineCpeVulns ¶ added in v0.9.2
func GetOfflineMeta ¶ added in v0.10.0
func GetOfflineMeta(indices cache.InfoFile, vulns []models.ScanResultVulnerabilities, warnOnly bool) ([]models.ScanResultVulnerabilities, bool, error)
GetOfflineMeta enriches each vuln with CVSS / KEV / description data from the vulncheck-nvd2 index. The second return value reports whether that index was actually available; callers use it to surface a hint to the user when the table would otherwise show empty score columns. Without warnOnly the missing-index condition is a hard error; with warnOnly the input vulns are passed through unchanged so the caller can still render what it found.
func GetOfflineVulns ¶
func GetOfflineVulns(indices cache.InfoFile, purls []models.PurlDetail, iterator func(cur int, total int), warnOnly bool) ([]models.ScanResultVulnerabilities, error)
func GetPURLDetail ¶
func GetPURLDetail(sbm *sbom.SBOM, inputRefs []InputSbomRef) []models.PurlDetail
func GetVulns ¶
func GetVulns(ctx context.Context, purls []models.PurlDetail, iterator func(cur int, total int)) ([]models.ScanResultVulnerabilities, error)
func SortResults ¶ added in v1.2.0
func SortResults(vulns []models.ScanResultVulnerabilities)
SortResults orders findings so output.json is stable between identical scans; vulncheck-oss/action hashes it to dedupe PR comments. Neither source guarantees an order: the API dedupes through a map, and the offline queries carry no ORDER BY.
func ValidateEnrich ¶ added in v1.2.0
ValidateEnrich checks --enrich directives before any cataloguing starts. Without it an unrecognised scope is silently ignored: enrichmentScope simply never matches it, so `--enrich typo` or `--enrich vcpkg` looks accepted and quietly enriches nothing. Failing up front is the difference between "your flag did nothing" and "your SBOM is missing the metadata you asked for".
Matching is case-sensitive and the +/- prefixes are accepted, both for parity with syft, whose own directive comparison is an exact match against lowercase task names. Scopes in unsupportedScopes are rejected only in their enabling forms; see the negation carve-out below.
Types ¶
type InputSbomRef ¶ added in v0.8.5
type SBOMOptions ¶ added in v1.1.0
type SBOMOptions struct {
// Enrich is a passthrough of syft's `--enrich` scope list. Empty means
// enrichment is disabled and syft runs with its default (offline-safe)
// behaviour. Non-empty entries opt in to network-backed metadata lookups
// (proxy.golang.org, Maven Central, NPM registry, PyPI) — see
// buildEnrichConfig for which fields each scope flips.
Enrich []string
}
SBOMOptions carries knobs for GetSBOM. Kept as a struct so future toggles can be added without churning every caller.