conversion

package
v1.13.8 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: Apache-2.0 Imports: 10 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandResultsConvertor

type CommandResultsConvertor struct {
	Params ResultConvertParams
}

func NewCommandResultsConvertor

func NewCommandResultsConvertor(params ResultConvertParams) *CommandResultsConvertor

func (*CommandResultsConvertor) ConvertToSarif

func (c *CommandResultsConvertor) ConvertToSarif(cmdResults *results.SecurityCommandResults) (sarifReport *sarif.Report, err error)

func (*CommandResultsConvertor) ConvertToSimpleJson

func (c *CommandResultsConvertor) ConvertToSimpleJson(cmdResults *results.SecurityCommandResults) (simpleJsonResults formats.SimpleJsonResults, err error)

func (*CommandResultsConvertor) ConvertToSummary

func (c *CommandResultsConvertor) ConvertToSummary(cmdResults *results.SecurityCommandResults) (summaryResults formats.ResultsSummary, err error)

func (*CommandResultsConvertor) ConvertToTable

func (c *CommandResultsConvertor) ConvertToTable(cmdResults *results.SecurityCommandResults) (tableResults formats.ResultsTables, err error)

type ResultConvertParams

type ResultConvertParams struct {
	// If true, a violation context was provided and we expect violation results
	HasViolationContext bool
	// Control if the output should include vulnerabilities information
	IncludeVulnerabilities bool
	// If true and commandType.IsTargetBinary(), binary inner paths in results will be converted to the CI job file (relevant only for SARIF)
	PatchBinaryPaths bool
	// Control if the output should include licenses information
	IncludeLicenses bool
	// Control and override converting command results as multi target results, if nil will be determined by the results.HasMultipleTargets()
	IsMultipleRoots *bool
	// The requested scans to be included in the results, if empty all scans will be included
	RequestedScans []utils.SubScanType
	// Create local license violations if repo context was not provided and a license is not in this list
	AllowedLicenses []string
	// Output will contain only the unique violations determined by the GetUniqueKey function (SimpleJson only)
	SimplifiedOutput bool
	// Convert the results to a pretty format if supported (Table and SimpleJson only)
	Pretty bool
	// The JFrog platform URL to be used in the results (Sarif only - GitHub integration)
	PlatformUrl string
}

type ResultsStreamFormatParser

type ResultsStreamFormatParser[T interface{}] interface {
	// Reset the convertor to start converting a new command results
	Reset(cmdType utils.CommandType, multiScanId, xrayVersion string, entitledForJas, multipleTargets bool, generalError error) error
	// Will be called for each scan target (indicating the current is done parsing and starting to parse a new scan)
	ParseNewTargetResults(target results.ScanTarget, errors ...error) error
	// Parse SCA content to the current scan target
	ParseViolations(target results.ScanTarget, scaResponse services.ScanResponse, applicabilityRuns ...*sarif.Run) error
	ParseVulnerabilities(target results.ScanTarget, scaResponse services.ScanResponse, applicabilityRuns ...*sarif.Run) error
	ParseLicenses(target results.ScanTarget, licenses []services.License) error
	// Parse JAS content to the current scan target
	ParseSecrets(target results.ScanTarget, secrets ...*sarif.Run) error
	ParseIacs(target results.ScanTarget, iacs ...*sarif.Run) error
	ParseSast(target results.ScanTarget, sast ...*sarif.Run) error
	// When done parsing the stream results, get the converted content
	Get() (T, error)
}

Parse a stream of results and convert them to the desired format T

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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