reportsummary

package
v0.0.282 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2024 License: Apache-2.0 Imports: 6 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CVESummary added in v0.0.278

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 ControlCriteria

type ControlCriteria string
const (
	EControlCriteriaID   ControlCriteria = "ID"
	EControlCriteriaName ControlCriteria = "name" // DEPRECATED
)

type ControlSummaries

type ControlSummaries map[string]ControlSummary

func (*ControlSummaries) GetControl

func (controlSummaries *ControlSummaries) GetControl(criteria ControlCriteria, value string) IControlSummary

get control either by criteria = "ID" and value <controlID> or criteria = name and <controlName>

func (*ControlSummaries) GetIDs

func (controlSummaries *ControlSummaries) GetIDs() []string

=============== ControlSummaries

func (*ControlSummaries) ListControlsIDs

func (controlSummaries *ControlSummaries) ListControlsIDs(controls *helpersv1.AllLists) *helpersv1.AllLists

func (*ControlSummaries) ListResourcesIDs

func (controlSummaries *ControlSummaries) ListResourcesIDs(allList *helpersv1.AllLists) *helpersv1.AllLists

ListResourcesIDs list all resources IDs for all controls

If an optional pointer to an AllLists object is provided as a parameter, it will be used to store the results, avoiding unnecessary memory allocations. If the parameter is nil, a new AllLists object will be created and returned.

func (*ControlSummaries) NumberOfControls

func (controlSummaries *ControlSummaries) NumberOfControls() ICounters

might be redundant

type ControlSummary

type ControlSummary struct {
	StatusInfo        apis.StatusInfo          `json:"statusInfo,omitempty"`
	ControlID         string                   `json:"controlID"`
	Name              string                   `json:"name"`
	Status            apis.ScanningStatus      `json:"status"` // backward compatibility
	Description       string                   `json:"-"`
	Remediation       string                   `json:"-"`
	ResourceIDs       helpersv1.AllLists       `json:"resourceIDs"`
	StatusCounters    StatusCounters           `json:"ResourceCounters"` // Backward compatibility
	SubStatusCounters SubStatusCounters        `json:"subStatusCounters"`
	Score             float32                  `json:"score"`
	ComplianceScore   *float32                 `json:"complianceScore,omitempty"`
	ScoreFactor       float32                  `json:"scoreFactor"`
	Category          *reporthandling.Category `json:"category,omitempty"`
}

ControlSummary summary of scanning from a single control perspective

func (*ControlSummary) Append

func (controlSummary *ControlSummary) Append(status apis.IStatus, ids ...string)

Append increases the counter based on the status

func (*ControlSummary) CalculateStatus

func (controlSummary *ControlSummary) CalculateStatus()

func (*ControlSummary) GetCategory added in v0.0.261

func (controlSummary *ControlSummary) GetCategory() *reporthandling.Category

func (*ControlSummary) GetComplianceScore added in v0.0.246

func (controlSummary *ControlSummary) GetComplianceScore() float32

func (*ControlSummary) GetDescription

func (controlSummary *ControlSummary) GetDescription() string

GetDescription get control description

func (*ControlSummary) GetID

func (controlSummary *ControlSummary) GetID() string

GetID return control ID

func (*ControlSummary) GetName

func (controlSummary *ControlSummary) GetName() string

GetName return control name

func (*ControlSummary) GetRemediation

func (controlSummary *ControlSummary) GetRemediation() string

GetRemediation get control remediation

func (*ControlSummary) GetScore

func (controlSummary *ControlSummary) GetScore() float32

GetScore return control score

func (*ControlSummary) GetScoreFactor

func (controlSummary *ControlSummary) GetScoreFactor() float32

GetScoreFactor return control score

func (*ControlSummary) GetStatus

func (controlSummary *ControlSummary) GetStatus() apis.IStatus

GetStatus get the control status. returns an apis.StatusInfo object

func (*ControlSummary) GetSubCategory added in v0.0.261

func (controlSummary *ControlSummary) GetSubCategory() *reporthandling.SubCategory

func (*ControlSummary) GetSubStatus added in v0.0.227

func (controlSummary *ControlSummary) GetSubStatus() apis.ScanningSubStatus

GetSubStatus get the control sub status. returns an apis.StatusInfo object

func (*ControlSummary) ListResourcesIDs

func (controlSummary *ControlSummary) ListResourcesIDs(l *helpersv1.AllLists) *helpersv1.AllLists

=================================== Counters ============================================

func (*ControlSummary) NumberOfResources

func (controlSummary *ControlSummary) NumberOfResources() ICounters

Deprecated use 'ResourcesCounters' instead NumberOfResources get the status counters

func (*ControlSummary) SetStatus

func (controlSummary *ControlSummary) SetStatus(statusInfo *apis.StatusInfo)

func (*ControlSummary) SetSubStatus added in v0.0.227

func (controlSummary *ControlSummary) SetSubStatus(subStatus apis.ScanningSubStatus)

func (*ControlSummary) StatusesCounters added in v0.0.231

func (controlSummary *ControlSummary) StatusesCounters() (ICounters, ISubCounters)

NumberOfResources get the status counters

type FrameworkSummary

type FrameworkSummary struct {
	Controls        ControlSummaries    `json:"controls,omitempty"` // mapping of control - map[<control ID>]<control summary>
	Name            string              `json:"name"`               // framework name
	Status          apis.ScanningStatus `json:"status"`
	Version         string              `json:"version"`
	StatusCounters  StatusCounters      `json:"ResourceCounters"` // Backward compatibility
	Score           float32             `json:"score"`
	ComplianceScore float32             `json:"complianceScore"`
}

FrameworkSummary summary of scanning from a single framework perspective

func (*FrameworkSummary) CalculateStatus

func (frameworkSummary *FrameworkSummary) CalculateStatus()

SetStatus set the framework status based on the resource counters

func (*FrameworkSummary) GetComplianceScore added in v0.0.243

func (frameworkSummary *FrameworkSummary) GetComplianceScore() float32

GetComplianceScore returns framework ComplianceScore

func (*FrameworkSummary) GetControls

func (frameworkSummary *FrameworkSummary) GetControls() IControlsSummaries

Controls return the controls

func (*FrameworkSummary) GetName

func (frameworkSummary *FrameworkSummary) GetName() string

GetName return framework name

func (*FrameworkSummary) GetScore

func (frameworkSummary *FrameworkSummary) GetScore() float32

GetScore return framework score

func (*FrameworkSummary) GetStatus

func (frameworkSummary *FrameworkSummary) GetStatus() apis.IStatus

Status get the framework status. returns an apis.ScanningStatus object

func (*FrameworkSummary) Increase

func (frameworkSummary *FrameworkSummary) Increase(status apis.IStatus)

Increase increases the counter based on the status

func (*FrameworkSummary) ListControls

func (frameworkSummary *FrameworkSummary) ListControls() []IControlSummary

ListControls list all controls

func (*FrameworkSummary) ListControlsIDs

func (frameworkSummary *FrameworkSummary) ListControlsIDs(controls *helpersv1.AllLists) *helpersv1.AllLists

ListControlsIDs list all controls IDs in the framework

If an optional pointer to an AllLists object is provided as a parameter, it will be used to store the results, avoiding unnecessary memory allocations. If the parameter is nil, a new AllLists object will be created and returned.

func (*FrameworkSummary) ListControlsNames

func (frameworkSummary *FrameworkSummary) ListControlsNames(controls *helpersv1.AllLists) *helpersv1.AllLists

ListControlsNames list all framework names

If an optional pointer to an AllLists object is provided as a parameter, it will be used to store the results, avoiding unnecessary memory allocations. If the parameter is nil, a new AllLists object will be created and returned.

func (*FrameworkSummary) ListResourcesIDs

func (frameworkSummary *FrameworkSummary) ListResourcesIDs(l *helpersv1.AllLists) *helpersv1.AllLists

List resources IDs

If an optional pointer to an AllLists object is provided as a parameter, it will be used to store the results, avoiding unnecessary memory allocations. If the parameter is nil, a new AllLists object will be created and returned.

func (*FrameworkSummary) NumberOfControls

func (frameworkSummary *FrameworkSummary) NumberOfControls() ICounters

func (*FrameworkSummary) NumberOfResources

func (frameworkSummary *FrameworkSummary) NumberOfResources() ICounters

NumberOfExcluded get the number of excluded resources

type IBasicPostureReport

type IBasicPostureReport interface {
	GetCustomerGUID() string
	GetClusterName() string
	GetReportGUID() string
	GetJobID() string
	GetTimestamp() *time.Time
}

type IControlSummary

type IControlSummary interface {
	IPolicies
	GetScoreFactor() float32

	// GetID get control ID
	GetID() string

	// GetRemediation get control remediation
	GetRemediation() string

	// GetCategory get control category
	GetCategory() *reporthandling.Category

	// GetSubCategory get control sub category
	GetSubCategory() *reporthandling.SubCategory

	// GetDescription get control description
	GetDescription() string

	// Get SubStatus() get control sub status
	GetSubStatus() apis.ScanningSubStatus

	StatusesCounters() (ICounters, ISubCounters)
}

type IControlsSummaries

type IControlsSummaries interface {
	GetControl(criteria ControlCriteria, value string) IControlSummary

	NumberOfControls() ICounters
	ListControlsIDs(*helpersv1.AllLists) *helpersv1.AllLists
	ListResourcesIDs(*helpersv1.AllLists) *helpersv1.AllLists
}

type ICounters

type ICounters interface {
	Passed() int
	Skipped() int
	Failed() int
	Excluded() int // deprecated
	All() int
}

type IFrameworkSummary

type IFrameworkSummary interface {
	IPolicies
	ListControls() []IControlSummary
	NumberOfControls() ICounters
	GetComplianceScore() float32
}

type IPolicies

type IPolicies interface {
	GetStatus() apis.IStatus
	CalculateStatus()
	ListResourcesIDs(*helpersv1.AllLists) *helpersv1.AllLists

	// Counters
	NumberOfResources() ICounters

	// Score
	GetScore() float32

	// ComplianceScore
	GetComplianceScore() float32

	// Name
	GetName() string
}

type ISeverityCounters added in v0.0.190

type ISeverityCounters interface {
	NumberOfCriticalSeverity() int
	NumberOfHighSeverity() int
	NumberOfMediumSeverity() int
	NumberOfLowSeverity() int
	Increase(severity string, amount int)
}

type ISubCounters added in v0.0.231

type ISubCounters interface {
	All() int
	Ignored() int
}

type MapsSeverityToSummary added in v0.0.278

type MapsSeverityToSummary map[string]*SeveritySummary

type PackageScores added in v0.0.278

type PackageScores map[string]*PackageSummary

type PackageSummary added in v0.0.278

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

type PostureAttributes

type PostureAttributes struct {
	Attribute string   `json:"attributeName"`
	Values    []string `json:"values"`
}

type PostureCounters

type PostureCounters struct {
	PassedCounter   int `json:"passed"`
	FailedCounter   int `json:"failed"`
	SkippedCounter  int `json:"skipped"`
	ExcludedCounter int `json:"excluded"` // Deprecated
}

func (*PostureCounters) All

func (pcounter *PostureCounters) All() int

func (*PostureCounters) Excluded

func (pcounter *PostureCounters) Excluded() int

deprecated

func (*PostureCounters) Failed

func (pcounter *PostureCounters) Failed() int

Failed get the number of failed posture object

func (*PostureCounters) Increase

func (pcounter *PostureCounters) Increase(status apis.IStatus)

func (*PostureCounters) Passed

func (pcounter *PostureCounters) Passed() int

NumberOfPassed get the number of passed posture object

func (*PostureCounters) Skipped

func (pcounter *PostureCounters) Skipped() int

NumberOfSkipped get the number of skipped posture object

type SeverityCounters added in v0.0.190

type SeverityCounters struct {
	CriticalSeverityCounter int `json:"criticalSeverity"`
	HighSeverityCounter     int `json:"highSeverity"`
	MediumSeverityCounter   int `json:"mediumSeverity"`
	LowSeverityCounter      int `json:"lowSeverity"`
}

func (*SeverityCounters) Increase added in v0.0.191

func (sc *SeverityCounters) Increase(severity string, amount int)

Increase increments the counter of a given severity by a given amount

func (*SeverityCounters) NumberOfCriticalSeverity added in v0.0.203

func (sc *SeverityCounters) NumberOfCriticalSeverity() int

func (*SeverityCounters) NumberOfHighSeverity added in v0.0.203

func (sc *SeverityCounters) NumberOfHighSeverity() int

func (*SeverityCounters) NumberOfLowSeverity added in v0.0.203

func (sc *SeverityCounters) NumberOfLowSeverity() int

func (*SeverityCounters) NumberOfMediumSeverity added in v0.0.203

func (sc *SeverityCounters) NumberOfMediumSeverity() int

type SeveritySummary added in v0.0.278

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

type StatusCounters added in v0.0.231

type StatusCounters struct {
	PassedResources   int `json:"passedResources"`
	FailedResources   int `json:"failedResources"`
	SkippedResources  int `json:"skippedResources"`
	ExcludedResources int `json:"excludedResources"` // Deprecated
}

func (*StatusCounters) All added in v0.0.231

func (resourceCounters *StatusCounters) All() int

NumberOfAll get the number of all resources

func (*StatusCounters) Excluded added in v0.0.231

func (resourceCounters *StatusCounters) Excluded() int

deprecated

func (*StatusCounters) Failed added in v0.0.231

func (resourceCounters *StatusCounters) Failed() int

NumberOfFailed get the number of failed resources

func (*StatusCounters) Increase added in v0.0.231

func (resourceCounters *StatusCounters) Increase(status apis.IStatus)

Increase increases the counter based on the status

func (*StatusCounters) Passed added in v0.0.231

func (resourceCounters *StatusCounters) Passed() int

NumberOfPassed get the number of passed resources

func (*StatusCounters) Set added in v0.0.231

func (resourceCounters *StatusCounters) Set(allLists *helpersv1.AllLists)

NumberOfExcluded get the number of excluded resources

func (*StatusCounters) Skipped added in v0.0.231

func (resourceCounters *StatusCounters) Skipped() int

NumberOfSkipped get the number of skipped resources

type SubStatusCounters added in v0.0.231

type SubStatusCounters struct {
	IgnoredResources int `json:"ignoredResources"`
}

func (*SubStatusCounters) All added in v0.0.231

func (subStatusCounters *SubStatusCounters) All() int

func (*SubStatusCounters) Ignored added in v0.0.231

func (subStatusCounters *SubStatusCounters) Ignored() int

func (*SubStatusCounters) Increase added in v0.0.231

func (subStatusCounters *SubStatusCounters) Increase(status apis.IStatus)

Increase increases the counter based on the status

type SummaryDetails

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
	Vulnerabilities           VulnerabilitySummary `json:"vulnerabilities,omitempty"`
	Score                     float32              `json:"score"`
	ComplianceScore           float32              `json:"complianceScore"`
}

SummaryDetails detailed summary of the scanning. will contain versions, counters, etc.

func MockSummaryDetails

func MockSummaryDetails() *SummaryDetails

func (*SummaryDetails) AppendResourceResult

func (summaryDetails *SummaryDetails) AppendResourceResult(resourceResult *resourcesresults.Result)

AppendResourceResult appends the given resource result to the summary

Updates any necessary info accordingly

func (*SummaryDetails) CalculateStatus

func (summaryDetails *SummaryDetails) CalculateStatus()

SetStatus set the framework status based on the resource counters

func (*SummaryDetails) ControlName

func (summaryDetails *SummaryDetails) ControlName(controlID string) string

================================================================================

func (*SummaryDetails) GetControlsSeverityCounters added in v0.0.203

func (summaryDetails *SummaryDetails) GetControlsSeverityCounters() ISeverityCounters

GetResourcesSeverityCounters get the resources severity counters

func (*SummaryDetails) GetResourcesSeverityCounters added in v0.0.190

func (summaryDetails *SummaryDetails) GetResourcesSeverityCounters() ISeverityCounters

GetResourcesSeverityCounters get the resources severity counters

func (*SummaryDetails) GetScore

func (summaryDetails *SummaryDetails) GetScore() float32

GetScore return score

func (*SummaryDetails) GetStatus

func (summaryDetails *SummaryDetails) GetStatus() *helpersv1.Status

Status get the scan status. returns an apis.ScanningStatus object

func (*SummaryDetails) Increase

func (summaryDetails *SummaryDetails) Increase(status apis.IStatus)

Increase increases the counter based on the status

func (*SummaryDetails) InitResourcesSummary

func (summaryDetails *SummaryDetails) InitResourcesSummary(controlInfoMap map[string]apis.StatusInfo)

InitResourcesSummary must run this AFTER initializing the controls

func (*SummaryDetails) ListControls

func (summaryDetails *SummaryDetails) ListControls() []IControlSummary

ListControls list all controls

func (*SummaryDetails) ListControlsIDs

func (summaryDetails *SummaryDetails) ListControlsIDs() *helpersv1.AllLists

func (*SummaryDetails) ListControlsNames

func (summaryDetails *SummaryDetails) ListControlsNames() *helpersv1.AllLists

ListControlsNames list all framework names

func (*SummaryDetails) ListFrameworks

func (summaryDetails *SummaryDetails) ListFrameworks() []IFrameworkSummary

ListFrameworks list all frameworks

func (*SummaryDetails) ListFrameworksNames

func (summaryDetails *SummaryDetails) ListFrameworksNames() *helpersv1.AllLists

ListFrameworksNames list all framework names

func (*SummaryDetails) ListResourcesIDs

func (summaryDetails *SummaryDetails) ListResourcesIDs(l *helpersv1.AllLists) *helpersv1.AllLists

ListResourcesIDs list all resources IDs

If an optional pointer to an AllLists object is provided as a parameter, it will be used to store the results, avoiding unnecessary memory allocations. If the parameter is nil, a new AllLists object will be created and returned.

func (*SummaryDetails) NumberOfControls

func (summaryDetails *SummaryDetails) NumberOfControls() ICounters

NumberOfControls get number of controls

func (*SummaryDetails) NumberOfResources

func (summaryDetails *SummaryDetails) NumberOfResources() ICounters

NumberOfExcluded get the number of excluded resources

type VulnerabilitySummary added in v0.0.278

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

Jump to

Keyboard shortcuts

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