server

package
v0.1.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MimeDockerIM = "application/vnd.docker.distribution.manifest.v2+json"
View Source
var MimeOCI = "application/vnd.oci.image.manifest.v1+json"
View Source
var MimeSecurityVulnReport = "application/vnd.security.vulnerability.report; version=1.1"

Functions

func GenerateDefaultTLSCertificate

func GenerateDefaultTLSCertificate() error

func GetControllerServiceClient

func GetControllerServiceClient(joinIP string, joinPort uint16) (share.ControllerScanAdapterServiceClient, error)

func InitializeServer

func InitializeServer(config *config.ServerConfig)

InitializeServer sets up the go routines and http handlers to handle requests from Harbor.

Types

type CVSSDetails

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 {
	ConsumeMIMEs []string `json:"consumes_mime_types"`
	ProduceMIMEs []string `json:"produces_mime_types"`
}

type Counter

type Counter struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*Counter) Decrement

func (counter *Counter) Decrement()

func (*Counter) Get

func (counter *Counter) Get() int

func (*Counter) GetNoLock

func (counter *Counter) GetNoLock() int

func (*Counter) Increment

func (counter *Counter) Increment()

type HarborArtifact

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

type HarborRegistry

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

type Layer

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

type QueueMap

type QueueMap struct {
	sync.RWMutex
	Entries map[int]ScanRequest
}

type ReportData

type ReportData struct {
	sync.RWMutex
	ScanReports map[string]ScanReport
}

type ScanReport

type ScanReport struct {
	GeneratedAt     time.Time      `json:"generated_at"`
	Artifact        HarborArtifact `json:"artifact"`
	Scanner         ScannerSpec    `json:"scanner"`
	Severity        string         `json:"severity"`
	Vulnerabilities []Vuln         `json:"vulnerabilities"`
	Status          int
	ExpirationTime  time.Time
}

type ScanRequest

type ScanRequest struct {
	Registry      HarborRegistry `json:"registry"`
	Artifact      HarborArtifact `json:"artifact"`
	Authorization string
	WorkloadID    string
}

type ScanRequestQueue

type ScanRequestQueue struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*ScanRequestQueue) Dequeue

func (scanRequestQueue *ScanRequestQueue) Dequeue() ScanRequest

func (*ScanRequestQueue) Enqueue

func (scanRequestQueue *ScanRequestQueue) Enqueue(newRequest ScanRequest)

func (*ScanRequestQueue) Length

func (scanRequestQueue *ScanRequestQueue) Length() int

type ScanRequestReturn

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

type ScannerAdapterMetadata

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

type ScannerSpec

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

type Vuln

type Vuln struct {
	ID               string                 `json:"id"`
	Pkg              string                 `json:"package"`
	Version          string                 `json:"version"`
	FixVersion       string                 `json:"fix_version,omitempty"`
	Severity         string                 `json:"severity"`
	Description      string                 `json:"description"`
	Links            []string               `json:"links"`
	PreferredCVSS    *CVSSDetails           `json:"preferred_cvss,omitempty"`
	CweIDs           []string               `json:"cwe_ids,omitempty"`
	VendorAttributes map[string]interface{} `json:"vendor_attributes,omitempty"`
}

Jump to

Keyboard shortcuts

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