gatecheck

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrValidationFailure = errors.New("Validation Failure")

Functions

func AppendToBundle added in v0.4.0

func AppendToBundle(bundleRWS io.ReadWriteSeeker, src io.Reader, label string, tags []string) error

AppendToBundle adds a file to an existing bundle

If the bundle doesn't exist, use CreateBundle

func CreateBundle added in v0.4.0

func CreateBundle(dstBundle io.Writer, src io.Reader, label string, tags []string) error

CreateBundle create a new bundle with a file

If the bundle already exist, use CreateBundle. this function will completely overwrite an existing bundle

func DownloadEPSS added in v0.4.0

func DownloadEPSS(w io.Writer, optionFuncs ...optionFunc) error

func DownloadKEV added in v0.4.0

func DownloadKEV(w io.Writer, optionFuncs ...optionFunc) error

func EncodeConfigTo added in v0.4.0

func EncodeConfigTo(w io.Writer, config *Config, format string) error

func List added in v0.4.0

func List(dst io.Writer, src io.Reader, inputFilename string, options ...ListOptionFunc) error

func ListCyclonedx added in v0.4.0

func ListCyclonedx(dst io.Writer, src io.Reader) (*tablewriter.Table, error)

func ListGrypeReport added in v0.4.0

func ListGrypeReport(dst io.Writer, src io.Reader) (*tablewriter.Table, error)

func ListSemgrep added in v0.4.0

func ListSemgrep(dst io.Writer, src io.Reader) (*tablewriter.Table, error)

func LoadCatalogAndData added in v0.4.0

func LoadCatalogAndData(config *Config, catalog *kev.Catalog, epssData *epss.Data, options *fetchOptions) error

func RemoveFromBundle added in v0.4.0

func RemoveFromBundle(bundleRWS io.ReadWriteSeeker, label string) error

RemoveFromBundle removes a file from an existing bundle

func Validate added in v0.4.0

func Validate(config *Config, reportSrc io.Reader, targetfilename string, optionFuncs ...optionFunc) error

Validate against config thresholds

func WithDisplayFormat added in v0.6.1

func WithDisplayFormat(displayFormat string) func(*listOptions)

func WithEPSS added in v0.7.0

func WithEPSS(epssFile *os.File, epssURL string) (func(*listOptions), error)

func WithEPSSFile added in v0.4.0

func WithEPSSFile(r io.Reader) optionFunc

func WithEPSSURL added in v0.4.0

func WithEPSSURL(url string) optionFunc

WithEPSSURL optionFunc that sets the fetch URL for EPSS data

Will use the default option if "" is passed

func WithKEVFile added in v0.4.0

func WithKEVFile(r io.Reader) optionFunc

func WithKEVURL added in v0.4.0

func WithKEVURL(url string) optionFunc

WithKEVURL optionFunc that sets the fetch URL for KEV data

Will use the default option if "" is passed

func WriteDefaultConfig added in v0.4.0

func WriteDefaultConfig(w io.Writer, format string) error

Types

type ApplicationMetadata added in v0.4.0

type ApplicationMetadata struct {
	CLIVersion     string
	GitCommit      string
	BuildDate      string
	GitDescription string
	Platform       string
	GoVersion      string
	Compiler       string
}

ApplicationMetadata ...

func (ApplicationMetadata) String added in v0.4.0

func (m ApplicationMetadata) String() string

func (ApplicationMetadata) WriteTo added in v0.4.0

func (m ApplicationMetadata) WriteTo(w io.Writer) (int64, error)

type Config

type Config struct {
	Version   string               `json:"version"   toml:"version"   yaml:"version"`
	Metadata  configMetadata       `json:"metadata"  toml:"metadata"  yaml:"metadata"`
	Grype     reportWithCVEs       `json:"grype"     toml:"grype"     yaml:"grype"`
	Cyclonedx reportWithCVEs       `json:"cyclonedx" toml:"cyclonedx" yaml:"cyclonedx"`
	Semgrep   configSemgrepReport  `json:"semgrep"   toml:"semgrep"   yaml:"semgrep"`
	Gitleaks  configGitleaksReport `json:"gitleaks"  toml:"gitleaks"  yaml:"gitleaks"`
}

Config is used to set limits and allowances during validation

The report can be encoded/decoded into json, yaml, or toml Metadata fields are intended for arbitrary data and shouldn't conflict with rule validation

func NewDefaultConfig added in v0.4.0

func NewDefaultConfig() *Config

func (*Config) String added in v0.4.0

func (c *Config) String() string

type ConfigDecoder added in v0.7.0

type ConfigDecoder struct {
	// contains filtered or unexported fields
}

func NewConfigDecoder added in v0.7.0

func NewConfigDecoder(filename string) *ConfigDecoder

func (*ConfigDecoder) Decode added in v0.7.0

func (d *ConfigDecoder) Decode(config *Config) error

type ConfigEncoder added in v0.7.0

type ConfigEncoder struct {
	// contains filtered or unexported fields
}

func NewConfigEncoder added in v0.7.0

func NewConfigEncoder(w io.Writer, ext string) *ConfigEncoder

func (*ConfigEncoder) Encode added in v0.7.0

func (e *ConfigEncoder) Encode(config *Config) error

type ListOptionFunc added in v0.7.0

type ListOptionFunc func(*listOptions)

Jump to

Keyboard shortcuts

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