Documentation
¶
Index ¶
- Variables
- func DetectedVulnerabilitiesTable(vulns []types.DetectedVulnerability) (*table.Table, error)
- func ScanFilepath(ctx context.Context, targetPath string) (types.Report, error)
- func ToFinding(res trivytypes.Result, v trivytypes.DetectedVulnerability, ...) findingspec.Finding
- type FindingSpecOptions
- type Report
- func (r *Report) ByLibraryHistogramSets() (*histogram.HistogramSets, error)
- func (r *Report) BySeverityHistogramSet() (*histogram.HistogramSet, error)
- func (r *Report) ByYearHistogramSets() (*histogram.HistogramSets, error)
- func (r *Report) Findings(opts FindingSpecOptions) *findingspec.FindingSet
- func (r *Report) ResultsCount() int
- func (r *Report) SeverityCounts() map[string]uint
- func (r *Report) TableSet(addDates bool) (*table.TableSet, error)
- func (r *Report) VulnerabiliesTable(addDates bool) (*table.Table, error)
- func (r *Report) VulnerabilityCount() int
Constants ¶
This section is empty.
Variables ¶
var ErrReportNotLoaded = errors.New("report not loaded")
Functions ¶
func DetectedVulnerabilitiesTable ¶
func DetectedVulnerabilitiesTable(vulns []types.DetectedVulnerability) (*table.Table, error)
func ScanFilepath ¶ added in v0.5.0
ScanFilepath executes trivy filesystem scan using the trivy command-line tool. This provides a clean Go API that internally calls the trivy binary. Equivalent to: trivy fs --format json --scanners vuln <path>
Note: This implementation uses exec.Command instead of direct Go API integration to avoid pulling Trivy's full scanning dependency tree into every importer. It requires the trivy binary to be installed and on PATH. The interface remains identical to what a pure Go API would provide.
func ToFinding ¶ added in v0.5.0
func ToFinding(res trivytypes.Result, v trivytypes.DetectedVulnerability, art *security.Artifact, opts FindingSpecOptions) findingspec.Finding
ToFinding converts a single Trivy DetectedVulnerability (within its Result and report artifact context) into a findingspec.Finding. A non-nil art marks the finding as a container scan (type "container"); nil means an SCA scan.
Types ¶
type FindingSpecOptions ¶ added in v0.5.0
type FindingSpecOptions struct {
// Repo sets Location.Repo for multi-repo/workspace sweeps, optional.
Repo string
}
FindingSpecOptions configures conversion of Trivy output to findingspec.
type Report ¶
Report is an extended struct for `github.com/aquasecurity/trivy/pkg/types.Report`.
func (*Report) ByLibraryHistogramSets ¶ added in v0.3.0
func (r *Report) ByLibraryHistogramSets() (*histogram.HistogramSets, error)
func (*Report) BySeverityHistogramSet ¶ added in v0.4.0
func (r *Report) BySeverityHistogramSet() (*histogram.HistogramSet, error)
func (*Report) ByYearHistogramSets ¶ added in v0.4.0
func (r *Report) ByYearHistogramSets() (*histogram.HistogramSets, error)
func (*Report) Findings ¶ added in v0.5.0
func (r *Report) Findings(opts FindingSpecOptions) *findingspec.FindingSet
Findings converts the Trivy report into a findingspec.FindingSet of normalized security vulnerability findings.
func (*Report) ResultsCount ¶
func (*Report) SeverityCounts ¶
SeverityCounts returns the number of vulnerabiltiies detected by severity.
func (*Report) VulnerabiliesTable ¶
VulnerabiliesTable returns a table of vulnerabilities with a column for result set. It is formatted with Markdown links which can be rendered in XLSX using `github.com/grokify/gocharts/data/table`.
