Documentation
¶
Index ¶
- Variables
- func MarshalDepGraphJSON(g *sdk.Graph, target Target, buildOpts BuildOptions, encodeOpts EncodeOptions) ([]byte, error)
- func MarshalJSON(doc *Document, target Target, opts EncodeOptions) ([]byte, error)
- func ToGraph(doc *Document) (*sdk.Graph, error)
- func UnmarshalAutoJSON(data []byte) (*Document, Target, error)
- type BuildOptions
- type Component
- type Dependency
- type Digest
- type Document
- type EOL
- type EncodeOptions
- type License
- type Target
- type Vulnerability
Constants ¶
This section is empty.
Variables ¶
var ( ErrNilDocument = errors.New("sbom document is nil") ErrUnsupportedTarget = errors.New("unsupported sbom target") ErrUnsupportedFormat = errors.New("unsupported sbom format") ErrMalformedJSON = errors.New("malformed sbom json") )
var ErrNilGraph = errors.New("dependency graph is nil")
Functions ¶
func MarshalDepGraphJSON ¶
func MarshalDepGraphJSON(g *sdk.Graph, target Target, buildOpts BuildOptions, encodeOpts EncodeOptions) ([]byte, error)
MarshalDepGraphJSON converts a dependency graph directly into a target JSON SBOM.
func MarshalJSON ¶
func MarshalJSON(doc *Document, target Target, opts EncodeOptions) ([]byte, error)
MarshalJSON renders the intermediate SBOM document to a target JSON format.
Types ¶
type BuildOptions ¶
type BuildOptions struct {
DocumentName string
DocumentNS string
ToolName string
ToolNames []string
Created time.Time
RootComponentID string
SerialNumber string
// Registry, when non-nil, supplies matching-stage enrichment (licenses,
// vulnerabilities, CPEs, digests, EOL) resolved by PURL and folded onto
// each component during projection.
Registry *sdk.PackageRegistry
}
BuildOptions controls how a depgraph is projected into the intermediate SBOM model.
type Component ¶
type Component struct {
ID string
Name string
Version string
Scope string
PURL string
Ecosystem string
PackageManager string
Type string
Copyright string
Licenses []License
// Matching-stage enrichment (populated when BuildOptions.Registry is set).
CPEs []string
Digests []Digest
Vulnerabilities []Vulnerability
EOL *EOL
}
Component describes one package surfaced in the intermediate SBOM model.
type Dependency ¶
Dependency describes one package relationship list in the intermediate SBOM model.
type Document ¶
type Document struct {
Name string
Namespace string
Tool string
Tools []string
Created time.Time
SerialNumber string
Components []Component
Dependencies []Dependency
Roots []string
}
Document is an intermediate, format-agnostic SBOM representation.
func FromDepGraph ¶
func FromDepGraph(g *sdk.Graph, opts BuildOptions) (*Document, error)
FromDepGraph builds a neutral SBOM document from a dependency DAG.
func UnmarshalJSON ¶
UnmarshalJSON parses a target JSON SBOM into the intermediate document model.
func (*Document) CreatedOrNow ¶
CreatedOrNow returns the document timestamp in UTC, defaulting to the current time.
func (*Document) NameOrDefault ¶
NameOrDefault returns the document name or Bomly's default document name.
func (*Document) NamespaceOrDefault ¶
NamespaceOrDefault returns the document namespace or a generated Bomly namespace.
func (*Document) ToolNamesOrDefault ¶
ToolNamesOrDefault returns all producing tool labels, defaulting to Bomly's tool label.
func (*Document) ToolOrDefault ¶
ToolOrDefault returns the producing tool name or Bomly's default tool label.
type EncodeOptions ¶
type EncodeOptions struct {
Pretty bool
}
EncodeOptions controls JSON output formatting.
type Target ¶
type Target string
Target identifies an SBOM wire format target.
func DetectJSONTarget ¶
DetectJSONTarget identifies the supported SBOM JSON format represented by data.
type Vulnerability ¶
type Vulnerability struct {
ID string
Source string
Severity string
Score *float64
Vector string
Method string
CWEs []int
FixedVersions []string
Advisories []string
Description string
}
Vulnerability is a format-agnostic projection of one matching-stage advisory affecting a component. Encoders map it to the format's native representation (CycloneDX vulnerabilities, SPDX SECURITY external references).