output

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: 25 Imported by: 1

Documentation

Index

Constants

View Source
const (
	PreFormat              HtmlTag = "<pre>%s</pre>"
	ImgTag                 HtmlTag = "<img alt=\"%s\" src=%s>"
	CenterContent          HtmlTag = "<div style=\"display: flex; align-items: center; text-align: center\">%s</div>"
	BoldTxt                HtmlTag = "<b>%s</b>"
	Link                   HtmlTag = "<a href=\"%s\">%s</a>"
	NewLine                HtmlTag = "<br>%s"
	DetailsWithSummary     HtmlTag = "<details><summary>%s</summary>%s</details>"
	DetailsOpenWithSummary HtmlTag = "<details open><summary><h3>%s</h3></summary>%s\n</details>"
	TabTag                 HtmlTag = "&Tab;%s"

	ApplicableStatusCount    SeverityDisplayStatus = "%d Applicable"
	NotApplicableStatusCount SeverityDisplayStatus = "%d Not Applicable"
)

Variables

This section is empty.

Functions

func CombineSarifOutputFiles

func CombineSarifOutputFiles(dataFilePaths []string) (data []byte, err error)

func GenerateSecuritySectionMarkdown

func GenerateSecuritySectionMarkdown(curationData []formats.ResultsSummary) (markdown string, err error)

func NewSecurityJobSummary

func NewSecurityJobSummary() (js *commandsummary.CommandSummary, err error)

Manage the job summary for security commands

func PrintJasTable

func PrintJasTable(tables formats.ResultsTables, entitledForJas bool, scanType jasutils.JasScanType) error

func PrintJson

func PrintJson(output interface{}) (err error)

func PrintLicensesTable

func PrintLicensesTable(tables formats.ResultsTables, printExtended bool, cmdType utils.CommandType) error

PrintLicensesTable prints the licenses in a table. Set multipleRoots to true in case the given licenses array contains (or may contain) results of several projects or files (like in binary scan). In case multipleRoots is true, the field Component will show the root of each impact path, otherwise it will show the root's child. Set printExtended to true to print fields with 'extended' tag. If the scan argument is set to true, print the scan tables.

func PrintSecretsTable

func PrintSecretsTable(tables formats.ResultsTables, entitledForJas, tokenValidationEnabled bool) (err error)

func PrintViolationsTable

func PrintViolationsTable(tables formats.ResultsTables, cmdType utils.CommandType, printExtended bool) (err error)

PrintViolationsTable prints the violations in 4 tables: security violations, license compliance violations, operational risk violations and ignore rule URLs. Set printExtended to true to print fields with 'extended' tag. If the scan argument is set to true, print the scan tables.

func PrintVulnerabilitiesTable

func PrintVulnerabilitiesTable(tables formats.ResultsTables, cmdType utils.CommandType, techDetected, printExtended bool) error

PrintVulnerabilitiesTable prints the vulnerabilities in a table. Set printExtended to true to print fields with 'extended' tag. If the scan argument is set to true, print the scan tables.

func RecordSarifOutput

func RecordSarifOutput(cmdResults *results.SecurityCommandResults, serverDetails *config.ServerDetails, includeVulnerabilities, hasViolationContext bool, requestedScans ...utils.SubScanType) (err error)

func RecordSecurityCommandSummary

func RecordSecurityCommandSummary(content ScanCommandResultSummary) (err error)

Record the security command outputs

func WriteJsonResults

func WriteJsonResults(results *results.SecurityCommandResults) (resultsPath string, err error)

func WriteSarifResultsAsString

func WriteSarifResultsAsString(report *sarif.Report, escape bool) (sarifStr string, err error)

Types

type DynamicMarkdownGenerator

type DynamicMarkdownGenerator struct {
	// contains filtered or unexported fields
}

func (DynamicMarkdownGenerator) GetViolations

func (mg DynamicMarkdownGenerator) GetViolations() (content string)

func (DynamicMarkdownGenerator) GetVulnerabilities

func (mg DynamicMarkdownGenerator) GetVulnerabilities() (content string)

type EmptyMarkdownGenerator

type EmptyMarkdownGenerator struct{}

func (EmptyMarkdownGenerator) GetViolations

func (g EmptyMarkdownGenerator) GetViolations() (content string)

func (EmptyMarkdownGenerator) GetVulnerabilities

func (g EmptyMarkdownGenerator) GetVulnerabilities() (content string)

type HtmlTag

type HtmlTag string

func (HtmlTag) Format

func (c HtmlTag) Format(args ...any) string

func (HtmlTag) FormatInt

func (c HtmlTag) FormatInt(value int) string

type ResultSummaryArgs

type ResultSummaryArgs struct {
	BaseJfrogUrl string `json:"base_jfrog_url,omitempty"`
	// Args to id the result
	DockerImage  string   `json:"docker_image,omitempty"`
	BuildName    string   `json:"build_name,omitempty"`
	BuildNumbers []string `json:"build_numbers,omitempty"`
}

func (ResultSummaryArgs) GetUrl

func (rsa ResultSummaryArgs) GetUrl(index commandsummary.Index, scanIds ...string) string

func (ResultSummaryArgs) ToArgs

func (rsa ResultSummaryArgs) ToArgs(index commandsummary.Index) (args []string)

type ResultsWriter

type ResultsWriter struct {
	// contains filtered or unexported fields
}

func NewResultsWriter

func NewResultsWriter(scanResults *results.SecurityCommandResults) *ResultsWriter

func (*ResultsWriter) PrintScanResults

func (rw *ResultsWriter) PrintScanResults() error

PrintScanResults prints the scan results in the specified format. Note that errors are printed only with SimpleJson format.

func (*ResultsWriter) SetExtraMessages

func (rw *ResultsWriter) SetExtraMessages(messages []string) *ResultsWriter

func (*ResultsWriter) SetHasViolationContext

func (rw *ResultsWriter) SetHasViolationContext(hasViolationContext bool) *ResultsWriter

func (*ResultsWriter) SetIncludeLicenses

func (rw *ResultsWriter) SetIncludeLicenses(licenses bool) *ResultsWriter

func (*ResultsWriter) SetIncludeVulnerabilities

func (rw *ResultsWriter) SetIncludeVulnerabilities(includeVulnerabilities bool) *ResultsWriter

func (*ResultsWriter) SetIsMultipleRootProject

func (rw *ResultsWriter) SetIsMultipleRootProject(isMultipleRootProject bool) *ResultsWriter

func (*ResultsWriter) SetOutputFormat

func (rw *ResultsWriter) SetOutputFormat(f format.OutputFormat) *ResultsWriter

func (*ResultsWriter) SetPlatformUrl added in v1.13.7

func (rw *ResultsWriter) SetPlatformUrl(platformUrl string) *ResultsWriter

func (*ResultsWriter) SetPrintExtendedTable

func (rw *ResultsWriter) SetPrintExtendedTable(extendedTable bool) *ResultsWriter

func (*ResultsWriter) SetSubScansPreformed

func (rw *ResultsWriter) SetSubScansPreformed(subScansPreformed []utils.SubScanType) *ResultsWriter

type ScanCommandResultSummary

type ScanCommandResultSummary struct {
	ResultType utils.CommandType      `json:"resultType"`
	Args       *ResultSummaryArgs     `json:"args,omitempty"`
	Summary    formats.ResultsSummary `json:"summary"`
}

func NewAuditScanSummary

func NewAuditScanSummary(cmdResults *results.SecurityCommandResults, serverDetails *config.ServerDetails, vulnerabilitiesRequested, violationsRequested bool) (summary ScanCommandResultSummary, err error)

func NewBinaryScanSummary

func NewBinaryScanSummary(cmdResults *results.SecurityCommandResults, serverDetails *config.ServerDetails, vulnerabilitiesRequested, violationsRequested bool) (summary ScanCommandResultSummary, err error)

func NewBuildScanSummary

func NewBuildScanSummary(cmdResults *results.SecurityCommandResults, serverDetails *config.ServerDetails, vulnerabilitiesRequested bool, buildName, buildNumber string) (summary ScanCommandResultSummary, err error)

func NewCurationSummary

func NewCurationSummary(cmdResult formats.ResultsSummary) (summary ScanCommandResultSummary)

func NewDockerScanSummary

func NewDockerScanSummary(cmdResults *results.SecurityCommandResults, serverDetails *config.ServerDetails, vulnerabilitiesRequested, violationsRequested bool, dockerImage string) (summary ScanCommandResultSummary, err error)

type SecurityJobSummary

type SecurityJobSummary struct{}

func (*SecurityJobSummary) BinaryScan

func (js *SecurityJobSummary) BinaryScan(filePaths []string) (generator DynamicMarkdownGenerator, err error)

func (*SecurityJobSummary) BuildScan

func (js *SecurityJobSummary) BuildScan(filePaths []string) (generator DynamicMarkdownGenerator, err error)

func (*SecurityJobSummary) DockerScan

func (js *SecurityJobSummary) DockerScan(filePaths []string) (generator DynamicMarkdownGenerator, err error)

func (*SecurityJobSummary) GenerateMarkdownFromFiles

func (js *SecurityJobSummary) GenerateMarkdownFromFiles(dataFilePaths []string) (markdown string, err error)

Generate the Security section (Curation)

func (*SecurityJobSummary) GetNonScannedResult

func (js *SecurityJobSummary) GetNonScannedResult() (generator EmptyMarkdownGenerator)

type SeverityDisplayStatus

type SeverityDisplayStatus string

func (SeverityDisplayStatus) Format

func (s SeverityDisplayStatus) Format(count int) string

Jump to

Keyboard shortcuts

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