Documentation
¶
Overview ¶
Package scanner implements CVE and malware scanners.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClamAVScanner ¶
type ClamAVScanner struct {
// contains filtered or unexported fields
}
ClamAVScanner is a clamd client that scans files via the INSTREAM command. It implements gate.AVScanner.
func NewClamAVScanner ¶
func NewClamAVScanner(address string, timeout time.Duration) (*ClamAVScanner, error)
NewClamAVScanner creates a scanner for the given clamd address. address is "unix:///var/run/clamav/clamd.sock" or "tcp:host:3310".
type ICAPScanner ¶
type ICAPScanner struct {
// contains filtered or unexported fields
}
ICAPScanner scans files via the ICAP RESPMOD method. It works with any ICAP AV server (Kaspersky, Dr.Web, ClamAV behind c-icap). Implements gate.AVScanner.
func NewICAPScanner ¶
func NewICAPScanner(address, service string, timeout time.Duration) (*ICAPScanner, error)
NewICAPScanner creates a scanner for an ICAP server at address with the given service name. address is "unix:///path" or "tcp:host:port".
type LimitedScanner ¶
type LimitedScanner struct {
// contains filtered or unexported fields
}
LimitedScanner caps the number of concurrent scans run against the wrapped engine. It exists to apply backpressure: clamd (and ICAP servers) have a bounded worker pool, so firing more concurrent INSTREAM/RESPMOD requests than the engine can serve makes responses queue past the per-scan deadline and surface as "i/o timeout". Bounding in-flight scans keeps each one fast enough to beat its deadline. It implements gate.AVScanner.
type MultiScanner ¶
type MultiScanner struct {
// contains filtered or unexported fields
}
MultiScanner runs several AV engines sequentially in order. It implements gate.AVScanner. It short-circuits on the first detection or first error (fail-closed): any engine reporting malware or failing blocks the artifact.
func NewMultiScanner ¶
func NewMultiScanner(scanners ...gate.AVScanner) *MultiScanner
NewMultiScanner wraps the given scanners. They run in the order supplied.
type OSVScanner ¶
type OSVScanner struct {
// contains filtered or unexported fields
}
OSVScanner queries api.osv.dev for known vulnerabilities. It implements gate.CVEScanner and caches results in memory.
func NewOSVScanner ¶
func NewOSVScanner(baseURL string, ttl time.Duration) *OSVScanner
NewOSVScanner creates an OSVScanner with the given base URL and cache TTL. baseURL should be "https://api.osv.dev" (or a mock server URL in tests).
func (*OSVScanner) Close ¶
func (s *OSVScanner) Close() error
Close stops the janitor goroutine and waits for it to exit. Safe to call more than once.
func (*OSVScanner) Health ¶
func (s *OSVScanner) Health() health.Sample
Health reports the result of the last live query as a passive health sample. Before any live query runs, HasData is false (status unknown). Cache hits do not update it.
func (*OSVScanner) Scan ¶
func (s *OSVScanner) Scan(ctx context.Context, ref *gate.PackageRef) (*gate.ScanResult, error)
Scan implements gate.CVEScanner.