bom

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package bom implements consuming Red Hat's java-flavored BOMs.

Index

Constants

View Source
const MaxDocument = 64 << 20

MaxDocument is the most a compressed CycloneDX document may expand to. Jar members use the same limit.

Variables

View Source
var (
	// ErrBadFormat is a sentinel error for Red Hat-flavor requirement checks.
	ErrBadFormat = errors.New("java/bom: bad format")

	// ErrTooLarge is returned when a document exceeds [MaxDocument].
	ErrTooLarge = errors.New("java/bom: document exceeds size limit")

	// ErrNoProduct is returned when a document has no product CPE on an excluded
	// framework component or on the root component. Callers should ignore the
	// document and continue scanning.
	ErrNoProduct = errors.New("java/bom: no product CPE")
)
View Source
var (
	HashSHA1   = unique.Make(`sha1`)
	HashSHA256 = unique.Make(`sha256`)
)

Known hash kinds.

Functions

func FormatFromName

func FormatFromName(name string) (cyclonedx.BOMFileFormat, error)

FormatFromName reports the encoding named by a CycloneDX filename. A trailing ".gz" is ignored.

func LoadCDX

LoadCDX loads a Red Hat-Java-flavored CycloneDX SBoM in the encoding named by format. A compressed document is decompressed before parsing, and that expansion is limited to MaxDocument.

func PopulatePackage

func PopulatePackage(pkg *claircore.Package, bp Package, sbomFile string) error

PopulatePackage fills pkg from an SBOM component.

func ReadMax

func ReadMax(r io.Reader) ([]byte, error)

ReadMax reads r until EOF or one byte past MaxDocument. More than MaxDocument bytes returns ErrTooLarge.

Types

type Package

type Package struct {
	CPEs     []cpe.WFN
	PURL     packageurl.PackageURL
	Hashes   map[unique.Handle[string]][]byte
	Location string
}

Package is an extracted purl and the product CPEs that provide it. CPEs is empty when the purl is part of the application but no product provides it.

Jump to

Keyboard shortcuts

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