Documentation
¶
Overview ¶
Package trivy provides an adapter to convert Trivy JSON output to CTIS.
Package trivy provides an adapter to convert Trivy JSON output to CTIS.
Index ¶
- func ParseToCTIS(data []byte, opts *core.ParseOptions) (*ctis.Report, error)
- type Adapter
- type TrivyCVSS
- type TrivyCVSSData
- type TrivyCauseMeta
- type TrivyCode
- type TrivyCodeLine
- type TrivyDS
- type TrivyImageConfig
- type TrivyMetadata
- type TrivyMisconfig
- type TrivyOS
- type TrivyReport
- type TrivyResult
- type TrivySecret
- type TrivyVulnerability
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseToCTIS ¶
ParseToCTIS is a convenience function to parse Trivy JSON to CTIS format.
Types ¶
type Adapter ¶
type Adapter struct{}
Adapter converts Trivy JSON output to CTIS.
func (*Adapter) CanConvert ¶
CanConvert checks if the input can be converted.
func (*Adapter) Convert ¶
func (a *Adapter) Convert(ctx context.Context, input []byte, opts *core.AdapterOptions) (*ctis.Report, error)
Convert transforms Trivy JSON input to CTIS Report.
func (*Adapter) InputFormats ¶
InputFormats returns supported input formats.
func (*Adapter) OutputFormat ¶
OutputFormat returns the output format.
type TrivyCVSSData ¶
type TrivyCVSSData struct {
V2Vector string `json:"V2Vector,omitempty"`
V3Vector string `json:"V3Vector,omitempty"`
V2Score float64 `json:"V2Score,omitempty"`
V3Score float64 `json:"V3Score,omitempty"`
}
TrivyCVSSData contains CVSS scoring details.
type TrivyCauseMeta ¶
type TrivyCauseMeta struct {
Resource string `json:"Resource,omitempty"`
Provider string `json:"Provider,omitempty"`
Service string `json:"Service,omitempty"`
StartLine int `json:"StartLine,omitempty"`
EndLine int `json:"EndLine,omitempty"`
Code *TrivyCode `json:"Code,omitempty"`
}
TrivyCauseMeta contains location details for misconfigurations.
type TrivyCode ¶
type TrivyCode struct {
Lines []TrivyCodeLine `json:"Lines,omitempty"`
}
TrivyCode contains the code snippet details.
type TrivyCodeLine ¶
type TrivyCodeLine struct {
Number int `json:"Number,omitempty"`
Content string `json:"Content,omitempty"`
}
TrivyCodeLine is a single line of code.
type TrivyDS ¶
type TrivyDS struct {
ID string `json:"ID,omitempty"`
Name string `json:"Name,omitempty"`
URL string `json:"URL,omitempty"`
}
TrivyDS is a Trivy data source.
type TrivyImageConfig ¶
type TrivyImageConfig struct {
Architecture string `json:"architecture,omitempty"`
}
TrivyImageConfig holds container image configuration.
type TrivyMetadata ¶
type TrivyMetadata struct {
OS *TrivyOS `json:"OS,omitempty"`
ImageID string `json:"ImageID,omitempty"`
ImageConfig *TrivyImageConfig `json:"ImageConfig,omitempty"`
}
TrivyMetadata contains scan metadata.
type TrivyMisconfig ¶
type TrivyMisconfig struct {
Type string `json:"Type,omitempty"`
ID string `json:"ID,omitempty"`
AVDID string `json:"AVDID,omitempty"`
Title string `json:"Title,omitempty"`
Description string `json:"Description,omitempty"`
Message string `json:"Message,omitempty"`
Namespace string `json:"Namespace,omitempty"`
Query string `json:"Query,omitempty"`
Resolution string `json:"Resolution,omitempty"`
Severity string `json:"Severity"`
PrimaryURL string `json:"PrimaryURL,omitempty"`
References []string `json:"References,omitempty"`
Status string `json:"Status,omitempty"`
CauseMetadata *TrivyCauseMeta `json:"CauseMetadata,omitempty"`
}
TrivyMisconfig represents a misconfiguration finding.
type TrivyReport ¶
type TrivyReport struct {
SchemaVersion int `json:"SchemaVersion"`
ArtifactName string `json:"ArtifactName,omitempty"`
ArtifactType string `json:"ArtifactType,omitempty"`
Metadata *TrivyMetadata `json:"Metadata,omitempty"`
Results []TrivyResult `json:"Results"`
}
TrivyReport is the root Trivy JSON document.
type TrivyResult ¶
type TrivyResult struct {
Target string `json:"Target"`
Class string `json:"Class,omitempty"`
Type string `json:"Type,omitempty"`
Vulnerabilities []TrivyVulnerability `json:"Vulnerabilities,omitempty"`
Misconfigurations []TrivyMisconfig `json:"Misconfigurations,omitempty"`
Secrets []TrivySecret `json:"Secrets,omitempty"`
}
TrivyResult represents a scan result for a target.
type TrivySecret ¶
type TrivySecret struct {
RuleID string `json:"RuleID,omitempty"`
Category string `json:"Category,omitempty"`
Severity string `json:"Severity"`
Title string `json:"Title,omitempty"`
StartLine int `json:"StartLine,omitempty"`
EndLine int `json:"EndLine,omitempty"`
Match string `json:"Match,omitempty"`
}
TrivySecret represents a secret finding from Trivy.
type TrivyVulnerability ¶
type TrivyVulnerability struct {
VulnerabilityID string `json:"VulnerabilityID"`
PkgName string `json:"PkgName"`
PkgPath string `json:"PkgPath,omitempty"`
InstalledVersion string `json:"InstalledVersion"`
FixedVersion string `json:"FixedVersion,omitempty"`
Severity string `json:"Severity"`
Title string `json:"Title,omitempty"`
Description string `json:"Description,omitempty"`
PrimaryURL string `json:"PrimaryURL,omitempty"`
DataSource *TrivyDS `json:"DataSource,omitempty"`
CVSS TrivyCVSS `json:"CVSS,omitempty"`
CweIDs []string `json:"CweIDs,omitempty"`
References []string `json:"References,omitempty"`
PublishedDate string `json:"PublishedDate,omitempty"`
LastModifiedDate string `json:"LastModifiedDate,omitempty"`
Status string `json:"Status,omitempty"`
}
TrivyVulnerability represents a vulnerability finding.