sbom

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: MIT Imports: 20 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 generates SBOM documents (CycloneDX, SPDX Lite) from a neutral inventory of components. It depends on the CycloneDX and SPDX libraries — never on the scan SDK — so it can be reused by the CLI and by external consumers alike. Adapters that build an Inventory from a scan result live in the scansource subpackage.

Index

Constants

View Source
const (
	AIRulesRemote = "remote"
	AIRulesLocal  = "local"
)

Ruleset sources.

View Source
const (
	AIReachable     = "reachable"
	AIUnreachable   = "unreachable"
	AIUnknown       = "unknown"
	AINotApplicable = "not_applicable"
)

Reachability verdicts of an AI usage finding.

View Source
const (
	InputRaw       = "raw"
	InputCycloneDX = "cyclonedx"
	InputSPDX      = "spdx"
)

Input formats Parse recognizes.

View Source
const AIUsageFormat = "scanoss-ai-usage/1"

AIUsageFormat identifies the ai_usage section's shape.

View Source
const RawSchemaVersion = "2.2"

RawSchemaVersion is the version of the raw inventory document. Bump the major on a breaking shape change and the minor on an additive one, so a reader can tell which documents it has to handle differently from which merely carry more than it knows about.

2.1 added the `dependencies` roots, `local` on a component and the `transitive` match type. 2.2 added the optional `ai_usage` section.

View Source
const VerdictFalsePositive = "false_positive"

VerdictFalsePositive is the SnippetClassification verdict for a match whose reported ranges do not correspond.

Variables

This section is empty.

Functions

func Convert added in v0.21.0

func Convert(data []byte, format Format, opts ...Option) (string, error)

Convert reads an SBOM as Parse does and writes it in format. A raw document's project and AI usage are kept; data the target cannot represent is dropped with a warning.

func Generate

func Generate(inv Inventory, format Format, opts ...Option) (string, error)

Generate renders the inventory to the requested SBOM format. It is the single entry point: an unknown format returns an error; an empty inventory yields a valid, empty document.

Types

type AIDetails added in v0.21.0

type AIDetails struct {
	Type            string
	Provider        string
	API             string
	Model           string
	ModelExpr       string
	ModelResolution string
	Risk            string
	OWASP           string
	CWE             []string
	MCP             *AIMCPServer
	Verdict         *AIMCPVerdict
	Extra           map[string]any
}

AIDetails is what a finding reports: the provider and model of a call, its risk, or an MCP server and its verdict. Keys a rule adds that this version does not know are kept in Extra.

func (AIDetails) MarshalJSON added in v0.21.0

func (d AIDetails) MarshalJSON() ([]byte, error)

MarshalJSON writes the ai block with its keys sorted, Extra's among them, and empty ones left out.

func (*AIDetails) UnmarshalJSON added in v0.21.0

func (d *AIDetails) UnmarshalJSON(data []byte) error

UnmarshalJSON reads an ai block, keeping the keys it does not know in Extra. A single cwe is read as a list of one.

type AIEntryPoint added in v0.21.0

type AIEntryPoint struct {
	File  string `json:"file"`
	Line  int    `json:"line"`
	Kind  string `json:"kind"`
	Route string `json:"route,omitempty"`
}

AIEntryPoint is where a reachable finding's call chain starts.

type AIMCPServer added in v0.21.0

type AIMCPServer struct {
	Launcher  string `json:"launcher,omitempty"`
	Name      string `json:"name"`
	Package   string `json:"package,omitempty"`
	Pinned    bool   `json:"pinned"`
	Transport string `json:"transport"`
	URL       string `json:"url,omitempty"`
}

AIMCPServer is an MCP server a client config launches or connects to.

type AIMCPVerdict added in v0.21.0

type AIMCPVerdict struct {
	IDs    []string `json:"ids,omitempty"`
	Source string   `json:"source"`
	Status string   `json:"status"`
}

AIMCPVerdict is the vulnerabilities API's verdict on the package an MCP server launches.

type AIMetadata added in v0.21.0

type AIMetadata struct {
	AI AIDetails `json:"ai"`
}

AIMetadata is a finding's metadata: the ai block.

type AIRuleset added in v0.21.0

type AIRuleset struct {
	Source  string `json:"source"`
	Name    string `json:"name,omitempty"`
	Version string `json:"version,omitempty"`
	// ChecksumSHA256 is the release payload's hash for a remote ruleset, the same for every
	// tenant, and a hash of the rule files for a local one.
	ChecksumSHA256 string          `json:"checksum_sha256,omitempty"`
	Lease          *AIRulesetLease `json:"lease,omitempty"`
}

AIRuleset names one ruleset a scan ran, as crypto-finder reports it: one the API served (source "remote", with its name, version and lease) or a --rules-dir ("local").

type AIRulesetLease added in v0.21.0

type AIRulesetLease struct {
	ExpiresAt    time.Time `json:"expires_at"`
	SigningKeyID string    `json:"signing_key_id"`
}

AIRulesetLease is the signed lease a remote ruleset was served with. It names neither the key's owner nor the tenant.

type AIUsage added in v0.21.0

type AIUsage struct {
	Format string `json:"format"`
	// Rules are the rulesets the findings come from.
	Rules []AIRuleset `json:"rules"`
	// Reachability is "enabled" when each finding carries a call-graph verdict, else "disabled".
	Reachability string           `json:"reachability"`
	Summary      AIUsageSummary   `json:"summary"`
	Findings     []AIUsageFinding `json:"findings"`
}

AIUsage is the ai_usage section of a raw document: the AI usage a scan found in source code.

type AIUsageFinding added in v0.21.0

type AIUsageFinding struct {
	RuleID        string        `json:"rule_id"`
	Category      string        `json:"category"`
	Tier          string        `json:"tier"`
	File          string        `json:"file"`
	Line          int           `json:"line"`
	Reachability  string        `json:"reachability"`
	EntryPoint    *AIEntryPoint `json:"entry_point,omitempty"`
	FlowTruncated bool          `json:"flow_truncated,omitempty"`
	Metadata      AIMetadata    `json:"metadata"`
}

AIUsageFinding is one rule reported at one line. Metadata holds the rule's ai block, filled from the matched call.

type AIUsageSummary added in v0.21.0

type AIUsageSummary struct {
	Findings   int            `json:"findings"`
	ByCategory map[string]int `json:"by_category"`
	ByRisk     map[string]int `json:"by_risk"`
}

AIUsageSummary counts the findings by category and by risk.

type Component

type Component struct {
	Purl             string            `json:"purl"`                        // canonical PURL (identity), e.g. "pkg:github/scanoss/engine"
	Scope            ComponentScope    `json:"scope,omitempty"`             // detected (from the scan) | declared (from a manifest); "" == detected
	Identified       bool              `json:"identified,omitempty"`        // a bom.identify rule claimed this component for at least one of its files (see FileEvidence.Identified for which)
	Local            bool              `json:"local,omitempty"`             // the project's own package (a workspace member, a path or link dependency), not a third-party one
	AliasPurls       []string          `json:"alias_purls,omitempty"`       // additional PURLs identifying the same component (beyond Purl)
	Vendor           string            `json:"vendor,omitempty"`            // supplier / namespace
	Name             string            `json:"name,omitempty"`              // component name
	Version          string            `json:"version,omitempty"`           // resolved version; "" renders as "NOASSERTION"
	URL              string            `json:"url,omitempty"`               // homepage / source URL ("" => no externalReference)
	URLHash          string            `json:"url_hash,omitempty"`          // SCANOSS url_hash (SPDX package checksum)
	Rank             int               `json:"rank,omitempty"`              // engine match ordering; lower is a stronger match
	ReleaseDate      string            `json:"release_date,omitempty"`      // release date of Version (YYYY-MM-DD)
	ArtifactName     string            `json:"artifact_name,omitempty"`     // release artifact holding this version, e.g. "v0.38.0.zip"
	Licenses         []License         `json:"licenses,omitempty"`          // declared and/or concluded licenses (licenses layer)
	Cryptography     []CryptoAlgorithm `json:"cryptography,omitempty"`      // cryptographic algorithms detected (crypto layer)
	Geoprovenance    []GeoLocation     `json:"geoprovenance,omitempty"`     // contributor geographic origin (geo layer)
	DownloadLocation string            `json:"download_location,omitempty"` // download location (defaults to URL)
	Evidence         []FileEvidence    `json:"evidence,omitempty"`          // where the component came from: scanned files that matched, or the manifest that declared it
}

Component is one component in the inventory: identity, scope, scan evidence, and the per-component enrichment layers attached inline. Vulnerabilities are not stored here — they are the Inventory's flat top-level list, joined back by PURL.

func (Component) AllPurls

func (c Component) AllPurls() []string

AllPurls returns the canonical Purl followed by any AliasPurls.

func (Component) DisplayName added in v0.4.0

func (c Component) DisplayName() string

DisplayName is the component's name for an SBOM package entry.

A Go module's name is its full module path, whatever the scan called it: scanners such as Grype look Go vulnerabilities up by that name, so "github.com/spf13/cobra" shortened to "cobra" matches nothing.

Otherwise detected components carry Name from the scan result; declared ones (sourced from a manifest) carry only a PURL, so the name is taken from its last segment — "pkg:npm/lodash" yields "lodash". Falling back to the whole PURL would put a PURL in a field that consumers render as a package name.

func (Component) IsDeclared

func (c Component) IsDeclared() bool

IsDeclared reports whether the component is a declared dependency rather than a scan-detected match. The zero-value scope counts as detected.

func (Component) Ref added in v0.12.0

func (c Component) Ref() string

Ref is the component's identifier in a dependency edge and in the SBOM formats (the CycloneDX bom-ref): its PURL with the version appended, or the bare PURL when it has none.

type ComponentScope

type ComponentScope string

ComponentScope records how a component entered the inventory.

const (
	// ScopeDetected marks a component found by the scan (an OSS match). The zero value is
	// treated as detected.
	ScopeDetected ComponentScope = "detected"
	// ScopeDeclared marks a component declared in a dependency manifest.
	ScopeDeclared ComponentScope = "declared"
)

type CryptoAlgorithm

type CryptoAlgorithm struct {
	Algorithm string `json:"algorithm"`
	Strength  string `json:"strength,omitempty"`
}

CryptoAlgorithm is a cryptographic algorithm detected in a component (crypto layer).

type DependencyEdge added in v0.12.0

type DependencyEdge struct {
	From string `json:"from"`
	To   string `json:"to"`
}

DependencyEdge says that From depends on To.

type DependencyRoot added in v0.12.0

type DependencyRoot struct {
	Manifest  string           `json:"manifest"` // slash path of the manifest, relative to the project
	Lockfile  string           `json:"lockfile"` // slash path of the lockfile it was resolved from
	Ecosystem string           `json:"ecosystem"`
	Status    GraphStatus      `json:"status"`
	Reason    string           `json:"reason,omitempty"`
	Detail    string           `json:"detail,omitempty"`
	DevKnown  bool             `json:"dev_known"` // the manifests said which dependencies are dev; false means every member is kept as runtime
	Direct    []string         `json:"direct"`    // refs of the components the manifest declares, sorted
	Edges     []DependencyEdge `json:"edges"`     // From depends on To; both ends are component refs
}

DependencyRoot is one manifest whose dependency graph was resolved from a lockfile, with dev members already left out. Direct lists the components the manifest declares as this root's lockfile resolved them; a manifest resolved by two lockfiles is two roots, each with its own versions, which evidence alone cannot tell apart since it names only the manifest. Edges run between component refs (see Component.Ref).

func (DependencyRoot) Ref added in v0.12.0

func (r DependencyRoot) Ref() string

Ref identifies the root in the SBOM formats. A manifest can be resolved by more than one lockfile (package-lock.json and yarn.lock side by side), so the lockfile is part of it.

type Document added in v0.21.0

type Document struct {
	// Format is the input's format: InputRaw, InputCycloneDX or InputSPDX.
	Format    string
	Inventory Inventory
	Project   string
	AIUsage   *AIUsage
}

Document is an SBOM Parse read: its inventory and, from a raw document, the project it names and its AI usage.

func Parse added in v0.21.0

func Parse(data []byte) (Document, error)

Parse reads a scanoss raw document, a CycloneDX or an SPDX document, telling them apart by their content: CycloneDX and SPDX by their markers, anything else as a raw document (ParseRaw).

type FileEvidence

type FileEvidence struct {
	Path            string      `json:"path"`                        // occurrence location: scanned file path, or the manifest path for a declared or transitive dependency
	SourceHash      string      `json:"source_hash,omitempty"`       // hash of the scanned input file (from the WFP)
	FileHash        string      `json:"file_hash,omitempty"`         // hash of the matched file (== source_hash for a file match; the OSS file's for a snippet)
	MatchType       string      `json:"match_type,omitempty"`        // "file" (whole file) | "snippet" | "declared" (the manifest declares it) | "transitive" (the manifest's lockfile pulls it in)
	Identified      bool        `json:"identified,omitempty"`        // a bom.identify rule claimed this component for this file
	MatchPercentage int         `json:"match_percentage,omitempty"`  // match confidence (snippet only)
	Confidence      string      `json:"confidence,omitempty"`        // attribution reliability grade: LOW, MEDIUM or HIGH
	OssFilePath     string      `json:"oss_file_path,omitempty"`     // matched file path inside the OSS component
	InputLineRanges []LineRange `json:"input_line_ranges,omitempty"` // matched line ranges in the scanned file (snippet only)
	OssLineRanges   []LineRange `json:"oss_line_ranges,omitempty"`   // matched line ranges in the OSS component (snippet only)

	// MatchIndex is where this component stood among the candidates the scan returned for this
	// file, after the BOM rules: 0 is the file's primary match — the component the file
	// originates from — and the ones after it redistribute it (forks, mirrors, packagings,
	// projects that vendor it). Nil when there is no candidate list to stand in: declared
	// evidence, or a document written before the field existed.
	//
	// It is the only place a file's candidate order survives. A component's evidence is sorted
	// by path and the components are not in any file's order, so a consumer rebuilding "the
	// candidates of this file" ranks them by this field, not by where it found them.
	MatchIndex *int `json:"match_index,omitempty"`

	// SnippetClassification is the local snippet-classifier's verdict on whether this snippet
	// match is a false positive (its reported ranges do not correspond). Populated only when
	// classification was requested and the match could be scored; nil otherwise.
	SnippetClassification *SnippetClassification `json:"snippet_classification,omitempty"`
}

FileEvidence is one occurrence of a component in the scanned project (a CycloneDX evidence.occurrence): a scanned file that matched (match_type "file"/"snippet", with — for snippets — where and how strongly it matched inside the OSS component), the manifest that declared it (match_type "declared", with only the path set), or the manifest whose lockfile pulls it in through another dependency (match_type "transitive", path set the same way).

func (FileEvidence) IsPrimary added in v0.10.0

func (e FileEvidence) IsPrimary() bool

IsPrimary reports whether this evidence is its file's primary match (MatchIndex 0).

type Format

type Format string

Format is a supported SBOM output format.

const (
	// FormatCycloneDX selects CycloneDX JSON output.
	FormatCycloneDX Format = "cyclonedx"
	// FormatSPDX selects SPDX 2.3 (Lite field subset) JSON output.
	FormatSPDX Format = "spdx"
)

type GeoLocation

type GeoLocation struct {
	Name       string  `json:"name"`
	Percentage float64 `json:"percentage,omitempty"`
}

GeoLocation is one geographic origin of a component's contributors (geo layer), with the share of contribution when known.

type GraphStatus added in v0.12.0

type GraphStatus string

GraphStatus says how much of a root's dependency graph the lockfile gave.

const (
	// GraphComplete means the root's edges are the lockfile's.
	GraphComplete GraphStatus = "complete"
	// GraphPartial means the graph is usable but missing something; Reason says what.
	GraphPartial GraphStatus = "partial"
	// GraphUnknown means the lockfile could not be read; the root has no edges and no members.
	GraphUnknown GraphStatus = "unknown"
)

type Inventory

type Inventory struct {
	Components      []Component      `json:"components"`
	Vulnerabilities []Vulnerability  `json:"vulnerabilities,omitempty"`
	Dependencies    []DependencyRoot `json:"dependencies,omitempty"`
}

Inventory is the neutral, format-agnostic bill of materials and the core of the CLI's raw output. Detected components (scan matches) and declared dependency components live in ONE Components list, tagged by Component.Scope, so enrichment decorates the union origin-agnostic. Per-component layers (licenses, cryptography, geoprovenance) attach inline on each component; vulnerabilities are a flat top-level list joined to components by base PURL. Build it directly, or via the scansource and depsource adapters from a scan result or a project's dependency files. Add components through Add to keep one entry per component when more than one origin reports the same one.

Dependencies is the dependency graph the lockfiles resolved, one root per manifest, with dev members already left out. Which components a root reaches, and whether directly, is on the components' evidence (see FileEvidence.MatchType); the root carries its edges.

func ParseCycloneDX

func ParseCycloneDX(data []byte) (Inventory, error)

ParseCycloneDX decodes a CycloneDX JSON document (any 1.x minor version the library accepts) into a neutral Inventory. It is the inverse of buildCycloneDX: components, licenses and vulnerabilities are mapped back. Fields outside the Inventory model — file evidence occurrences, hashes, component type — are not preserved (best-effort).

The dependency graph is not read back: the dependencies and compositions sections are skipped, and so are the application components without a purl that stand for a lockfile root (ours, and the ones other SBOM tools write), which are not packages. Like match_index, the graph survives a round trip through the raw format only.

func ParseRaw

func ParseRaw(data []byte) (Inventory, error)

ParseRaw reads a raw inventory document back into an Inventory. Any envelope fields (schema_version, metadata) are accepted and ignored; a bare `{components, vulnerabilities}` object parses too. To be recognized as an inventory the input must carry a `schema_version` or a `components` key — arbitrary JSON that has neither is rejected. A v3 scan result (whose `components` are an object keyed by url_hash, not an array) also fails and returns an error.

func ParseSPDX

func ParseSPDX(data []byte) (Inventory, error)

ParseSPDX decodes an SPDX 2.3 JSON document into a neutral Inventory. It is the inverse of buildSPDXLite: packages, licenses and checksums are mapped back. SPDX 2.3 has no vulnerability model, so the Inventory carries no vulnerabilities. Fields outside the Inventory model are not preserved (best-effort).

The dependency graph is not read back: the project and root packages the writer adds for it are skipped, by their comment, and the DEPENDS_ON relationships are ignored. Like match_index, the graph survives a round trip through the raw format only.

func (*Inventory) Add added in v0.8.0

func (inv *Inventory) Add(comps ...Component)

Add appends comps, folding any that shares an identity (Purl and Version) with a component already present rather than listing it twice: the evidence lists are combined, and a detected component wins over a declared one — scope and metadata both. A component both matched by a scan and declared in a manifest is one component, detected, carrying its file matches and its manifest occurrence together. An empty Scope counts as detected, as the field documents.

The inventory takes its own copy of each component's evidence, so what it holds is not the caller's to change afterwards — and two inventories seeded from one Component value cannot grow into each other's memory.

It is how the inventory keeps one entry per component. Appending to Components directly still works, and leaves the caller to answer what two entries for one component mean.

func (Inventory) DirectMembers added in v0.12.0

func (inv Inventory) DirectMembers(root DependencyRoot) []string

DirectMembers returns the refs of the components root declares, in the root's order. A ref that is not a component is dropped, as dependsOn drops such an edge end.

func (*Inventory) RemoveFalsePositiveSnippets added in v0.16.0

func (inv *Inventory) RemoveFalsePositiveSnippets() int

RemoveFalsePositiveSnippets drops every snippet match the classifier proposed as a false positive, and returns how many it dropped. A component left with no evidence goes with them.

Only that evidence is touched: file matches, declared and transitive evidence, snippet matches that were not scored or were scored real stay, and so does a match a bom.identify rule claimed, since a person already confirmed it. Because declared and transitive evidence always stays, a component the dependency graph names keeps an entry, so Dependencies never points at a removed component. Vulnerabilities do: an advisory names components by PURL, so a PURL that named only removed components is dropped from it, and an advisory left naming nothing is dropped too.

type License

type License struct {
	ID              string                 `json:"id"`                        // SPDX id or "LicenseRef-*", e.g. "GPL-2.0-only"
	Acknowledgement LicenseAcknowledgement `json:"acknowledgement,omitempty"` // declared (default) | concluded
}

License is a single license on a component, with its acknowledgement. The same id may appear more than once (e.g. both declared and concluded).

type LicenseAcknowledgement

type LicenseAcknowledgement string

LicenseAcknowledgement is how a license was established for a component.

const (
	// AckDeclared marks a license stated by the project (from the decoration service).
	AckDeclared LicenseAcknowledgement = "declared"
	// AckConcluded marks a license determined by review (e.g. from a downstream consumer's identifications).
	AckConcluded LicenseAcknowledgement = "concluded"
)

type LineRange added in v0.3.0

type LineRange struct {
	StartLine int `json:"start_line"` // first line of the matched range
	EndLine   int `json:"end_line"`   // last line of the matched range
}

LineRange is a matched line range (inclusive) within a file. It mirrors the shape the scan engine reports, so ranges travel from the scan result to the SBOM writers without being encoded to text and parsed back.

type Option

type Option func(*options)

Option configures SBOM generation.

func WithAIUsage added in v0.21.0

func WithAIUsage(u *AIUsage) Option

WithAIUsage adds an AI usage report to a CycloneDX document: providers as services, models as machine-learning-model components and risks as vulnerabilities. SPDX ignores it.

func WithAuthor

func WithAuthor(name string) Option

WithAuthor sets the author / organization recorded in the document metadata. Empty values are ignored (default: the SCANOSS organization name).

func WithProjectName

func WithProjectName(name string) Option

WithProjectName sets the name of the top-level project component (CycloneDX) / document (SPDX). Empty values are ignored and the default is kept.

func WithTimestamp

func WithTimestamp(t time.Time) Option

WithTimestamp sets the document creation timestamp (e.g. a point-in-time snapshot time, or a fixed value for reproducible output). The zero time is ignored and the current time is used at render.

func WithTool

func WithTool(name string) Option

WithTool sets the generating tool recorded in the document metadata. The value is taken literally: a caller passing "my-tool-1.4.0" gets exactly that, with no version appended. Pass WithToolVersion as well to have CycloneDX record the version in its own field.

func WithToolVersion added in v0.4.0

func WithToolVersion(version string) Option

WithToolVersion sets the version recorded alongside the tool name. Empty leaves the default. CycloneDX records it in its own field; SPDX has no such field, so there the two are joined as "name-version", which is that format's convention.

type RawDocument

type RawDocument struct {
	SchemaVersion string      `json:"schema_version"`
	Metadata      RawMetadata `json:"metadata"`
	Inventory
	// AIUsage is the AI usage found in source code; nil when the scan did not look for it.
	AIUsage *AIUsage `json:"ai_usage,omitempty"`
}

RawDocument is the raw output format: an Inventory wrapped in a versioned envelope. The embedded Inventory promotes its `components`/`vulnerabilities` keys to the top level, so the JSON is `{schema_version, metadata, components, vulnerabilities}` — the neutral interchange contract for the scan → enrich → convert pipe. It is the raw counterpart to the CycloneDX/SPDX documents that Generate produces, kept here so a single definition serves both the writer and the reader.

func NewRawDocument

func NewRawDocument(inv Inventory, meta RawMetadata) RawDocument

NewRawDocument wraps inv in a raw envelope stamped with the current schema version and the given metadata.

func (RawDocument) Marshal

func (d RawDocument) Marshal() (string, error)

Marshal renders the raw document as indented JSON — the raw-format counterpart to Generate.

type RawMetadata

type RawMetadata struct {
	Tool        string `json:"tool,omitempty"`
	ToolVersion string `json:"tool_version,omitempty"`
	Project     string `json:"project,omitempty"`
}

RawMetadata identifies the tool and project that produced a raw document. Values are supplied by the caller (the CLI), so pkg/sbom carries no application identity of its own.

type SnippetClassification added in v0.16.0

type SnippetClassification struct {
	Verdict      string  `json:"verdict"`       // "false_positive" | "real"
	Probability  float64 `json:"probability"`   // P(false positive), 0..1
	ModelVersion string  `json:"model_version"` // model that produced the score, e.g. "lr-d51f2e100211"
}

SnippetClassification is the snippet-classifier's answer for one snippet match: whether the reported OSS and local line ranges correspond, as a thresholded verdict plus the probability behind it. It is a proposal for a human to confirm; removing what it proposes is a separate, opt-in step (Inventory.RemoveFalsePositiveSnippets).

type Vulnerability

type Vulnerability struct {
	ID       string   `json:"id"`                 // advisory/CVE id, e.g. "CVE-2021-1234"
	Severity string   `json:"severity,omitempty"` // critical|high|medium|low|none|"" (case-insensitive)
	Source   string   `json:"source,omitempty"`   // advisory source name, e.g. "NVD"
	URL      string   `json:"url,omitempty"`      // advisory URL (optional)
	Summary  string   `json:"summary,omitempty"`  // short description (optional)
	Purls    []string `json:"purls,omitempty"`    // PURLs of the affected components, versioned when the source says which version

	// Optional quantitative scoring. All fields are optional: when unset they are not
	// rendered, and the output is identical to a severity-only vulnerability.
	CVSSScore  *float64 `json:"cvss_score,omitempty"`  // CVSS base score 0.0–10.0
	CVSSVector string   `json:"cvss_vector,omitempty"` // CVSS vector string, e.g. "CVSS:3.1/AV:N/..."
	CVSSMethod string   `json:"cvss_method,omitempty"` // CVSS scoring method, e.g. "CVSSv31"
	CWEs       []int    `json:"cwes,omitempty"`        // CWE ids, e.g. [77]
	EPSSScore  *float64 `json:"epss_score,omitempty"`  // EPSS probability 0.0–1.0 (no native CycloneDX field; emitted as a property)
}

Vulnerability is one known vulnerability affecting one or more components, in a format independent of any decoration API wire type.

Directories

Path Synopsis
Package depsource builds an sbom.Inventory from a project's dependency files.
Package depsource builds an sbom.Inventory from a project's dependency files.
Package scansource adapts SCANOSS SDK values — a v3 scan result and the licenses, vulnerabilities, cryptography and geoprovenance decoration responses — into the neutral sbom.Inventory consumed by the sbom package.
Package scansource adapts SCANOSS SDK values — a v3 scan result and the licenses, vulnerabilities, cryptography and geoprovenance decoration responses — into the neutral sbom.Inventory consumed by the sbom package.

Jump to

Keyboard shortcuts

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