cyclonedx

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package cyclonedx provides data model, decoder, and validator for cyclonedx reports

Index

Constants

View Source
const ConfigFieldName = "cyclonedx"

ConfigFieldName the field name in the config map

View Source
const ReportType = "CycloneDX Report"

ReportType in plain text

Variables

This section is empty.

Functions

func AllowListRule

func AllowListRule(vul cdx.Vulnerability, config Config) bool

AllowListRule for custom list

func DenyListRule

func DenyListRule(vuls []cdx.Vulnerability, config Config) error

DenyListRule for custom list

func NewValidator

func NewValidator() gcv.Validator[cdx.Vulnerability, Config]

NewValidator implementation of the generic validator

func ThresholdRule

func ThresholdRule(vuls []cdx.Vulnerability, config Config) error

ThresholdRule deny if X > vulnerabilities of Y Severity

Types

type Config

type Config struct {
	AllowList []ListItem `yaml:"allowList,omitempty" json:"allowList,omitempty"`
	DenyList  []ListItem `yaml:"denyList,omitempty" json:"denyList,omitempty"`
	Required  bool       `yaml:"required" json:"required"`
	Critical  int        `yaml:"critical"   json:"critical"`
	High      int        `yaml:"high"       json:"high"`
	Medium    int        `yaml:"medium"     json:"medium"`
	Low       int        `yaml:"low"        json:"low"`
	Info      int        `yaml:"info"       json:"info"`
	None      int        `yaml:"none"       json:"none"`
	Unknown   int        `yaml:"unknown"    json:"unknown"`
}

Config data model

type ListItem

type ListItem struct {
	ID     string `yaml:"id"     json:"id"`
	Reason string `yaml:"reason" json:"reason"`
}

ListItem for a specific allow/deny list record

type ReportDecoder

type ReportDecoder struct {
	bytes.Buffer
}

ReportDecoder Custom decoder to handle multiple report types

func NewReportDecoder

func NewReportDecoder() *ReportDecoder

NewReportDecoder ...

func (*ReportDecoder) Decode

func (d *ReportDecoder) Decode() (any, error)

Decode and check BOMFormat

func (*ReportDecoder) DecodeFrom

func (d *ReportDecoder) DecodeFrom(r io.Reader) (any, error)

DecodeFrom ...

func (*ReportDecoder) FileType

func (d *ReportDecoder) FileType() string

FileType in plain text

type ScanReport

type ScanReport cdx.BOM

ScanReport data model

func (*ScanReport) ShimComponentsAsVulnerabilities

func (r *ScanReport) ShimComponentsAsVulnerabilities() *ScanReport

ShimComponentsAsVulnerabilities modify the report to add compontents as vulnerabilities with no score

func (ScanReport) String

func (r ScanReport) String() string

String pretty formatted table

Jump to

Keyboard shortcuts

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