sbom

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: Apache-2.0 Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sbom writes a CycloneDX 1.6 bill of materials from one scan and its map. Facts and map in, document out: no file, network or clock access. The serial number comes from the facts file's hash and the timestamp from the commit, so the same scan gives the same bytes.

What it lists: per service, the dependencies the attach rule puts on it, the transitive dependencies its manifest folders reach (from lockfiles), and the images it runs or builds from. What it does not: the contents of those images (OS packages), which Cernly never opens; each image says so in a property. See https://cernly.dev/how/sbom/.

Index

Constants

View Source
const SpecVersion = "1.6"

Variables

This section is empty.

Functions

func Exact

func Exact(v string) bool

Exact reports a version that names one release, not a range or a spec.

func PURL

func PURL(eco, name, version string, exact bool) string

PURL is the package URL of a dependency; the version only when exact.

func StackServices

func StackServices(s *fact.Scan, m *rules.Map, stack string) []string

StackServices lists the services the map knows on a stack, by the stack attribute of their service facts.

Types

type BOM

type BOM struct {
	BOMFormat    string       `json:"bomFormat"`
	SpecVersion  string       `json:"specVersion"`
	SerialNumber string       `json:"serialNumber"`
	Version      int          `json:"version"`
	Metadata     Metadata     `json:"metadata"`
	Components   []Component  `json:"components"`
	Dependencies []Dependency `json:"dependencies"`
}

func Build

func Build(s *fact.Scan, m *rules.Map, service, extractor string) (*BOM, error)

Build writes the BOM for the whole repo, or for one service (its key) when service is set. extractor is the version of the binary that writes it.

func BuildScope

func BuildScope(s *fact.Scan, m *rules.Map, sc Scope, extractor string) (*BOM, error)

BuildScope writes the BOM for a scope. A stack's BOM lists its services only, and records the stack's role from the map.

type Component

type Component struct {
	Type       string     `json:"type"`
	BOMRef     string     `json:"bom-ref,omitempty"`
	Name       string     `json:"name"`
	Version    string     `json:"version,omitempty"`
	Scope      string     `json:"scope,omitempty"`
	PURL       string     `json:"purl,omitempty"`
	Licenses   []License  `json:"licenses,omitempty"`
	Properties []Property `json:"properties,omitempty"`
}

type Dependency

type Dependency struct {
	Ref       string   `json:"ref"`
	DependsOn []string `json:"dependsOn"`
}

type License

type License struct {
	Expression string `json:"expression"`
}

type Metadata

type Metadata struct {
	Timestamp  string     `json:"timestamp"`
	Tools      Tools      `json:"tools"`
	Component  Component  `json:"component"`
	Properties []Property `json:"properties"`
}

type Property

type Property struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type Scope

type Scope struct {
	Service string
	Stack   string
}

Scope narrows a BOM: one service, or the services of one stack (its key, stack:compose:<name>). Neither: the whole repo.

type Tools

type Tools struct {
	Components []Component `json:"components"`
}

Jump to

Keyboard shortcuts

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