reports

package
v0.0.0-...-8075232 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateSafeFileName

func CreateSafeFileName(input string) string

CreateSafeFileName creates a safe filename from a string by removing special characters

func FormatMarkdownTable

func FormatMarkdownTable(headers []string, rows [][]string) string

Common table formatting functions

func FormatSection

func FormatSection(title string, content string) string

Common report section formatting

func SaveToFile

func SaveToFile(report string, filename string) error

SaveToFile saves the report to a file in the working-files directory

func SeverityValue

func SeverityValue(severity string) int

Common severity-related functions

Types

type CVE

type CVE struct {
	ID             string   `json:"id"`
	Severity       string   `json:"severity"`
	AffectedImages []string `json:"affected_images,omitempty"`
}

func ConvertToJSONCVEs

func ConvertToJSONCVEs(cves map[string]map[string]Vulnerability) []CVE

ConvertToJSONCVEs now accepts a map of Vulnerability interface

type ImageChange

type ImageChange struct {
	Name       string `json:"name"`
	Status     string `json:"status"`
	BeforeRepo string `json:"before_repo,omitempty"`
	AfterRepo  string `json:"after_repo,omitempty"`
	BeforeTag  string `json:"before_tag,omitempty"`
	AfterTag   string `json:"after_tag,omitempty"`
}

type JSONReport

type JSONReport struct {
	ReportType    string      `json:"report_type"`
	Comparison    interface{} `json:"comparison"`
	Summary       Summary     `json:"summary"`
	AddedCVEs     []CVE       `json:"added_cves"`
	RemovedCVEs   []CVE       `json:"removed_cves"`
	UnchangedCVEs []CVE       `json:"unchanged_cves"`
}

type SeverityCount

type SeverityCount struct {
	Severity   string `json:"severity"`
	Current    int    `json:"current_count"`
	Previous   int    `json:"previous_count"`
	Difference int    `json:"difference"`
}

type SortableCVE

type SortableCVE struct {
	ID       string
	Severity string
	Images   []string
}

Update type definitions to be exported (uppercase)

type SortableCVEList

type SortableCVEList []SortableCVE

func (SortableCVEList) Len

func (s SortableCVEList) Len() int

func (SortableCVEList) Less

func (s SortableCVEList) Less(i, j int) bool

func (SortableCVEList) Swap

func (s SortableCVEList) Swap(i, j int)

type Summary

type Summary struct {
	SeverityCounts []SeverityCount `json:"severity_counts"`
	ImageChanges   []ImageChange   `json:"image_changes,omitempty"`
}

type Vulnerability

type Vulnerability interface {
	GetID() string
	GetSeverity() string
}

Vulnerability interface that both packages' vulnerability types must implement

Jump to

Keyboard shortcuts

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