Documentation
¶
Overview ¶
Package store provides SQLite storage for Overseer's vulnerability tracking.
Index ¶
- Constants
- func DefaultDBPath() (string, error)
- type Package
- type Project
- type ProjectSummary
- type Scan
- type Store
- func (s *Store) AddProject(path string) (*Project, error)
- func (s *Store) ClearPackagesForProject(projectID int64) error
- func (s *Store) ClearVulnerabilitiesForPackage(packageID int64) error
- func (s *Store) Close() error
- func (s *Store) CompleteScan(scanID int64, packagesScanned, vulnsFound int) error
- func (s *Store) DismissVulnerability(vulnID int64) error
- func (s *Store) FailScan(scanID int64) error
- func (s *Store) GetLastScan(projectID int64) (*Scan, error)
- func (s *Store) GetOverallSummary() (map[string]int, int, error)
- func (s *Store) GetPackagesByProject(projectID int64) ([]Package, error)
- func (s *Store) GetProject(id int64) (*Project, error)
- func (s *Store) GetProjectByPath(path string) (*Project, error)
- func (s *Store) GetProjectSummary(projectID int64) (*ProjectSummary, error)
- func (s *Store) GetVulnerabilityCount() (int, error)
- func (s *Store) ListProjects() ([]Project, error)
- func (s *Store) ListVulnerabilities(filter VulnFilter) ([]VulnResult, error)
- func (s *Store) Path() string
- func (s *Store) RecordVulnerability(vuln Vulnerability) (*Vulnerability, error)
- func (s *Store) RemoveProject(path string) error
- func (s *Store) StartScan(projectID int64) (*Scan, error)
- func (s *Store) UndismissVulnerability(vulnID int64) error
- func (s *Store) UpdateProjectEcosystem(projectID int64, ecosystem string) error
- func (s *Store) UpdateProjectScanTime(projectID int64) error
- func (s *Store) UpsertPackage(pkg Package) (*Package, error)
- type VulnFilter
- type VulnResult
- type Vulnerability
Constants ¶
const ( ScanStatusRunning = "running" ScanStatusCompleted = "completed" ScanStatusFailed = "failed" )
ScanStatus constants for scan state tracking.
const ( SeverityCritical = "CRITICAL" SeverityHigh = "HIGH" SeverityMedium = "MEDIUM" SeverityLow = "LOW" SeverityUnknown = "UNKNOWN" )
Severity constants for vulnerability classification.
Variables ¶
This section is empty.
Functions ¶
func DefaultDBPath ¶
DefaultDBPath returns the default database path (~/.local/share/ovrse/overseer.db). Uses XDG_DATA_HOME on Linux/macOS, LocalAppData on Windows.
Types ¶
type Package ¶
type Package struct {
ID int64 `json:"id"`
ProjectID int64 `json:"project_id"`
Name string `json:"name"`
Version string `json:"version"`
Ecosystem string `json:"ecosystem"` // npm, go, pip, cargo, etc.
LockFile string `json:"lock_file,omitempty"`
}
Package represents a detected package in a project.
type Project ¶
type Project struct {
ID int64 `json:"id"`
Path string `json:"path"`
Name string `json:"name,omitempty"`
Ecosystem string `json:"ecosystem,omitempty"` // npm, go, pip, etc.
AddedAt time.Time `json:"added_at"`
LastScannedAt *time.Time `json:"last_scanned_at,omitempty"`
}
Project represents a monitored project directory.
type ProjectSummary ¶
type ProjectSummary struct {
Project
TotalPackages int `json:"total_packages"`
TotalVulns int `json:"total_vulns"`
BySeverity map[string]int `json:"by_severity"` // severity -> count
}
ProjectSummary provides a summary of vulnerabilities in a project.
type Scan ¶
type Scan struct {
ID int64 `json:"id"`
ProjectID int64 `json:"project_id"`
StartedAt time.Time `json:"started_at"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
PackagesScanned int `json:"packages_scanned"`
VulnsFound int `json:"vulns_found"`
Status string `json:"status"` // running, completed, failed
}
Scan represents a scan history entry.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store provides SQLite storage for Overseer data.
func New ¶
New creates a new Store with the given database path. If dbPath is empty, uses the default path.
func (*Store) AddProject ¶
AddProject adds a new project to monitor.
func (*Store) ClearPackagesForProject ¶
ClearPackagesForProject removes all packages for a project (before re-scanning).
func (*Store) ClearVulnerabilitiesForPackage ¶
ClearVulnerabilitiesForPackage removes all vulnerabilities for a package.
func (*Store) CompleteScan ¶
CompleteScan marks a scan as completed.
func (*Store) DismissVulnerability ¶
DismissVulnerability marks a vulnerability as dismissed.
func (*Store) GetLastScan ¶
GetLastScan returns the most recent scan for a project.
func (*Store) GetOverallSummary ¶
GetOverallSummary returns vulnerability summary across all projects.
func (*Store) GetPackagesByProject ¶
GetPackagesByProject returns all packages for a project.
func (*Store) GetProject ¶
GetProject retrieves a project by ID.
func (*Store) GetProjectByPath ¶
GetProjectByPath retrieves a project by its path.
func (*Store) GetProjectSummary ¶
func (s *Store) GetProjectSummary(projectID int64) (*ProjectSummary, error)
GetProjectSummary returns vulnerability summary for a project.
func (*Store) GetVulnerabilityCount ¶
GetVulnerabilityCount returns the total count of active vulnerabilities.
func (*Store) ListProjects ¶
ListProjects returns all monitored projects.
func (*Store) ListVulnerabilities ¶
func (s *Store) ListVulnerabilities(filter VulnFilter) ([]VulnResult, error)
ListVulnerabilities returns vulnerabilities matching the filter.
func (*Store) RecordVulnerability ¶
func (s *Store) RecordVulnerability(vuln Vulnerability) (*Vulnerability, error)
RecordVulnerability records a vulnerability for a package.
func (*Store) RemoveProject ¶
RemoveProject removes a project and all its data.
func (*Store) UndismissVulnerability ¶
UndismissVulnerability removes the dismissed status from a vulnerability.
func (*Store) UpdateProjectEcosystem ¶
UpdateProjectEcosystem updates the ecosystem for a project.
func (*Store) UpdateProjectScanTime ¶
UpdateProjectScanTime updates the last scanned timestamp for a project.
type VulnFilter ¶
type VulnFilter struct {
ProjectID *int64 // Filter by specific project
ProjectPath string // Filter by project path
Severity []string // Filter by severity levels
CVEID string // Filter by specific CVE
Dismissed *bool // Filter dismissed status (nil = all, true = dismissed only, false = active only)
Limit int // Max results (0 = unlimited)
}
VulnFilter provides filtering options for vulnerability queries.
type VulnResult ¶
type VulnResult struct {
Vulnerability
PackageName string `json:"package_name"`
PackageVersion string `json:"package_version"`
PackageEco string `json:"package_ecosystem"`
ProjectPath string `json:"project_path"`
ProjectName string `json:"project_name,omitempty"`
}
VulnResult represents a vulnerability with its associated package and project info.
type Vulnerability ¶
type Vulnerability struct {
ID int64 `json:"id"`
PackageID int64 `json:"package_id"`
CVEID string `json:"cve_id"`
Severity string `json:"severity,omitempty"` // CRITICAL, HIGH, MEDIUM, LOW
CVSSScore *float64 `json:"cvss_score,omitempty"` // nil if unknown
Summary string `json:"summary,omitempty"`
FixVersion string `json:"fix_version,omitempty"`
DetectedAt time.Time `json:"detected_at"`
DismissedAt *time.Time `json:"dismissed_at,omitempty"`
}
Vulnerability represents a detected vulnerability in a package.