json

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 8, 2020 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cvss

type Cvss struct {
	BaseScore           float64  `json:"baseScore"`
	ExploitabilityScore *float64 `json:"exploitabilityScore,omitempty"`
	ImpactScore         *float64 `json:"impactScore,omitempty"`
	Vector              string   `json:"vector"`
}

type Descriptor added in v0.5.0

type Descriptor struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

Descriptor describes what created the document as well as surrounding metadata

type Document

type Document struct {
	Matches    []Match               `json:"matches"`
	Source     syftJson.Source       `json:"source"`
	Distro     syftJson.Distribution `json:"distro"`
	Descriptor Descriptor            `json:"descriptor"`
}

Document represents the JSON document to be presented

func NewDocument

func NewDocument(catalog *pkg.Catalog, d *distro.Distro, srcMetadata source.Metadata, matches match.Matches, metadataProvider vulnerability.MetadataProvider) (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      syftJson.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 Presenter

type Presenter struct {
	// contains filtered or unexported fields
}

Presenter is a generic struct for holding fields needed for reporting

func NewPresenter

func NewPresenter(matches match.Matches, catalog *pkg.Catalog, d *distro.Distro, srcMetadata source.Metadata, metadataProvider vulnerability.MetadataProvider) *Presenter

NewPresenter is a *Presenter constructor

func (*Presenter) Present

func (pres *Presenter) Present(output io.Writer) error

Present creates a JSON-based reporting

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL