Documentation
¶
Overview ¶
Package scanner provides interfaces and types for security scanning
Package scanner provides Trivy-specific scanner implementation
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckTrivyInstalled ¶
func CheckTrivyInstalled() error
CheckTrivyInstalled checks if trivy CLI is available
func ParseTrivyResults ¶
func ParseTrivyResults(filePath string) ([]types.Vulnerability, error)
ParseTrivyResults parses trivy scan results from a JSON file and returns Go package vulnerabilities
Types ¶
type ScanResult ¶
type ScanResult struct {
// Vulnerabilities is the list of vulnerabilities found
Vulnerabilities []types.Vulnerability `json:"vulnerabilities"`
// ScannerName is the name of the scanner that produced this result
ScannerName string `json:"scanner_name"`
// ScanPath is the path that was scanned
ScanPath string `json:"scan_path"`
}
ScanResult represents the result of a security scan
type Scanner ¶
type Scanner interface {
// Scan performs the security scan and returns vulnerabilities
Scan() ([]types.Vulnerability, error)
// Cleanup cleans up any temporary resources created during scanning
Cleanup() error
// GetName returns the name of the scanner
GetName() string
}
Scanner is the interface that all security scanners must implement
func NewScanner ¶
func NewScanner(scanPath string, config config.ScannerConfig) (Scanner, error)
NewScanner creates a new scanner instance based on the provided configuration
type TrivyScanner ¶
type TrivyScanner struct {
// contains filtered or unexported fields
}
TrivyScanner implements the Scanner interface for Trivy security scanner
func NewTrivyScanner ¶
func NewTrivyScanner(scanPath string, config config.ScannerConfig) *TrivyScanner
NewTrivyScanner creates a new Trivy scanner instance
func (*TrivyScanner) Cleanup ¶
func (t *TrivyScanner) Cleanup() error
Cleanup removes the temporary directory and all its contents
func (*TrivyScanner) GetName ¶
func (t *TrivyScanner) GetName() string
GetName returns the name of the scanner
func (*TrivyScanner) Scan ¶
func (t *TrivyScanner) Scan() ([]types.Vulnerability, error)
Scan performs the security scan and returns vulnerabilities