Documentation
¶
Overview ¶
Package reporter provides a contract for implementing reporting modules.
Index ¶
- func BoldText(s string) string
- func CriticalBgText(s string) string
- func CriticalText(s string) string
- func FaintText(s string) string
- func HighBgText(s string) string
- func InfoBgText(s string) string
- func InfoText(s string) string
- func LowBgText(s string) string
- func MagentaBgText(s string) string
- func MediumBgText(s string) string
- func NewGitLabReporter(config GitLabReporterConfig) (*gitLabReporter, error)
- func NewSkillReporter(config SkillReporterConfig) *skillReporter
- func NewSyncReporter(config SyncReporterConfig, envResolver SyncReporterEnvResolver, ...) (*syncReporter, error)
- func SuccessBgText(s string) string
- func WarningBgText(s string) string
- func WarningText(s string) string
- func WhiteBgText(s string) string
- func WriteTemplToFile(component interface{ ... }, path string) error
- type ColorConfig
- func (c *ColorConfig) BoldText(s string) string
- func (c *ColorConfig) CriticalBgText(s string) string
- func (c *ColorConfig) CriticalText(s string) string
- func (c *ColorConfig) FaintText(s string) string
- func (c *ColorConfig) HighBgText(s string) string
- func (c *ColorConfig) InfoBgText(s string) string
- func (c *ColorConfig) InfoText(s string) string
- func (c *ColorConfig) LowBgText(s string) string
- func (c *ColorConfig) MagentaBgText(s string) string
- func (c *ColorConfig) MediumBgText(s string) string
- func (c *ColorConfig) SuccessBgText(s string) string
- func (c *ColorConfig) WarningBgText(s string) string
- func (c *ColorConfig) WarningText(s string) string
- func (c *ColorConfig) WhiteBgText(s string) string
- type CsvReportingConfig
- type CycloneDXReporterConfig
- type DefectDojoProduct
- type DefectDojoReporterConfig
- type GitLabReporterConfig
- type HtmlReportingConfig
- type JsonReportingConfig
- type MarkdownReportingConfig
- type MarkdownSummaryReporterConfig
- type Reporter
- func NewConsoleReporter() (Reporter, error)
- func NewCsvReporter(config CsvReportingConfig) (Reporter, error)
- func NewCycloneDXReporter(config CycloneDXReporterConfig) (Reporter, error)
- func NewDefectDojoReporter(config DefectDojoReporterConfig) (Reporter, error)
- func NewDotGraphReporter(directory string) (Reporter, error)
- func NewHtmlReporter(config HtmlReportingConfig) (Reporter, error)
- func NewJsonReportGenerator(config JsonReportingConfig) (Reporter, error)
- func NewMarkdownReportGenerator(config MarkdownReportingConfig) (Reporter, error)
- func NewMarkdownSummaryReporter(config MarkdownSummaryReporterConfig) (Reporter, error)
- func NewSarifReporter(config SarifReporterConfig) (Reporter, error)
- func NewSqlite3Reporter(config Sqlite3ReporterConfig) (Reporter, error)
- func NewSummaryReporter(config SummaryReporterConfig) (Reporter, error)
- type SarifReporterConfig
- type Severity
- type SkillReporterConfig
- type Sqlite3ReporterConfig
- type SummaryReporterConfig
- type SyncReporterCallbacks
- type SyncReporterConfig
- type SyncReporterEnvResolver
- type ToolMetadata
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CriticalBgText ¶ added in v1.12.7
CriticalBgText returns text with critical severity background
func CriticalText ¶ added in v1.12.7
CriticalText returns text with critical severity foreground
func HighBgText ¶ added in v1.12.7
HighBgText returns text with high severity background
func InfoBgText ¶ added in v1.12.7
InfoBgText returns text with info background
func MagentaBgText ¶ added in v1.12.7
MagentaBgText returns text with magenta background
func MediumBgText ¶ added in v1.12.7
MediumBgText returns text with medium severity background
func NewGitLabReporter ¶ added in v1.9.9
func NewGitLabReporter(config GitLabReporterConfig) (*gitLabReporter, error)
func NewSkillReporter ¶ added in v1.12.17
func NewSkillReporter(config SkillReporterConfig) *skillReporter
NewSkillReporter creates a new skill reporter
func NewSyncReporter ¶ added in v1.1.0
func NewSyncReporter(config SyncReporterConfig, envResolver SyncReporterEnvResolver, callbacks SyncReporterCallbacks) (*syncReporter, error)
NewSyncReporter creates a new sync reporter.
func SuccessBgText ¶ added in v1.12.7
SuccessBgText returns text with success background
func WarningBgText ¶ added in v1.12.7
WarningBgText returns text with warning background
func WarningText ¶ added in v1.12.7
WarningText returns text with warning color
func WhiteBgText ¶ added in v1.12.7
WhiteBgText returns text with white background
Types ¶
type ColorConfig ¶ added in v1.12.7
type ColorConfig struct {
// contains filtered or unexported fields
}
ColorConfig holds the terminal color configuration
func GetColorConfig ¶ added in v1.12.7
func GetColorConfig() *ColorConfig
GetColorConfig returns the global color configuration
func (*ColorConfig) BoldText ¶ added in v1.12.7
func (c *ColorConfig) BoldText(s string) string
BoldText returns text with bold styling
func (*ColorConfig) CriticalBgText ¶ added in v1.12.7
func (c *ColorConfig) CriticalBgText(s string) string
CriticalBgText returns text with critical severity background
func (*ColorConfig) CriticalText ¶ added in v1.12.7
func (c *ColorConfig) CriticalText(s string) string
CriticalText returns text with critical severity foreground
func (*ColorConfig) FaintText ¶ added in v1.12.7
func (c *ColorConfig) FaintText(s string) string
FaintText returns text with faint/dim styling
func (*ColorConfig) HighBgText ¶ added in v1.12.7
func (c *ColorConfig) HighBgText(s string) string
HighBgText returns text with high severity background
func (*ColorConfig) InfoBgText ¶ added in v1.12.7
func (c *ColorConfig) InfoBgText(s string) string
InfoBgText returns text with info background Note: Uses cyan instead of blue for ANSI256/TrueColor to improve visibility on dark terminals. Blue backgrounds have poor contrast on dark terminal themes (see issue #537).
func (*ColorConfig) InfoText ¶ added in v1.12.7
func (c *ColorConfig) InfoText(s string) string
InfoText returns text with info foreground Note: Uses cyan instead of blue for ANSI256/TrueColor to improve visibility on dark terminals. Blue text has poor contrast on dark terminal themes (see issue #537).
func (*ColorConfig) LowBgText ¶ added in v1.12.7
func (c *ColorConfig) LowBgText(s string) string
LowBgText returns text with low severity background Note: Uses cyan instead of blue for ANSI256/TrueColor to improve visibility on dark terminals. Blue backgrounds have poor contrast on dark terminal themes (see issue #537).
func (*ColorConfig) MagentaBgText ¶ added in v1.12.7
func (c *ColorConfig) MagentaBgText(s string) string
MagentaBgText returns text with tag background Note: Uses cyan instead of magenta for ANSI256/TrueColor to improve visibility on dark terminals. Magenta/pink backgrounds have poor contrast on dark terminal themes (see issue #537).
func (*ColorConfig) MediumBgText ¶ added in v1.12.7
func (c *ColorConfig) MediumBgText(s string) string
MediumBgText returns text with medium severity background
func (*ColorConfig) SuccessBgText ¶ added in v1.12.7
func (c *ColorConfig) SuccessBgText(s string) string
SuccessBgText returns text with success background
func (*ColorConfig) WarningBgText ¶ added in v1.12.7
func (c *ColorConfig) WarningBgText(s string) string
WarningBgText returns text with warning background
func (*ColorConfig) WarningText ¶ added in v1.12.7
func (c *ColorConfig) WarningText(s string) string
WarningText returns text with warning color
func (*ColorConfig) WhiteBgText ¶ added in v1.12.7
func (c *ColorConfig) WhiteBgText(s string) string
WhiteBgText returns text with white background
type CsvReportingConfig ¶ added in v1.0.0
type CsvReportingConfig struct {
Path string
}
type CycloneDXReporterConfig ¶ added in v1.10.0
type CycloneDXReporterConfig struct {
Tool ToolMetadata
// Path defines the output file path
Path string
// Application component name, this is the top-level component in the BOM
ApplicationComponentName string
// Unique identifier for this BOM confirming to UUID RFC 4122 standard
// If empty, a new UUID will be generated
SerialNumber string
}
CycloneDXReporterConfig contains configuration parameters for the CycloneDX reporter
type DefectDojoProduct ¶ added in v1.9.7
type DefectDojoReporterConfig ¶ added in v1.9.7
type GitLabReporterConfig ¶ added in v1.9.9
type GitLabReporterConfig struct {
Path string // Report path, value of --report-gitlab
Tool ToolMetadata
}
type HtmlReportingConfig ¶ added in v1.12.3
type HtmlReportingConfig struct {
Path string // Output path for HTML file
}
type JsonReportingConfig ¶ added in v1.2.0
type JsonReportingConfig struct {
Path string
Tool ToolMetadata
}
type MarkdownReportingConfig ¶
type MarkdownReportingConfig struct {
Path string
}
type MarkdownSummaryReporterConfig ¶ added in v1.5.7
type MarkdownSummaryReporterConfig struct {
Tool ToolMetadata
Path string
ReportTitle string
IncludeMalwareAnalysis bool
ActiveMalwareAnalysis bool
}
type Reporter ¶
type Reporter interface {
Name() string
// Feed collected data to reporting module
AddManifest(manifest *models.PackageManifest)
AddAnalyzerEvent(event *analyzer.AnalyzerEvent)
AddPolicyEvent(event *policy.PolicyEvent)
// Inform reporting module to finalise (e.g. write report to file)
Finish() error
}
func NewConsoleReporter ¶
func NewCsvReporter ¶ added in v1.0.0
func NewCsvReporter(config CsvReportingConfig) (Reporter, error)
func NewCycloneDXReporter ¶ added in v1.10.0
func NewCycloneDXReporter(config CycloneDXReporterConfig) (Reporter, error)
func NewDefectDojoReporter ¶ added in v1.9.7
func NewDefectDojoReporter(config DefectDojoReporterConfig) (Reporter, error)
func NewDotGraphReporter ¶ added in v1.5.6
func NewHtmlReporter ¶ added in v1.12.3
func NewHtmlReporter(config HtmlReportingConfig) (Reporter, error)
func NewJsonReportGenerator ¶ added in v1.2.0
func NewJsonReportGenerator(config JsonReportingConfig) (Reporter, error)
func NewMarkdownReportGenerator ¶
func NewMarkdownReportGenerator(config MarkdownReportingConfig) (Reporter, error)
func NewMarkdownSummaryReporter ¶ added in v1.5.7
func NewMarkdownSummaryReporter(config MarkdownSummaryReporterConfig) (Reporter, error)
NewMarkdownSummaryReporter creates a new markdown summary reporter. This reporter is suitable for generating markdown reports intended for PR comments.
func NewSarifReporter ¶ added in v1.6.0
func NewSarifReporter(config SarifReporterConfig) (Reporter, error)
func NewSqlite3Reporter ¶ added in v1.12.0
func NewSqlite3Reporter(config Sqlite3ReporterConfig) (Reporter, error)
func NewSummaryReporter ¶
func NewSummaryReporter(config SummaryReporterConfig) (Reporter, error)
type SarifReporterConfig ¶ added in v1.6.0
type SarifReporterConfig struct {
Tool ToolMetadata
IncludeVulns bool
IncludeMalware bool
Path string
}
type Severity ¶ added in v1.9.9
type Severity string
Severity represents severity of a vulnerability or malware
type SkillReporterConfig ¶ added in v1.12.17
type SkillReporterConfig struct {
// Whether to show detailed evidence in output
ShowEvidence bool
}
SkillReporterConfig configures the skill reporter
func DefaultSkillReporterConfig ¶ added in v1.12.17
func DefaultSkillReporterConfig() SkillReporterConfig
DefaultSkillReporterConfig returns the default configuration
type Sqlite3ReporterConfig ¶ added in v1.12.0
type Sqlite3ReporterConfig struct {
Path string
Tool ToolMetadata
Overwrite bool
Append bool
}
type SummaryReporterConfig ¶ added in v1.3.0
type SyncReporterCallbacks ¶ added in v1.9.7
type SyncReporterCallbacks struct {
OnSyncStart func()
OnSyncFinish func()
OnPackageSync func(pkg *models.Package)
OnPackageSyncDone func(pkg *models.Package)
OnEventSync func(event *analyzer.AnalyzerEvent)
OnEventSyncDone func(event *analyzer.AnalyzerEvent)
}
SyncReporterCallbacks are effects trigger during Cloud Sync Report Process This is primarily used to show progress bar on the terminal
type SyncReporterConfig ¶ added in v1.1.0
type SyncReporterConfig struct {
// gRPC connection for ControlTower
ClientConnection *grpc.ClientConn
// Enable multi-project syncing
// In this case, a new project is created per package manifest
EnableMultiProjectSync bool
// Required when scanning a single project
ProjectName string
ProjectVersion string
// Performance
WorkerCount int
// Tool details
Tool ToolMetadata
}
SyncReporterConfig defines the configuration for the sync reporter.
type SyncReporterEnvResolver ¶ added in v1.11.0
type SyncReporterEnvResolver interface {
// The resolved source of the runtime environment (e.g. GitHub)
GetProjectSource() controltowerv1pb.Project_Source
// The resolved URL of the runtime environment (e.g. GitHub repository URL)
GetProjectURL() string
// The trigger of the runtime environment (e.g. CI/CD pipeline)
Trigger() controltowerv1.ToolTrigger
// The Git reference of the runtime environment (e.g. branch, tag, commit)
GitRef() string
// The Git SHA of the runtime environment (e.g. commit hash)
GitSha() string
}
SyncReporterEnvResolver defines the contract for implementing environment resolver for the sync reporter. Here we decouple the actual implementation of the resolver to the client that uses the reporter plugin. The resolver is used to provide environment awareness to the reporter. For example, when running in GitHub or on a Git repository, the resolver can provide the project source, project and other information that is required to create a tool session.
func DefaultSyncReporterEnvResolver ¶ added in v1.11.0
func DefaultSyncReporterEnvResolver() SyncReporterEnvResolver
DefaultSyncReporterEnvResolver returns the default environment resolver for the sync reporter. This is used when no environment resolver is provided.
func GithubActionsSyncReporterResolver ¶ added in v1.12.0
func GithubActionsSyncReporterResolver() SyncReporterEnvResolver
func NewSyncReporterEnvironmentResolver ¶ added in v1.12.0
func NewSyncReporterEnvironmentResolver() SyncReporterEnvResolver