sbom

package
v2.8.1 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2023 License: Apache-2.0 Imports: 25 Imported by: 135

Documentation

Overview

Package sbom implements standardized SBoM tooling that allows multiple SBoM formats to be generated from the same scanning information.

Index

Constants

View Source
const (
	CycloneDXFormat = "application/vnd.cyclonedx+json"
	SPDXFormat      = "application/spdx+json"
	SyftFormat      = "application/vnd.syft+json"
)
View Source
const UnknownCPE = "cpe:2.3:-:-:-:-:-:-:-:-:-:-:-"

UnknownCPE is a Common Platform Enumeration (CPE) that uses the NA (Not applicable) logical operator for all components of its name. It is designed not to match with other CPEs, to avoid false positive CPE matches.

Variables

This section is empty.

Functions

This section is empty.

Types

type Format

type Format string

Format is the type declaration for the supported SBoM output formats.

func (Format) Extension

func (f Format) Extension() string

Extension outputs the expected file extension for a given Format.

type FormattedReader

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

FormattedReader outputs the SBoM in a specified format.

func NewFormattedReader

func NewFormattedReader(s SBOM, f Format) *FormattedReader

NewFormattedReader creates an instance of FormattedReader given an SBOM and Format.

func (*FormattedReader) Read

func (f *FormattedReader) Read(b []byte) (int, error)

Read implements the io.Reader interface to output the contents of the formatted SBoM.

type Formatter

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

Formatter implements the packit.SBOMFormatter interface.

func (Formatter) Formats

func (f Formatter) Formats() []packit.SBOMFormat

Formats returns a list of packit.SBOMFormat instances.

type SBOM

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

SBOM holds the internal representation of the generated software bill-of-materials. This type can be combined with a FormattedReader to output the SBoM in a number of file formats.

func Generate

func Generate(path string) (SBOM, error)

Generate returns a populated SBOM given a path to a directory to scan.

func GenerateFromDependency

func GenerateFromDependency(dependency postal.Dependency, path string) (SBOM, error)

nolint Ignore SA1019, informed usage of deprecated package

func NewSBOM added in v2.3.0

func NewSBOM(syft sbom.SBOM) SBOM

func (SBOM) InFormats

func (s SBOM) InFormats(mediaTypes ...string) (Formatter, error)

InFormats returns a Formatter containing mappings for the given Formats.

Directories

Path Synopsis
spdxlicense
Code generated by go generate; DO NOT EDIT.
Code generated by go generate; DO NOT EDIT.
version
Package version contains all build time metadata (version, build time, git commit, etc).
Package version contains all build time metadata (version, build time, git commit, etc).

Jump to

Keyboard shortcuts

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