Documentation
¶
Overview ¶
Package scanpipeline runs the scan pipeline that assembles a neutral sbom.Inventory. Run is the full flow over a source path: collect files → fingerprint → scan → source declared dependencies from the same files → gather + enrich the requested layers via the SDK's decoration pipeline (scanoss.DecorationPipeline). Build is the lower half (scan result → inventory) for callers that already have a scan result (e.g. a pre-generated WFP). Rendering is left to sbom.Generate — this package does not render. Layers to gather are driven by the caller's request, never by any output format.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Build ¶
func Build(ctx context.Context, client *scanoss.Client, result *scanossapi.ScanResult, layers Set, declared *parsers.LocalDependencies) (sbom.Inventory, error)
Build sources an Inventory from a scan result and enriches it with the requested layers. It is the lower half of the pipeline (scan result → inventory), used directly by callers that already have a scan result. Scan matches populate the detected components; when the deps layer is requested and declared manifests are supplied, they are resolved into the same Components list, tagged declared. Every requested purl-layer (licenses, vulns, crypto, geo) is then gathered over all components, via the decoration pipeline. The requested layers, not any format, decide what is gathered. Enrichment is non-fatal: a failed service is logged and skipped so a partial inventory is still returned.
func Enrich ¶
Enrich runs the decoration pipeline over the inventory's components and attaches the requested purl-layers in place — licenses/cryptography/geoprovenance inline on each component, vulnerabilities as the flat top-level list. It is the pipeline's format-blind enrichment stage, keyed purely by PURL (+ version): the scan path reaches it through Build/Run, and the enrich command calls it directly on an inventory parsed from an existing SBOM — no scan required. Each layer is opt-in (driven by the requested set, never the output format); with no purl-layer requested it makes no API call. Enrichment is non-fatal: a failed service is logged and skipped.
Types ¶
type Options ¶
type Options struct {
Client *scanoss.Client // required
Layers Set // requested output layers
SourcePath string // file or directory to scan (required)
Threads int // fingerprint workers (<1 => 1)
Filter filter.Options // file-collection filters (directory scans)
ScanOptions []scanoss.ScanOption // per-scan tuning (chunk size, poll interval, BOM, ...)
OnCollect func(skipped int) // optional: called once after collection with the filtered count
OnFingerprint func(done, total int) // optional fingerprinting progress
OnDependencies func(done, total int) // optional dependency-manifest parsing progress
}
Options configures Run, the full scan pipeline over a source path. Progress for the scan and each enrichment layer is reported through the client's own scanoss.WithProgress callback (keyed by Service); the two steps that happen locally before the API — fingerprinting and dependency-manifest parsing — report through OnFingerprint and OnDependencies.
type Result ¶
Result is the outcome of Run: the gathered inventory, the generated WFP (for --save-wfp), and the count of files that failed to fingerprint.
func Run ¶
Run executes the full pipeline over Options.SourcePath: collect the files (applying the filters for a directory), fingerprint them, scan, source declared dependencies from the same file set (when the deps layer is requested), and gather + enrich into an Inventory. It owns everything from file collection onward; the caller supplies only flag-derived configuration.
type Set ¶
Set is a set of requested layers.
func ParseLayers ¶
ParseLayers validates a list of layer names (e.g. from --include) into a Set.