Documentation
¶
Overview ¶
Package settings loads a project's scanoss.json (or settings.json): the BOM rules (include/identify/ignore/remove/replace) and the skip rules (patterns and size bounds per operation). Detect finds the file and Load parses it; pkg/filter reads the skip rules straight out of it, one operation per profile.
Index ¶
Constants ¶
const ( OperationScanning = "scanning" OperationFingerprinting = "fingerprinting" OperationDependencies = "dependencies" )
Operation identifies which set of skip rules applies. Mirrors the operations enumerated in the scanoss.json settings schema.
Variables ¶
This section is empty.
Functions ¶
func Detect ¶
Detect looks for a settings file in the given directory, checking "scanoss.json" then "settings.json". It returns the path of the first one found, or "" if there is none — a project without settings is the normal case, not a failure.
A file path is accepted too, and its directory is searched: a scan target can be a single file, and the settings that apply to it live alongside it.
Types ¶
type BOM ¶
type BOM struct {
// Include specifies components that should be included in scan results (new format)
Include []BOMEntry `json:"include,omitempty"`
// Identify specifies components that should be identified as declared dependencies
Identify []BOMEntry `json:"identify,omitempty"`
// Ignore specifies components that should be ignored/whitelisted in scan results
Ignore []BOMEntry `json:"ignore,omitempty"`
// Remove specifies components that should be removed/blacklisted from scan results
Remove []BOMEntry `json:"remove,omitempty"`
// Replace specifies components that should be replaced with alternatives
Replace []BOMEntry `json:"replace,omitempty"`
}
BOM represents the Bill of Materials section in the settings file. It contains lists of components to identify, ignore, or remove from scan results.
type BOMEntry ¶
type BOMEntry struct {
// PURL (Package URL) identifying the component. Supports glob patterns (e.g., pkg:npm/lodash@*)
Purl string `json:"purl"`
// Path optional file path pattern to scope this entry
Path string `json:"path,omitempty"`
// ReplaceWith specifies the PURL to replace with (only for Replace entries)
ReplaceWith string `json:"replace_with,omitempty"`
}
BOMEntry represents a single BOM (Bill of Materials) entry that specifies how the scanner should handle a particular component.
type Settings ¶
type Settings struct {
BOM BOM `json:"bom"`
// Settings holds the input-filtering rules (the scanoss.json "settings"
// section). Optional.
Settings Tuning `json:"settings,omitempty"`
}
Settings represents the scanoss settings file structure.
type SizeRule ¶
type SizeRule struct {
Patterns []string `json:"patterns"`
Min int64 `json:"min"`
Max int64 `json:"max"`
}
SizeRule is one entry under settings.skip.sizes.<operation>: files matching any of Patterns are skipped when smaller than Min or larger than Max (0 disables a bound).
type Skip ¶
type Skip struct {
Patterns SkipPatternsByOp `json:"patterns,omitempty"`
Sizes SkipSizesByOp `json:"sizes,omitempty"`
}
Skip mirrors the settings.skip section of scanoss.json.
type SkipPatternsByOp ¶
type SkipPatternsByOp struct {
Scanning []string `json:"scanning,omitempty"`
Fingerprinting []string `json:"fingerprinting,omitempty"`
Dependencies []string `json:"dependencies,omitempty"`
}
SkipPatternsByOp mirrors settings.skip.patterns: glob patterns per operation.
type SkipSizesByOp ¶
type SkipSizesByOp struct {
Scanning []SizeRule `json:"scanning,omitempty"`
Fingerprinting []SizeRule `json:"fingerprinting,omitempty"`
Dependencies []SizeRule `json:"dependencies,omitempty"`
}
SkipSizesByOp mirrors settings.skip.sizes: size rules per operation.
type Tuning ¶
type Tuning struct {
Skip Skip `json:"skip,omitempty"`
}
Tuning mirrors the top-level settings section of scanoss.json: the input-filtering skip rules applied during file collection.
func (Tuning) SkipPatterns ¶
SkipPatterns returns the skip patterns for the given operation, or nil.