harbor

package
v0.31.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SupportedSBOMMediaTypes = []api.MediaType{
	api.MediaTypeSPDX,
	api.MediaTypeCycloneDX,
}

Functions

This section is empty.

Types

type Artifact

type Artifact struct {
	Repository string `json:"repository"`
	Digest     string `json:"digest"`
	MimeType   string `json:"mime_type,omitempty"`
}

type CVSSDetails added in v0.17.0

type CVSSDetails struct {
	ScoreV2  *float32 `json:"score_v2,omitempty"`
	ScoreV3  *float32 `json:"score_v3,omitempty"`
	VectorV2 string   `json:"vector_v2"`
	VectorV3 string   `json:"vector_v3"`
}

type Capability

type Capability struct {
	Type              CapabilityType `json:"type"`
	ConsumesMIMETypes []string       `json:"consumes_mime_types"`
	ProducesMIMETypes []api.MIMEType `json:"produces_mime_types"`

	// For /metadata
	AdditionalAttributes *CapabilityAttributes `json:"additional_attributes,omitempty"`

	// For /scan
	Parameters *CapabilityAttributes `json:"parameters,omitempty"`
}

type CapabilityAttributes added in v0.31.0

type CapabilityAttributes struct {
	SBOMMediaTypes []api.MediaType `json:"sbom_media_types,omitempty"`
}

type CapabilityType added in v0.31.0

type CapabilityType string
const (
	CapabilityTypeSBOM          CapabilityType = "sbom"
	CapabilityTypeVulnerability CapabilityType = "vulnerability"
)

type Layer added in v0.9.0

type Layer struct {
	Digest string `json:"digest,omitempty"`
	DiffID string `json:"diff_id,omitempty"`
}

type Registry

type Registry struct {
	URL           string `json:"url"`
	Authorization string `json:"authorization"`
}

type ScanReport

type ScanReport struct {
	GeneratedAt time.Time `json:"generated_at"`
	Artifact    Artifact  `json:"artifact"`
	Scanner     Scanner   `json:"scanner"`
	Severity    Severity  `json:"severity,omitempty"`

	// For SBOM
	MediaType api.MediaType `json:"media_type,omitempty"`
	SBOM      any           `json:"sbom,omitempty"`

	// For vulnerabilities
	Vulnerabilities []VulnerabilityItem `json:"vulnerabilities,omitempty"`
}

type ScanReportQuery added in v0.31.0

type ScanReportQuery struct {
	SBOMMediaType api.MediaType `schema:"sbom_media_type"`
}

ScanReportQuery is a struct for the query parameters at "/scan/{scan_request_id}/report".

type ScanRequest

type ScanRequest struct {
	Registry     Registry     `json:"registry"`
	Artifact     Artifact     `json:"artifact"`
	Capabilities []Capability `json:"enabled_capabilities"`
}

func (ScanRequest) GetImageRef

func (c ScanRequest) GetImageRef() (imageRef string, nonSSL bool, err error)

GetImageRef returns Docker image reference for this ScanRequest. Example: core.harbor.domain/scanners/mysql@sha256:3b00a364fb74246ca119d16111eb62f7302b2ff66d51e373c2bb209f8a1f3b9e

type ScanResponse

type ScanResponse struct {
	ID string `json:"id"`
}

type Scanner

type Scanner struct {
	Name    string `json:"name"`
	Vendor  string `json:"vendor"`
	Version string `json:"version"`
}

func GetScannerMetadata added in v0.31.0

func GetScannerMetadata() Scanner

type ScannerAdapterMetadata

type ScannerAdapterMetadata struct {
	Scanner      Scanner           `json:"scanner"`
	Capabilities []Capability      `json:"capabilities"`
	Properties   map[string]string `json:"properties"`
}

type Severity

type Severity int64

Severity represents the severity of a image/component in terms of vulnerability.

const (
	SevUnknown Severity
	SevLow
	SevMedium
	SevHigh
	SevCritical
)

Sevxxx is the list of severity of image after scanning.

func (Severity) MarshalJSON

func (s Severity) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Severity enum value as a quoted JSON string.

func (Severity) String

func (s Severity) String() string

func (*Severity) UnmarshalJSON

func (s *Severity) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals quoted JSON string to the Severity enum value.

type VulnerabilityItem

type VulnerabilityItem struct {
	ID               string         `json:"id"`
	Pkg              string         `json:"package"`
	Version          string         `json:"version"`
	FixVersion       string         `json:"fix_version,omitempty"`
	Severity         Severity       `json:"severity"`
	Description      string         `json:"description"`
	Links            []string       `json:"links"`
	Layer            *Layer         `json:"layer"` // Not defined by Scanners API
	PreferredCVSS    *CVSSDetails   `json:"preferred_cvss,omitempty"`
	CweIDs           []string       `json:"cwe_ids,omitempty"`
	VendorAttributes map[string]any `json:"vendor_attributes,omitempty"`
}

VulnerabilityItem is an item in the vulnerability result returned by vulnerability details API.

Jump to

Keyboard shortcuts

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