quay

package
v1.4.0-rc4 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 23 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package quay provides a client for the Quay Security API, which exposes Clair vulnerability scan results for images hosted on a Quay instance.

Index

Constants

This section is empty.

Variables

View Source
var ErrQuayAuth = errors.New("quay authentication failed: verify OAuth2 Application Token")

ErrQuayAuth is returned when Quay rejects the configured token (HTTP 401). It is terminal: the scanner aborts the whole scan rather than skipping the image, because every subsequent request would fail the same way.

Functions

func NewScanner

NewScanner returns a Quay-backed Scanner. It returns (nil, nil) when cfg is nil so callers can treat a missing Quay configuration as "no scanner". Unlike Trustify, the Quay client needs no request context to construct (bearer-token auth, no OIDC discovery), so it is built eagerly here.

Types

type CVSS

type CVSS struct {
	Vectors string  `json:"Vectors,omitempty"`
	Score   float64 `json:"Score,omitempty"`
}

CVSS is a single CVSS scoring entry.

func (*CVSS) UnmarshalJSON

func (c *CVSS) UnmarshalJSON(data []byte) error

UnmarshalJSON accepts both the numeric and string representations returned by different versions of the Quay Security API for CVSS scores.

type Client

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

Client fetches vulnerability reports from a single Quay instance's Security API.

func NewClient

func NewClient(cfg *config.QuayConfig, log logrus.FieldLogger, httpClient *http.Client) (*Client, error)

NewClient builds a Quay Security API client from the Quay backend config. It returns (nil, nil) when cfg is nil, so a caller can treat an absent Quay configuration as a disabled backend. It returns an error when the configured endpoint has no parseable host or is not HTTPS. The httpClient parameter allows injection of custom TLS config (e.g., custom CA, InsecureSkipVerify); when nil, a default client with a 30s timeout is used.

func (*Client) FetchImageSecurity

func (c *Client) FetchImageSecurity(ctx context.Context, image vulnerability.ImageRef) (*Response, error)

FetchImageSecurity retrieves the Quay Security report for one deployed image.

It returns a scanned report when the image is hosted on the configured registry and Quay reports status "scanned". It returns nil when the image is skipped for a documented reason (missing reference, non-matching registry, non-"scanned" status, 404, 403). It returns ErrQuayAuth on HTTP 401 and a wrapped error on any genuine failure to reach Quay (after retries) or decode a successful response.

type Data

type Data struct {
	Layer *Layer `json:"Layer,omitempty"`
}

Data wraps the scanned layer of a manifest.

type Feature

type Feature struct {
	Name            string          `json:"Name,omitempty"`
	VersionFormat   string          `json:"VersionFormat,omitempty"`
	NamespaceName   string          `json:"NamespaceName,omitempty"`
	AddedBy         string          `json:"AddedBy,omitempty"`
	Version         string          `json:"Version,omitempty"`
	Vulnerabilities []Vulnerability `json:"Vulnerabilities,omitempty"`
}

Feature is an installed package and the vulnerabilities affecting it.

type Layer

type Layer struct {
	Name             string    `json:"Name,omitempty"`
	ParentName       string    `json:"ParentName,omitempty"`
	NamespaceName    string    `json:"NamespaceName,omitempty"`
	IndexedByVersion int       `json:"IndexedByVersion,omitempty"`
	Features         []Feature `json:"Features,omitempty"`
}

Layer holds the features (installed packages) detected in a scanned image.

type Metadata

type Metadata struct {
	NVD NVD `json:"NVD,omitempty"`
}

Metadata carries the NVD enrichment Quay attaches to a vulnerability.

type NVD

type NVD struct {
	CVSSv3 CVSS `json:"CVSSv3,omitempty"`
	CVSSv2 CVSS `json:"CVSSv2,omitempty"`
}

NVD holds the CVSS scores from the National Vulnerability Database.

type Response

type Response struct {
	Status string `json:"status"`
	Data   *Data  `json:"data,omitempty"`
}

Response is the top-level payload returned by the Quay Security API (GET /api/v1/repository/{namespace}/{repo}/manifest/{digest}/security). Status reports the scan state; only "scanned" carries vulnerability data.

type Vulnerability

type Vulnerability struct {
	Name          string   `json:"Name,omitempty"`
	NamespaceName string   `json:"NamespaceName,omitempty"`
	Description   string   `json:"Description,omitempty"`
	Link          string   `json:"Link,omitempty"`
	Severity      string   `json:"Severity,omitempty"`
	FixedBy       string   `json:"FixedBy,omitempty"`
	Metadata      Metadata `json:"Metadata,omitempty"`
}

Vulnerability describes a single vulnerability reported against a Feature.

Jump to

Keyboard shortcuts

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