scan

package
v0.0.0-...-232f9ba Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// JobParamRegistration ...
	JobParamRegistration = "registration"
	// JobParameterRequest ...
	JobParameterRequest = "scanRequest"
	// JobParameterMimes ...
	JobParameterMimes = "mimeTypes"
	// JobParameterAuthType ...
	JobParameterAuthType = "authType"
	// JobParameterRobot ...
	JobParameterRobot = "robotAccount"
)

Variables

This section is empty.

Functions

func EnsureDefaultScanner

func EnsureDefaultScanner(ctx context.Context, scannerName string) (err error)

EnsureDefaultScanner ensures that the scanner with the specified URL is set as default in the system.

func EnsureScanners

func EnsureScanners(ctx context.Context, wantedScanners []scanner.Registration) (err error)

EnsureScanners ensures that the scanners with the specified endpoints URLs exist in the system.

func ExtractScanReq

func ExtractScanReq(params job.Parameters) (*v1.ScanRequest, error)

ExtractScanReq extracts the scan request from the job parameters.

func GenAccessoryArt

func GenAccessoryArt(sq v1sq.ScanRequest, accData []byte, accAnnotations map[string]string, mediaType string, robot *model.Robot) (string, error)

GenAccessoryArt composes the accessory oci object and push it back to harbor core as an accessory of the scanned artifact.

func RegisterScanHanlder

func RegisterScanHanlder(requestType string, handler Handler)

RegisterScanHanlder register scanner handler

func RemoveImmutableScanners

func RemoveImmutableScanners(ctx context.Context, names []string) error

RemoveImmutableScanners removes immutable scanner Registrations with the specified endpoint URLs.

Types

type CheckInReport

type CheckInReport struct {
	Digest           string `json:"digest"`
	RegistrationUUID string `json:"registration_uuid"`
	MimeType         string `json:"mime_type"`
	RawReport        string `json:"raw_report"`
}

CheckInReport defines model for checking in the scan report with specified mime.

func (*CheckInReport) FromJSON

func (cir *CheckInReport) FromJSON(jsonData string) error

FromJSON parse json to CheckInReport

func (*CheckInReport) ToJSON

func (cir *CheckInReport) ToJSON() (string, error)

ToJSON marshal CheckInReport to JSON

type Handler

type Handler interface {
	// RequestProducesMineTypes returns the produces mime types
	RequestProducesMineTypes() []string
	// RequiredPermissions defines the permission used by the scan robot account
	RequiredPermissions() []*types.Policy
	// RequestParameters defines the parameters for scan request
	RequestParameters() map[string]interface{}
	// ReportURLParameter defines the parameters for scan report
	ReportURLParameter(sr *v1.ScanRequest) (string, error)
	// PostScan defines the operation after scan
	PostScan(ctx job.Context, sr *v1.ScanRequest, rp *scan.Report, rawReport string, startTime time.Time, robot *model.Robot) (string, error)
}

Handler handler for scan job, it could be implement by different scan type, such as vulnerability, sbom

func GetScanHandler

func GetScanHandler(requestType string) Handler

GetScanHandler get the handler

type Insecure

type Insecure bool

Insecure ...

func (Insecure) RemoteOptions

func (i Insecure) RemoteOptions() []remote.Option

RemoteOptions ...

type Job

type Job struct{}

Job for running scan in the job service with async way

func (*Job) MaxCurrency

func (j *Job) MaxCurrency() uint

MaxCurrency is implementation of same method in Interface.

func (*Job) MaxFails

func (j *Job) MaxFails() uint

MaxFails for defining the number of retries

func (*Job) Run

func (j *Job) Run(ctx job.Context, params job.Parameters) error

Run the job

func (*Job) ShouldRetry

func (j *Job) ShouldRetry() bool

ShouldRetry indicates if the job should be retried

func (*Job) Validate

func (j *Job) Validate(params job.Parameters) error

Validate the parameters of this job

Directories

Path Synopsis
dao
rest
v1

Jump to

Keyboard shortcuts

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