Documentation
¶
Index ¶
Constants ¶
const ( FindingStatusOpen = "OPEN" FindingStatusFixed = "FIXED" FindingStatusNew = "NEW" FindingStatusInvalidated = "INVALIDATED" FindingDefaultFingerprint = "NOT_PROVIDED" )
Variables ¶
This section is empty.
Functions ¶
func IsDuplicateErr ¶
IsDuplicateErr determines if given error is a duplicate element error.
func IsNotFoundErr ¶
IsNotFoundErr determines if given error is a record not found error.
Types ¶
type Finding ¶
type Finding struct {
ID string
IssueID string `db:"issue_id"`
TargetID string `db:"target_id"`
AffectedResource string `db:"affected_resource"`
AffectedResourceString string `db:"affected_resource_string"`
Fingerprint string `db:"fingerprint"`
Score float64
Status string
Details string
ImpactDetails string `db:"impact_details"`
// Resources contains the vulnerability resources tables mashalled into a
// json.
Resources *[]byte
Exposure uint32
}
Finding represents the finding of a vulnerability in a target.
type FindingEvent ¶
type FindingEvent struct {
ID string `db:"id"`
FindingID string `db:"finding_id"`
SourceID string `db:"source_id"`
Score float64 `db:"score"`
Details *string `db:"details"`
Fingerprint string `db:"fingerprint"`
AffectedResourceString *string `db:"affected_resource_string"`
// Resources contains the vulnerability resources tables mashalled into a
// json.
Resources *[]byte `db:"resources"`
Time time.Time `db:"time"`
}
FindingEvent is an event related to a finding which can indicate the finding has been found or it has been fixed.
type FindingExposure ¶
type FindingExposure struct {
FindingID string `db:"finding_id"`
FoundAT time.Time `db:"found_at"`
FixedAT *time.Time `db:"fixed_at"`
TTR *int `db:"fixed_at"`
}
FindingExposure represents a period of time in which a finding has been continuosly detected.
type Issue ¶
type Issue struct {
ID string
Summary string
CWEID uint32 `db:"cwe_id"`
Description string
Recommendations pq.StringArray
ReferenceLinks pq.StringArray `db:"reference_links"`
}
Issue represents a security vulnerability.
type SourceFamilies ¶
type SourceFamilies []SourceFamily
SourceFamilies represents a slice of SourceFamily elements.
func (SourceFamilies) Sort ¶
func (sff SourceFamilies) Sort()
Sort sorts families alphabetically by Name and Component.
type SourceFamily ¶
SourceFamily represents the set of sources with same name, component and target.
type SourceFinding ¶
type SourceFinding struct {
IssueID string `db:"issue_id"`
Score float32 `db:"score"`
Details string
ImpactDetails string `db:"impact_details"`
AffectedResource string `db:"affected_resource"`
AffectedResourceString string `db:"affected_resource_string"`
Fingerprint string `db:"fingerprint"`
Resources *[]byte
}
SourceFinding represents a finding found by a source in a target with a given score for that target.
type VulnStore ¶
type VulnStore interface {
// Targets
CreateTarget(t Target) (*Target, error)
FindTarget(t Target) (*Target, error)
// Sources
CreateSource(s Source) (*Source, error)
CreateSourceIfNotExists(s Source) (*Source, error)
FindSource(s Source) (*Source, error)
SourceFamilies() (SourceFamilies, error)
ProcessSourceExecution(s Source, finding []SourceFinding) (Source, error)
// Issues
CreateIssue(i Issue) (*Issue, error)
CreateIssueIfNotExists(i Issue) (*Issue, error)
UpdateIssueLabels(issueID string, labels []string) error
FindIssue(i Issue) (*Issue, error)
GetIssuesBySource(sourceID string) ([]*Issue, error)
// Findings
CreateFinding(eventTime time.Time, f Finding, sourceID string) (*Finding, error)
FindFinding(f Finding) (*Finding, error)
GetLastFindingEvent(findingID string) (*FindingEvent, error)
CreateFindingEvent(eventTime time.Time, findingID, sourceID string, score float64, fingerprint, affectedResourceString string) (*Finding, error)
GetOpenSourceFindings(id string) ([]SourceFinding, error)
RecalculateFindingsStatus(s SourceFamily) error
FindIssueByID(id string) (*Issue, error)
ExpireFindings(source string, ttl int) (int64, error)
PurgeOrphanTargets(batchSize int) (int64, error)
}
VulnStore specifies the methods available for the vulnerability database adapter.