image

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package image provides models used in the scan commend

Index

Constants

View Source
const (
	// SeverityCritical is a supported severity.
	SeverityCritical = "CRITICAL"
	// SeverityHigh is a supported severity.
	SeverityHigh = "HIGH"
	// SeverityMedium is a supported severity.
	SeverityMedium = "MEDIUM"
	// SeverityLow is a supported severity.
	SeverityLow = "LOW"
	// SeverityUnknown is a supported severity.
	SeverityUnknown = "UNKNOWN"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CvssItem

type CvssItem struct {
	V2 float32 `json:"v2"`
	V3 float32 `json:"v3"`
}

CvssItem denotes CVSS score.

type Identifier

type Identifier struct {
	FullTag        string   `json:"full_tag"`
	Registry       string   `json:"registry"`
	Repo           string   `json:"repo"`
	Tag            string   `json:"tag"`
	ManifestDigest string   `json:"manifest_digest"`
	RepoDigests    []string `json:"repo_digests"`
}

Identifier is the identifier for an image.

func (*Identifier) Footer

func (i *Identifier) Footer() string

Footer for Identifier will provide the overview link.

type Metadata

type Metadata struct {
	Distro        string `json:"distro"`
	DistroVersion string `json:"distro_version"`
	ImageSize     uint   `json:"image_size"`
	LayerCount    uint   `json:"layer_count"`
}

Metadata is the metadata of the image.

type PolicyViolation

type PolicyViolation struct {
	Policy    string     `json:"policy"`
	Rule      string     `json:"rule"`
	Risk      string     `json:"risk"`
	Violation Violations `json:"violation"`
}

PolicyViolation represent a violation of a policy.

func (PolicyViolation) GetPolicyName

func (p PolicyViolation) GetPolicyName() string

GetPolicyName implements the GetPolicyName method needed for presenting policy table by the presenter.

func (PolicyViolation) GetRisk

func (p PolicyViolation) GetRisk() string

GetRisk implements the GetRisk method needed for presenting policy table by the presenter.

func (PolicyViolation) GetRuleName

func (p PolicyViolation) GetRuleName() string

GetRuleName implements the GetRuleName method needed for presenting policy table by the presenter.

func (PolicyViolation) GetViolation

func (p PolicyViolation) GetViolation() string

GetViolation implements the GetViolation method needed for presenting policy table by the presenter.

type ScannedImage

type ScannedImage struct {
	Identifier       `json:",inline"`
	ImageMetadata    Metadata          `json:"image_metadata"`
	Account          string            `json:"account"`
	ScanStatus       string            `json:"scan_status"`
	Vulnerabilities  []Vulnerability   `json:"vulnerabilities"`
	PolicyViolations []PolicyViolation `json:"policy_violations,omitempty"`
}

ScannedImage response model from image scanning service.

func (*ScannedImage) Header

func (s *ScannedImage) Header() []string

Header is the header columns of the ScannedImage result.

func (*ScannedImage) Rows

func (s *ScannedImage) Rows() [][]string

Rows returns all the vulnerabilities of the ScannedImage result as list of rows.

func (*ScannedImage) Title

func (s *ScannedImage) Title() string

Title is the title of the ScannedImage result.

type ValidatedImage

type ValidatedImage struct {
	Identifier       `json:",inline"`
	PolicyViolations []PolicyViolation `json:"policy_violations"`
}

ValidatedImage response model from guardrails validator service.

func NewValidatedImage

func NewValidatedImage(identifier Identifier, violations []PolicyViolation, opts ValidatedImageOption) *ValidatedImage

NewValidatedImage will initialize a validated image.

func (*ValidatedImage) Header

func (v *ValidatedImage) Header() []string

Header is the header columns of the ValidatedImage result.

func (*ValidatedImage) Rows

func (v *ValidatedImage) Rows() [][]string

Rows returns all the violations of the ValidatedImage result as list of rows.

func (*ValidatedImage) Title

func (v *ValidatedImage) Title() string

Title is the title of the ValidatedImage result.

type ValidatedImageOption

type ValidatedImageOption struct {
	tabletool.Option
}

ValidatedImageOption is the option for showing validated image result.

type Violation

type Violation struct {
	Image           string          `json:"image"`
	Vulnerabilities []Vulnerability `json:"vulnerabilities"`
}

Violation stores violation made by an image.

type Violations

type Violations struct {
	ViolatedImages []Violation `json:"scanned"`
}

Violations represents scanning violations made by images.

type Vulnerability

type Vulnerability struct {
	ID           string   `json:"id"`
	Package      string   `json:"package"`
	Name         string   `json:"package_name"`
	Version      string   `json:"package_version"`
	Type         string   `json:"package_type"`
	Severity     string   `json:"severity"`
	Link         string   `json:"link,omitempty"`
	Description  string   `json:"description,omitempty"`
	FixAvailable string   `json:"fix_available"`
	Cvss         CvssItem `json:"cvss"`
}

Vulnerability denotes the vulnerability items.

func (Vulnerability) GetCvssV2

func (v Vulnerability) GetCvssV2() string

GetCvssV2 return the Cvss.V2 of the vulnerability.

func (Vulnerability) GetCvssV3

func (v Vulnerability) GetCvssV3() string

GetCvssV3 return the Cvss.V3 of the vulnerability.

func (Vulnerability) GetFixAvailable

func (v Vulnerability) GetFixAvailable() string

GetFixAvailable return the FixAvailable of the vulnerability.

func (Vulnerability) GetID

func (v Vulnerability) GetID() string

GetID return the ID of the vulnerability.

func (Vulnerability) GetPackage

func (v Vulnerability) GetPackage() string

GetPackage return the Package of the vulnerability.

func (Vulnerability) GetSeverity

func (v Vulnerability) GetSeverity() string

GetSeverity return the Severity of the vulnerability.

func (Vulnerability) GetType

func (v Vulnerability) GetType() string

GetType return the Type of the vulnerability.

Jump to

Keyboard shortcuts

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