cmd

package
v3.83.4 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: AGPL-3.0 Imports: 84 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute() error

func LoadFromMemory

func LoadFromMemory(rootPath string, freshExploits, freshAdvisories, freshVulns bool) error

LoadFromMemory reconstructs the scan pretty output from .vulnetix/sbom.cdx.json. When fresh* flags are true, selective API calls are made to refresh that data.

Types

type AIBOMPassOptions added in v3.79.0

type AIBOMPassOptions struct {
	RootPath         string
	Depth            int
	Ignore           []string
	CatalogPath      string
	NoBuiltinCatalog bool
	// Passes selects which detection passes run; the zero value runs none, so
	// callers must be explicit.
	Passes           aibomPasses
	IncludeHome      bool
	CommitMax        int
	RespectGitignore bool
	// SpecVersion defaults to 1.7.
	SpecVersion string
	// Upload submits the AIBOM to the backend when authenticated.
	Upload bool
	GitCtx *gitctx.GitContext
}

AIBOMPassOptions is the AIBOM owner's entry contract. The `aibom` command builds it from its flags; `scan` builds it with the pass defaults. Both go through runAIBOMPass, so there is one definition of "detect AI usage".

type AIBOMPassResult added in v3.79.0

type AIBOMPassResult struct {
	Detections  cyclonedx.AIDetections
	BOM         []byte
	SpecVersion string
}

AIBOMPassResult carries what the caller renders or writes.

type CBOMPassOptions added in v3.79.0

type CBOMPassOptions struct {
	RootPath         string
	Depth            int
	Ignore           []string
	CatalogPath      string
	NoBuiltinCatalog bool
	// Passes selects which detection passes run; the zero value runs none.
	Passes           cbomPasses
	RespectGitignore bool
	// SpecVersion defaults to 1.7.
	SpecVersion string
	// Upload submits the CBOM to the backend when authenticated.
	Upload bool
	GitCtx *gitctx.GitContext
}

CBOMPassOptions is the CBOM owner's entry contract, mirroring AIBOMPassOptions: the `cbom` command builds it from its flags, `scan` builds it with the pass defaults, and runCBOMPass is the only implementation.

type CBOMPassResult added in v3.79.0

type CBOMPassResult struct {
	Detections  cyclonedx.CryptoDetections
	BOM         []byte
	SpecVersion string
}

CBOMPassResult carries what the caller renders, writes or gates on.

type CommandManifest added in v3.56.0

type CommandManifest struct {
	Commands map[string]ManifestCommand `json:"commands"`
}

CommandManifest is the serialized shape of the Cobra tree.

func BuildCommandManifest added in v3.56.0

func BuildCommandManifest() CommandManifest

BuildCommandManifest walks the live root command and records every command path with its flags. Persistent flags are attributed to the command that declares them and to every descendant, because that is how a user sees them.

type EcoGroups added in v3.54.0

type EcoGroups struct {
	Configured []EcoStatus
	Available  []EcoStatus
}

type EcoStatus added in v3.54.0

type EcoStatus struct {
	Ecosystem pfw.Ecosystem
	Path      string
}

type GateBreach

type GateBreach struct {
	Gate    string // "malware" | "exploits" | "severity" | "eol"
	Count   int
	Message string // pre-formatted, ready to print
}

GateBreach captures one quality gate's failure details.

type LicensePolicyFlags added in v3.79.0

type LicensePolicyFlags struct {
	Mode      string
	AllowCSV  string
	AllowFile string
}

LicensePolicyFlags is the license policy as the scan-family flags express it (`--license-mode`, `--allow`, `--allow-file`). It travels through the scan pipeline to the license owner so a scan and a standalone `license` run apply the same policy.

type LicenseRunOptions added in v3.79.0

type LicenseRunOptions struct {
	RootPath string
	// Mode is the license.EvalConfig mode ("inclusive" or "individual"). Empty
	// defaults to inclusive.
	Mode string
	// AllowCSV / AllowFile are the two spellings of the allow list; AllowFile
	// wins when both are set.
	AllowCSV  string
	AllowFile string
	// SeverityThreshold filters findings below the given severity.
	SeverityThreshold string
	// Packages are the parsed manifest packages to analyse.
	Packages []scan.ScopedPackage
	// ManifestGroups carries the dependency graph used for introduced-via chains.
	ManifestGroups []scan.ManifestGroup
	// LicensedPackages lets a caller reuse an earlier license.DetectLicenses
	// result (the scan pipeline resolves licenses before its SCA round-trip so
	// the payload can carry them). Empty means "detect now".
	LicensedPackages []license.PackageLicense
	// Memory, when non-nil, receives this run's findings and the resolution of
	// findings that have disappeared. The caller owns saving it.
	Memory *memory.Memory
	GitCtx *gitctx.GitContext
	// Stderr receives warnings; nil means os.Stderr.
	Stderr io.Writer
}

LicenseRunOptions is everything the license pipeline needs from a caller. The `license` command builds it from its own flags; `scan --evaluate-licenses` builds it from the scan-family license flags and passes the packages it has already parsed. Both go through runLicensePipeline so there is exactly one implementation of "what does a license finding mean".

type LicenseRunResult added in v3.79.0

type LicenseRunResult struct {
	Result           *license.AnalysisResult
	LicensedPackages []license.PackageLicense
	// FindingVulnerabilities are this run's open license findings as CycloneDX
	// vulnerability entries.
	FindingVulnerabilities []cdx.Vulnerability
	// VEXVulnerabilities are the resolution attestations read back from memory.
	// They are kept separate from the findings because the scan pipeline feeds
	// them through cdx.ApplyVEXAnalysis (which annotates an existing entry rather
	// than appending a twin), while the license command merges both into the BOM
	// in one call.
	VEXVulnerabilities []cdx.Vulnerability
	// StateChanges are the memory transitions this run produced (new findings,
	// resolutions). Empty when Options.Memory was nil.
	StateChanges []memory.StateChange
}

LicenseRunResult is the pipeline's output. Callers decide what to do with it: the `license` command merges the CycloneDX entries into the on-disk BOM, the scan pipeline appends them to the BOM it is already building in memory.

func (*LicenseRunResult) CDXVulnerabilities added in v3.79.0

func (r *LicenseRunResult) CDXVulnerabilities() []cdx.Vulnerability

CDXVulnerabilities is the findings and their VEX attestations in one slice, for callers that merge everything into the BOM at once.

func (*LicenseRunResult) LicenseSpdxIDByPackage added in v3.79.0

func (r *LicenseRunResult) LicenseSpdxIDByPackage() map[string]string

LicenseSpdxIDByPackage maps "name@version" → resolved SPDX id for every package whose license was determined. It is what the CycloneDX component population and the /v2/cli.sca payload both consume.

type ManifestCommand added in v3.56.0

type ManifestCommand struct {
	Short      string   `json:"short"`
	Flags      []string `json:"flags"`
	Deprecated []string `json:"deprecatedFlags,omitempty"`
	Subs       []string `json:"subcommands,omitempty"`
}

ManifestCommand describes one command path (e.g. "auth login").

type MultiPolicyBreachError

type MultiPolicyBreachError struct {
	Breaches []GateBreach
}

MultiPolicyBreachError is returned when one or more quality gates are breached.

func (*MultiPolicyBreachError) Error

func (e *MultiPolicyBreachError) Error() string

type PolicyBreachError

type PolicyBreachError interface {
	error
	// contains filtered or unexported methods
}

PolicyBreachError is implemented by all quality-gate breach errors. Execute() uses this interface to suppress redundant error printing — the command itself has already printed the breach details.

type SeverityBreachError

type SeverityBreachError struct {
	// contains filtered or unexported fields
}

SeverityBreachError is returned when --severity threshold is breached. It signals main() to exit with code 1 without printing a redundant error message.

func (*SeverityBreachError) Error

func (e *SeverityBreachError) Error() string

Jump to

Keyboard shortcuts

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