Documentation
¶
Overview ¶
Package scan manages the scan process to image scanning service
Index ¶
- func GenerateLayers(manifestDigest string, tarPath string, configBytes []byte) ([]layers.Layer, error)
- type Bom
- type Handler
- func (h *Handler) AttachData(bom *Bom, layers []layers.Layer, buildStep, namespace string)
- func (h Handler) GetImageAnalysisStatus(digest string) (Status, error)
- func (h Handler) GetImageVulnerability(digest string) (*image.ScannedImage, error)
- func (h Handler) GetResponseFromScanAPI(digest string) (*image.ScannedImage, error)
- func (h Handler) HealthCheck() error
- func (h Handler) PutBomAndLayersToAnalysisAPI(opts Option) (Status, error)
- func (h *Handler) Scan(opts Option) (*image.ScannedImage, error)
- func (h Handler) SendCancelSignal(digest string) error
- type Option
- type RegistryHandler
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Bom ¶
type Bom struct {
// FullTag is the full tag of the bom
FullTag string
// ManifestDigest is the sha256 of this image manifest json
ManifestDigest string
// Packages enumerates the packages in the bill of materials
Packages bom.JSONDocument
}
Bom contains the full bill of materials for an image, along with some additional helpful metadata.
func GenerateSBOMFromInput ¶ added in v1.6.3
GenerateSBOMFromInput create bom struct after coping.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler has all the fields for sending request to scanning service.
func NewScanHandler ¶
func NewScanHandler(saasTmpl, orgKey, apiID, apiKey string, bom *Bom, layers []layers.Layer) *Handler
NewScanHandler will create a handler for scan cmd.
func (*Handler) AttachData ¶ added in v1.6.3
AttachData will attach sbom, layers & policy to the handler.
func (Handler) GetImageAnalysisStatus ¶
GetImageAnalysisStatus will fetch the current analysis result of an image.
func (Handler) GetImageVulnerability ¶
func (h Handler) GetImageVulnerability(digest string) (*image.ScannedImage, error)
GetImageVulnerability will fetch the vulnerability result via image digest.
func (Handler) GetResponseFromScanAPI ¶
func (h Handler) GetResponseFromScanAPI(digest string) (*image.ScannedImage, error)
GetResponseFromScanAPI will call the status API from image scanning service periodically, once the status is "FINISHED", it will fetch the real result from vuln API.
func (Handler) HealthCheck ¶
HealthCheck will check the health of the service backend.
func (Handler) PutBomAndLayersToAnalysisAPI ¶ added in v1.6.3
PutBomAndLayersToAnalysisAPI will call the PUT API and upload sbom to image scanning service.
func (*Handler) Scan ¶
func (h *Handler) Scan(opts Option) (*image.ScannedImage, error)
Scan will send payload to image scanning service and fetch the result back.
func (Handler) SendCancelSignal ¶
SendCancelSignal will send a cancel signal to backend, will be called when timeout or manual interruption.
type Option ¶
type Option struct {
// ForceScan is the option whether to force scan an image no matter it is scanned or not.
ForceScan bool
// BypassDockerDaemon is whether not to use docker daemon to pull the image
BypassDockerDaemon bool
// UseDockerDaemon deprecated.
UseDockerDaemon bool
// Credential is the auth string used for login to registry, format: USERNAME[:PASSWORD]
Credential string
// ShouldCleanup is whether to delete the docker image pulled by docker
ShouldCleanup bool
// FullTag is the tag set to override in the image
FullTag string
// Timeout is the duration (second) for the scan process
Timeout int
}
Option is the option used for image related cmd.
type RegistryHandler ¶
type RegistryHandler struct {
// contains filtered or unexported fields
}
RegistryHandler coordinates with OCI registry APIs in order to retrieve container images as needed.
func NewRegistryHandler ¶
func NewRegistryHandler() RegistryHandler
NewRegistryHandler constructs a new RegistryHandler instance.
func (*RegistryHandler) GenerateLayers ¶ added in v1.6.3
func (*RegistryHandler) GenerateSBOM ¶ added in v1.6.3
func (h *RegistryHandler) GenerateSBOM(input string, opts Option) (*Bom, error)
GenerateSBOM leverages Syft and Stereoscope to generate a bill of materials for a given image tag.