Documentation
¶
Overview ¶
Package database provides SQLite storage for scan history and vulnerability trends.
Index ¶
- func GenerateScanID() string
- func MarshalSummary(summary interface{}) string
- type DB
- func (db *DB) Close() error
- func (db *DB) DiffScans(orgID, projectPath string) (*ScanDiff, error)
- func (db *DB) GetScan(id string) (*Scan, error)
- func (db *DB) GetTrends(orgID, projectPath string, days int) ([]*TrendPoint, error)
- func (db *DB) GetVulnerabilitiesForScan(scanID string) ([]*ScanVuln, error)
- func (db *DB) ListScans(orgID, projectPath string, limit int) ([]*Scan, error)
- func (db *DB) SaveScan(scan *Scan) error
- func (db *DB) SaveVulnerability(scanID, cveID, pkg, status, severity string) error
- type Scan
- type ScanDiff
- type ScanVuln
- type TrendPoint
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarshalSummary ¶
func MarshalSummary(summary interface{}) string
MarshalSummary converts a summary to JSON string
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB wraps the SQLite database connection
func (*DB) GetTrends ¶
func (db *DB) GetTrends(orgID, projectPath string, days int) ([]*TrendPoint, error)
GetTrends returns vulnerability trends for the last N days, filtered by org
func (*DB) GetVulnerabilitiesForScan ¶
GetVulnerabilitiesForScan returns all vulnerabilities for a given scan
func (*DB) ListScans ¶
ListScans returns all scans for a project, filtered by org and ordered by timestamp desc
func (*DB) SaveVulnerability ¶
SaveVulnerability saves a vulnerability for a scan
type Scan ¶
type Scan struct {
ID string `json:"id"`
OrgID string `json:"org_id"` // Tenant isolation
ProjectPath string `json:"project_path"`
Timestamp time.Time `json:"timestamp"`
TotalVulns int `json:"total_vulns"`
Reachable int `json:"reachable"`
Unreachable int `json:"unreachable"`
SummaryJSON string `json:"summary_json,omitempty"`
}
Scan represents a stored analysis scan
type ScanDiff ¶
type ScanDiff struct {
CurrentScanID string `json:"current_scan_id"`
PreviousScanID string `json:"previous_scan_id"`
NewVulns []*ScanVuln `json:"new"`
FixedVulns []*ScanVuln `json:"fixed"`
CurrentTotal int `json:"current_total"`
PreviousTotal int `json:"previous_total"`
RiskDelta string `json:"risk_delta"`
}
ScanDiff represents the difference between two scans
Click to show internal directories.
Click to hide internal directories.