lib

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: MPL-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package lib contains core functionality to load Software Bill of Materials and contains common functions

Package lib contains core functionality to load Software Bill of Materials and contains common functions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdjustSummary added in v0.3.0

func AdjustSummary(severity string, summary *models.Summary)

AdjustSummary takes a severity string and a pointer to a Summary struct as input, and increments the corresponding severity count in the struct.

func FlattenVulnerabilities added in v0.4.7

func FlattenVulnerabilities(packages []models.Package) []models.Vulnerability

FlattenVulnerabilities flattens all vulnerabilities for a package

func GenerateFilename added in v0.5.0

func GenerateFilename() string

generateFilename generates a unique filename based on the current timestamp in the format "2006-01-02 15:04:05" and replaces certain characters to create a valid filename. The resulting filename is a combination of the timestamp and a fixed suffix. TODO: Need to make this generic. It's only being used for HTML Renderers

func MarkdownToHTML added in v0.5.0

func MarkdownToHTML(results models.Results)

markdownToHTML converts the Markdown descriptions of vulnerabilities in the given results to HTML. It uses the Blackfriday library to perform the conversion and sanitizes the HTML using Bluemonday.

func ParseSeverity added in v0.4.5

func ParseSeverity(severity string) int

ParseSeverity takes a severity string and returns an int

func Rating added in v0.3.0

func Rating(score float64) string

Rating takes a CVSS score as input and returns a rating string based on the score

func UniqueFieldValues added in v0.4.8

func UniqueFieldValues[T any](input []T, fieldName string) []interface{}

UniqueFieldValues returns a slice of unique field values from a slice of structs given a field name

Types

type Loader added in v0.4.8

type Loader struct {
	Afs *afero.Afero
}

func (*Loader) Load added in v0.4.8

func (l *Loader) Load(args []string) (scanned []models.ScannedFile, purls []string, licenses []string, err error)

Load retrieves a slice of Purls from various types of SBOMs

func (*Loader) LoadIgnore added in v0.4.8

func (l *Loader) LoadIgnore(ignoreFile string) (cves []string, err error)

LoadIgnore loads a list of CVEs entered one on each line from the filename

type Scanner added in v0.4.8

type Scanner struct {
	SeveritySummary models.Summary
	Credentials     models.Credentials
	Renderer        models.Renderer
	Provider        models.Provider
	Enrichment      []string
	IgnoreFile      string
	Severity        string
	ExitCode        bool
	Output          string
	ProviderName    string
	Version         string
	Afs             *afero.Afero
}

Scanner represents a vulnerability scanner.

func (*Scanner) Scan added in v0.4.8

func (s *Scanner) Scan(args []string) (exitCode int, err error)

Scan performs the vulnerability scan.

Jump to

Keyboard shortcuts

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