Skip to content

Commit

Permalink
feat: Add Vulnerability scanning report to the summaryDetails section (
Browse files Browse the repository at this point in the history
…#148)

* feat: Add Vulnerability scanning report to the summaryDetails section

Signed-off-by: Alfredo Garcia <[email protected]>

* Changing to camelcase the json fields

Signed-off-by: Alfredo Garcia <[email protected]>

---------

Signed-off-by: Alfredo Garcia <[email protected]>
  • Loading branch information
agarcia-oss authored Feb 29, 2024
1 parent eaa76d3 commit 5102318
Showing 1 changed file with 41 additions and 8 deletions.
49 changes: 41 additions & 8 deletions reporthandling/results/v1/reportsummary/datastructures.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ type ControlSummaries map[string]ControlSummary

// SummaryDetails detailed summary of the scanning. will contain versions, counters, etc.
type SummaryDetails struct {
Controls ControlSummaries `json:"controls,omitempty"`
Status apis.ScanningStatus `json:"status"`
Frameworks []FrameworkSummary `json:"frameworks"`
ResourcesSeverityCounters SeverityCounters `json:"resourcesSeverityCounters,omitempty"`
ControlsSeverityCounters SeverityCounters `json:"controlsSeverityCounters,omitempty"`
StatusCounters StatusCounters `json:"ResourceCounters"` // Backward compatibility
Score float32 `json:"score"`
ComplianceScore float32 `json:"complianceScore"`
Controls ControlSummaries `json:"controls,omitempty"`
Status apis.ScanningStatus `json:"status"`
Frameworks []FrameworkSummary `json:"frameworks"`
ResourcesSeverityCounters SeverityCounters `json:"resourcesSeverityCounters,omitempty"`
ControlsSeverityCounters SeverityCounters `json:"controlsSeverityCounters,omitempty"`
StatusCounters StatusCounters `json:"ResourceCounters"` // Backward compatibility
Vulnerabilities VulnerabilitySummary `json:"vulnerabilities,omitempty"`
Score float32 `json:"score"`
ComplianceScore float32 `json:"complianceScore"`
}

// FrameworkSummary summary of scanning from a single framework perspective
Expand Down Expand Up @@ -77,3 +78,35 @@ type PostureCounters struct {
SkippedCounter int `json:"skipped"`
ExcludedCounter int `json:"excluded"` // Deprecated
}

type VulnerabilitySummary struct {
MapsSeverityToSummary MapsSeverityToSummary `json:"mapsSeverityToSummary"`
CVESummary []CVESummary `json:"CVEs"`
PackageScores PackageScores `json:"packageScores"`
Images []string `json:"images"`
}

type MapsSeverityToSummary map[string]*SeveritySummary

type SeveritySummary struct {
NumberOfCVEs int `json:"numberOfCVEs"`
NumberOfFixableCVEs int `json:"numberOfFixableCVEs"`
}

type CVESummary struct {
Severity string `json:"severity"`
ID string `json:"id"`
Package string `json:"package"`
Version string `json:"version"`
FixVersions []string `json:"fixVersions"`
FixedState string `json:"fixedState"`
}

type PackageScores map[string]*PackageSummary

type PackageSummary struct {
Name string `json:"name"`
Version string `json:"version"`
Score int `json:"score"`
MapSeverityToCVEsNumber map[string]int `json:"mapSeverityToCVEsNumber"`
}

0 comments on commit 5102318

Please sign in to comment.