Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateAnalysis ¶
func GenerateAnalysis(t *testing.T) (match.Matches, []pkg.Package, pkg.Context, vulnerability.MetadataProvider, interface{})
Types ¶
type Document ¶
type Document struct { Matches []Match `json:"matches"` Source *source `json:"source"` Distro distribution `json:"distro"` Descriptor descriptor `json:"descriptor"` }
Document represents the JSON document to be presented
func NewDocument ¶
func NewDocument(packages []pkg.Package, context pkg.Context, matches match.Matches, metadataProvider vulnerability.MetadataProvider, appConfig interface{}) (Document, error)
NewDocument creates and populates a new Document struct, representing the populated JSON document.
type Match ¶
type Match struct { Vulnerability Vulnerability `json:"vulnerability"` MatchDetails MatchDetails `json:"matchDetails"` Artifact Package `json:"artifact"` }
Match is a single item for the JSON array reported
type MatchDetails ¶
type MatchDetails struct { Matcher string `json:"matcher"` SearchKey map[string]interface{} `json:"searchKey"` MatchInfo map[string]interface{} `json:"matchedOn"` }
MatchDetails contains all data that indicates how the result match was found
type MetadataMock ¶
type MetadataMock struct {
// contains filtered or unexported fields
}
MetadataMock provides the behavior required for a vulnerability.MetadataProvider for the purpose of testing.
func NewMetadataMock ¶
func NewMetadataMock() *MetadataMock
NewMetadataMock returns a new instance of MetadataMock.
func (*MetadataMock) GetMetadata ¶
func (m *MetadataMock) GetMetadata(id, recordSource string) (*vulnerability.Metadata, error)
GetMetadata returns vulnerability metadata for a given id and recordSource.
type Package ¶
type Package struct { Name string `json:"name"` Version string `json:"version"` Type syftPkg.Type `json:"type"` Locations []syftSource.Location `json:"locations"` Language syftPkg.Language `json:"language"` Licenses []string `json:"licenses"` CPEs []string `json:"cpes"` PURL string `json:"purl"` }
Package is meant to be only the fields that are needed when displaying a single pkg.Package object for the JSON presenter.
type Vulnerability ¶
type Vulnerability struct { ID string `json:"id"` Severity string `json:"severity,omitempty"` Links []string `json:"links,omitempty"` Description string `json:"description,omitempty"` CvssV2 *Cvss `json:"cvssV2,omitempty"` CvssV3 *Cvss `json:"cvssV3,omitempty"` FixedInVersion string `json:"fixedInVersion,omitempty"` }
func NewVulnerability ¶
func NewVulnerability(m match.Match, metadata *vulnerability.Metadata) Vulnerability
Click to show internal directories.
Click to hide internal directories.