query

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasUniqueExposureSeverityScore added in v0.5.6

func HasUniqueExposureSeverityScore(list []*ExposureResult) bool

HasUniqueExposureSeverityScore returns true if the image has unique exposures.

Types

type DigestSummaryResult

type DigestSummaryResult struct {
	// Exposures is the number of exposures for that image digest.
	Exposures int `json:"exposures"`

	// Sources is the number of sources for that image digest.
	Sources int `json:"sources"`

	// Packages is the number of packages for that image digest.
	Packages int `json:"packages"`

	// HighScore is the highest score for that image digest.
	HighScore float32 `json:"high_score"`

	// First is the first time the image was discovered.
	First time.Time `json:"first_discovered"`

	// Last is the last time the image was discovered.
	Last time.Time `json:"last_discovered"`
}

type ExposureResult

type ExposureResult struct {
	// Source is the source of the vulnerability.
	Source string `json:"source"`

	// Severity is the vulnerability severity.
	Severity string `json:"severity,omitempty"`

	// Score is the vulnerability score.
	Score float32 `json:"score,omitempty"`

	// Last is the last time the image was discovered.
	Last time.Time `json:"last_discovered"`
}

func (*ExposureResult) GetSeverityScoreHash added in v0.5.6

func (e *ExposureResult) GetSeverityScoreHash() string

type ImageExposureResult

type ImageExposureResult struct {
	// Image is the image result.
	Image string `json:"image"`

	// Digest is the image digest.
	Digest string `json:"digest"`

	// Exposures is the list of exposures.
	Exposures map[string][]*ExposureResult `json:"exposures"`
}

type ImageResult

type ImageResult struct {
	// Versions represents the different versions of the image.
	Versions map[string]*DigestSummaryResult `json:"versions"`
}

type Options

type Options struct {
	// Image is the URI of the image from which the report was generated.
	Image string

	// Digest is the sha:256 digest of the image.
	Digest string

	// Exposure is the CVE ID to query.
	Exposure string

	// Target is the target data store uri.
	Target string

	// DiffsOnly indicates if only diffs should be returned.
	DiffsOnly bool
}

Options represents the input options.

func (*Options) GetQuery

func (o *Options) GetQuery() (Query, error)

GetTope returns the query type. TODO: this is a bit of a hack, need to refactor

func (*Options) String

func (o *Options) String() string

func (*Options) Validate

func (o *Options) Validate() error

Validate validates the options.

type PackageExposureResult

type PackageExposureResult struct {
	// Image is the image result.
	Image string `json:"image"`

	// Digest is the image digest.
	Digest string `json:"digest"`

	// Exposure is the exposure.
	Exposure string `json:"exposure"`

	// Packages is the list of packages.
	Packages []*PackageResult `json:"packages"`
}

type PackageResult

type PackageResult struct {
	// Source is the source of the vulnerability.
	Source string `json:"source"`

	// Package is the package name.
	Package string `json:"package"`

	// Version is the package version.
	Version string `json:"version"`

	// Severity is the vulnerability severity.
	Severity string `json:"severity,omitempty"`

	// Score is the vulnerability score.
	Score float32 `json:"score,omitempty"`

	// Last is the last time the image was discovered.
	Last time.Time `json:"last_discovered"`
}

type Query

type Query int64

Type represents the query type.

const (
	// TypeImage represents the image query type.
	Undefined Query = iota
	Images
	Digests
	Exposure
	Packages
)

func (Query) String

func (q Query) String() string

String returns the string representation of the query type.

Jump to

Keyboard shortcuts

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