vulnscan

package
v0.4.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 8, 2026 License: GPL-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScanStatusPending   = "pending"
	ScanStatusRunning   = "running"
	ScanStatusCompleted = "completed"
	ScanStatusFailed    = "failed"
)
View Source
const (
	ImageStatusPending   = "pending"
	ImageStatusScanning  = "scanning"
	ImageStatusCompleted = "completed"
	ImageStatusFailed    = "failed"
	ImageStatusTimeout   = "timeout"
)
View Source
const (
	SeverityCritical   = "Critical"
	SeverityHigh       = "High"
	SeverityMedium     = "Medium"
	SeverityLow        = "Low"
	SeverityNegligible = "Negligible"
	SeverityUnknown    = "Unknown"
)

Variables

Functions

This section is empty.

Types

type GetScanResponse

type GetScanResponse struct {
	ID            string        `json:"id"`
	StackName     string        `json:"stack_name"`
	Status        string        `json:"status"`
	TotalImages   int           `json:"total_images"`
	ScannedImages int           `json:"scanned_images"`
	StartedAt     time.Time     `json:"started_at"`
	CompletedAt   *time.Time    `json:"completed_at,omitempty"`
	Error         string        `json:"error,omitempty"`
	Results       []ImageResult `json:"results,omitempty"`
}

type GrypeArtifact

type GrypeArtifact struct {
	ID        string          `json:"id,omitempty"`
	Name      string          `json:"name"`
	Version   string          `json:"version"`
	Type      string          `json:"type,omitempty"`
	Locations []GrypeLocation `json:"locations,omitempty"`
	Language  string          `json:"language,omitempty"`
	Licenses  []string        `json:"licenses,omitempty"`
	CPEs      []string        `json:"cpes,omitempty"`
	PURL      string          `json:"purl,omitempty"`
}

type GrypeCVSS

type GrypeCVSS struct {
	Source  string           `json:"source,omitempty"`
	Type    string           `json:"type,omitempty"`
	Version string           `json:"version,omitempty"`
	Vector  string           `json:"vector,omitempty"`
	Metrics GrypeCVSSMetrics `json:"metrics"`
}

type GrypeCVSSMetrics

type GrypeCVSSMetrics struct {
	BaseScore           float64 `json:"baseScore"`
	ExploitabilityScore float64 `json:"exploitabilityScore,omitempty"`
	ImpactScore         float64 `json:"impactScore,omitempty"`
}

type GrypeDescriptor

type GrypeDescriptor struct {
	Name    string `json:"name,omitempty"`
	Version string `json:"version,omitempty"`
}

type GrypeDistro

type GrypeDistro struct {
	Name    string   `json:"name,omitempty"`
	Version string   `json:"version,omitempty"`
	IDLike  []string `json:"idLike,omitempty"`
}

type GrypeFix

type GrypeFix struct {
	Versions []string `json:"versions,omitempty"`
	State    string   `json:"state,omitempty"`
}

type GrypeLocation

type GrypeLocation struct {
	Path    string `json:"path,omitempty"`
	LayerID string `json:"layerId,omitempty"`
}

type GrypeMatch

type GrypeMatch struct {
	Vulnerability          GrypeVulnerability   `json:"vulnerability"`
	RelatedVulnerabilities []GrypeVulnerability `json:"relatedVulnerabilities,omitempty"`
	MatchDetails           []GrypeMatchDetail   `json:"matchDetails,omitempty"`
	Artifact               GrypeArtifact        `json:"artifact"`
}

type GrypeMatchDetail

type GrypeMatchDetail struct {
	Type    string `json:"type,omitempty"`
	Matcher string `json:"matcher,omitempty"`
}

type GrypeOutput

type GrypeOutput struct {
	Matches    []GrypeMatch    `json:"matches"`
	Source     GrypeSource     `json:"source"`
	Distro     GrypeDistro     `json:"distro"`
	Descriptor GrypeDescriptor `json:"descriptor"`
}

type GrypeScannerClient

type GrypeScannerClient struct {
	// contains filtered or unexported fields
}

func NewGrypeScannerClient

func NewGrypeScannerClient(baseURL, token string, logger *logging.Logger) *GrypeScannerClient

func (*GrypeScannerClient) IsAvailable

func (c *GrypeScannerClient) IsAvailable(ctx context.Context) bool

func (*GrypeScannerClient) ScanImage

func (c *GrypeScannerClient) ScanImage(ctx context.Context, imageName string) ([]Vulnerability, error)

type GrypeSource

type GrypeSource struct {
	Type   string `json:"type,omitempty"`
	Target any    `json:"target,omitempty"`
}

type GrypeVulnerability

type GrypeVulnerability struct {
	ID          string      `json:"id"`
	DataSource  string      `json:"dataSource"`
	Namespace   string      `json:"namespace,omitempty"`
	Severity    string      `json:"severity"`
	URLs        []string    `json:"urls,omitempty"`
	Description string      `json:"description,omitempty"`
	CVSS        []GrypeCVSS `json:"cvss,omitempty"`
	Fix         GrypeFix    `json:"fix"`
}

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(service *Service) *Handler

func (*Handler) GetScan

func (h *Handler) GetScan(c echo.Context) error

func (*Handler) GetScannerStatus

func (h *Handler) GetScannerStatus(c echo.Context) error

func (*Handler) StartScan

func (h *Handler) StartScan(c echo.Context) error

type ImageResult

type ImageResult struct {
	ImageName       string          `json:"image_name"`
	Status          string          `json:"status"`
	Error           string          `json:"error,omitempty"`
	Vulnerabilities []Vulnerability `json:"vulnerabilities,omitempty"`
	ScannedAt       time.Time       `json:"scanned_at"`
}

type Scan

type Scan struct {
	ID            string        `json:"id"`
	StackName     string        `json:"stack_name"`
	Status        string        `json:"status"`
	Images        []string      `json:"images"`
	TotalImages   int           `json:"total_images"`
	ScannedImages int           `json:"scanned_images"`
	StartedAt     time.Time     `json:"started_at"`
	CompletedAt   *time.Time    `json:"completed_at,omitempty"`
	Error         string        `json:"error,omitempty"`
	Results       []ImageResult `json:"results,omitempty"`
}

type ScanPersistence

type ScanPersistence struct {
	// contains filtered or unexported fields
}

func NewScanPersistence

func NewScanPersistence(persistenceDir string, logger *logging.Logger) (*ScanPersistence, error)

func (*ScanPersistence) DeleteScan

func (p *ScanPersistence) DeleteScan(scanID string) error

func (*ScanPersistence) LoadAllScans

func (p *ScanPersistence) LoadAllScans() ([]*Scan, error)

func (*ScanPersistence) LoadScan

func (p *ScanPersistence) LoadScan(scanID string) (*Scan, error)

func (*ScanPersistence) PersistScan

func (p *ScanPersistence) PersistScan(scan *Scan) error

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(cfg ServiceConfig, logger *logging.Logger) (*Service, error)

func NewServiceFromConfig

func NewServiceFromConfig(cfg *config.Config, logger *logging.Logger) (*Service, error)

func (*Service) GetScan

func (s *Service) GetScan(scanID string) (*Scan, bool)

func (*Service) IsAvailable

func (s *Service) IsAvailable() bool

func (*Service) StartScan

func (s *Service) StartScan(ctx context.Context, stackName string, serviceFilter []string) (*Scan, error)

type ServiceConfig

type ServiceConfig struct {
	StackLocation     string
	PersistenceDir    string
	PerImageTimeout   time.Duration
	TotalTimeout      time.Duration
	GrypeScannerURL   string
	GrypeScannerToken string
}

type Vulnerability

type Vulnerability struct {
	ID               string          `json:"id"`
	Severity         string          `json:"severity"`
	Package          string          `json:"package"`
	InstalledVersion string          `json:"installed_version"`
	FixedVersion     string          `json:"fixed_version,omitempty"`
	Description      string          `json:"description,omitempty"`
	DataSource       string          `json:"data_source,omitempty"`
	CVSS             float64         `json:"cvss,omitempty"`
	Location         string          `json:"location,omitempty"`
	LayerID          string          `json:"layer_id,omitempty"`
	RawMatch         json.RawMessage `json:"raw_match,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL