Documentation ¶
Index ¶
- Constants
- Variables
- type ArtifactDigestCalculator
- type CsvJobVendorID
- type Data
- type DefaultFilterProcessor
- func (dfp *DefaultFilterProcessor) ProcessLabelFilter(_ context.Context, labelIDs []int64, arts []*artifact.Artifact) ([]*artifact.Artifact, error)
- func (dfp *DefaultFilterProcessor) ProcessRepositoryFilter(ctx context.Context, filter string, projectIDs []int64) ([]int64, error)
- func (dfp *DefaultFilterProcessor) ProcessTagFilter(ctx context.Context, filter string, repositoryIDs []int64) ([]*artifact.Artifact, error)
- type Execution
- type FilterProcessor
- type Manager
- type Params
- type Request
- type SHA256ArtifactDigestCalculator
- type Task
- type TriggerParam
- type VulnerabilityDataSelector
Constants ¶
const ( ProjectIDsAttribute = "project_ids" JobNameAttribute = "job_name" UserNameAttribute = "user_name" StatusMessageAttribute = "status_message" // the scan data is a temporary file, use /tmp directory to avoid the permission issue. ScanDataExportDir = "/tmp" QueryPageSize = 100000 ArtifactGroupSize = 10000 DigestKey = "artifact_digest" CreateTimestampKey = "create_ts" Vendor = "SCAN_DATA_EXPORT" CsvJobVendorIDKey = CsvJobVendorID("vendorId") )
const ( CVEIDMatches = "cveIdMatches" PackageMatches = "packageMatches" ScannerMatches = "scannerMatches" CVE2VectorMatches = "cve2VectorMatches" CVE3VectorMatches = "cve3VectorMatches" )
const ( // This sql template aims to select vuln data from database, // which receive one parameter: // 1. artifacts id sets // consider for performance, the caller will slice the artifact ids to multi // groups if it's length over limit, so rowNum offset is designed to ensure the // final row id is sequence in the final output csv file. VulnScanReportQueryTemplate = `` /* 1320-byte string literal not displayed */ JobModeExport = "export" JobModeKey = "mode" JobID = "JobId" JobRequest = "Request" )
Variables ¶
var (
Mgr = NewManager()
)
Functions ¶
This section is empty.
Types ¶
type ArtifactDigestCalculator ¶
type ArtifactDigestCalculator interface { // Calculate returns the hash for a file Calculate(fileName string) (digest.Digest, error) }
ArtifactDigestCalculator is an interface to be implemented by all file hash calculators
type CsvJobVendorID ¶
type CsvJobVendorID string
CsvJobVendorID specific type to be used in contexts
type Data ¶
type Data struct { Repository string `orm:"column(repository_name)" csv:"Repository"` ArtifactDigest string `orm:"column(artifact_digest)" csv:"Artifact Digest"` CVEId string `orm:"column(cve_id)" csv:"CVE"` Package string `orm:"column(package)" csv:"Package"` Version string `orm:"column(package_version)" csv:"Current Version"` FixVersion string `orm:"column(fixed_version)" csv:"Fixed in version"` Severity string `orm:"column(severity)" csv:"Severity"` CWEIds string `orm:"column(cwe_ids)" csv:"CWE Ids"` AdditionalData string `orm:"column(vendor_attributes)" csv:"Additional Data"` ScannerName string `orm:"column(scanner_name)" csv:"Scanner"` }
type DefaultFilterProcessor ¶
type DefaultFilterProcessor struct {
// contains filtered or unexported fields
}
func (*DefaultFilterProcessor) ProcessLabelFilter ¶
func (*DefaultFilterProcessor) ProcessRepositoryFilter ¶
func (*DefaultFilterProcessor) ProcessTagFilter ¶
type Execution ¶
type Execution struct { // ID of the execution ID int64 // UserID triggering the execution UserID int64 // ProjectIDs contains projects ids ProjectIDs []int64 // Status provides the status of the execution Status string // StatusMessage contains the human-readable status message for the execution StatusMessage string // Trigger indicates the mode of trigger for the job execution Trigger string // StartTime contains the start time instant of the execution StartTime time.Time // EndTime contains the end time instant of the execution EndTime time.Time // ExportDataDigest contains the SHA256 hash of the exported scan data artifact ExportDataDigest string // Name of the job as specified during the export task invocation JobName string // Name of the user triggering the job UserName string // FilePresent is true if file artifact is actually present, false otherwise FilePresent bool }
Execution provides details about the running status of a scan data export job
type FilterProcessor ¶
type FilterProcessor interface { ProcessRepositoryFilter(ctx context.Context, filter string, projectIDs []int64) ([]int64, error) ProcessTagFilter(ctx context.Context, filter string, repositoryIDs []int64) ([]*artifact.Artifact, error) ProcessLabelFilter(ctx context.Context, labelIDs []int64, arts []*artifact.Artifact) ([]*artifact.Artifact, error) }
func NewFilterProcessor ¶
func NewFilterProcessor() FilterProcessor
NewFilterProcessor constructs an instance of a FilterProcessor
type Manager ¶
func NewManager ¶
func NewManager() Manager
type Params ¶
type Params struct { // cve ids CVEIds string // artifact ids ArtifactIDs []int64 // PageNumber PageNumber int64 // PageSize PageSize int64 }
Params specifies the filters for controlling the scan data export process
type Request ¶
type Request struct { // UserID contains the database identity of the user initiating the export request UserID int // UserName contains the name of the user initiating the export request UserName string // JobName contains the name of the job as specified by the external client. JobName string // cve ids CVEIds string // A list of one or more labels for which to export the scan data, defaults to all if empty Labels []int64 // A list of one or more projects for which to export the scan data, defaults to all if empty Projects []int64 // A list of repositories for which to export the scan data, defaults to all if empty Repositories string // A list of tags for which to export the scan data, defaults to all if empty Tags string }
Request encapsulates the filters to be provided when exporting the data for a scan.
type SHA256ArtifactDigestCalculator ¶
type SHA256ArtifactDigestCalculator struct{}
func (*SHA256ArtifactDigestCalculator) Calculate ¶
func (calc *SHA256ArtifactDigestCalculator) Calculate(fileName string) (digest.Digest, error)
type TriggerParam ¶
type VulnerabilityDataSelector ¶
type VulnerabilityDataSelector interface {
Select(vulnDataRecords []Data, decoration string, pattern string) ([]Data, error)
}
VulnerabilityDataSelector is a specialized implementation of a selector leveraging the doublestar pattern to select vulnerabilities
func NewVulnerabilityDataSelector ¶
func NewVulnerabilityDataSelector() VulnerabilityDataSelector
NewVulnerabilityDataSelector selects the vulnerability data record that matches the provided conditions