Help us shape the future of Go! Take the 2026 Go Developer Survey

supplychain

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: AGPL-3.0, AGPL-3.0-only Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EcosystemDockerImage   = "docker-image"
	EcosystemGitHubRelease = "github-release"
	EcosystemGoMod         = "gomod"
	EcosystemToolchain     = "toolchain"
	EcosystemCargo         = "cargo"
	EcosystemNpm           = "npm"
	EcosystemAlpineAPK     = "alpine-apk"
	EcosystemDebianAPT     = "debian-apt"
	EcosystemPip           = "pip"
)

Ecosystem constants identify the origin of a dependency.

Variables

This section is empty.

Functions

func ActiveIgnores added in v0.11.0

func ActiveIgnores(ignores []VulnIgnore, now time.Time) map[string]bool

ActiveIgnores reduces declared ignores to the advisory IDs suppressed AT now, upper-cased for case-insensitive matching.

A malformed or lapsed date does not suppress. That direction is deliberate: an exception that outlives its own expiry, or whose expiry never parsed, must fail toward the finding being visible again — the risk it was carrying did not expire just because the note about it did.

Types

type Dependency

type Dependency struct {
	Name    string // e.g. "golang", "github.com/spf13/cobra", "react"
	Current string // currently pinned/resolved concrete version string

	// Constraint is the RAW manifest version requirement, operator included, for
	// ecosystems whose manifests express a range (cargo "^1.8" / "~1.2" / "=1.8.0" /
	// ">=1, <2"). It is the native intent honored during eligibility selection —
	// distinct from Current (the concrete resolved version). Empty for ecosystems
	// that pin an exact version (go.mod, toolchain), where Current is the pin.
	Constraint string

	// Latest is the newest version the registry publishes — "latest AVAILABLE".
	// It is NOT necessarily a safe autonomous-update target: a major / out-of-range
	// bump can break the build (feature renames, API migrations). See LatestEligible.
	Latest string

	// LatestEligible is the newest version that is semver-COMPATIBLE with the current
	// constraint — the safe autonomous-remediation target. Empty for ecosystems with
	// no compatibility model (exact go.mod pins), where Latest is the target. When
	// Latest > LatestEligible a major upgrade exists OUT of range: review-domain,
	// constraint-expanding, never auto-applied.
	LatestEligible string

	// AvailableVersions is the set of published versions the registry lists — a pure
	// registry fact retained so the deps layer can re-target within a max_update
	// ceiling (e.g. patch-lock selecting the newest patch of the current minor rather
	// than holding on a minor bump). Populated only where cheaply available: cargo (the
	// list is already fetched to compute LatestEligible) and Go (via an @v/list fetch
	// enabled only under patch-lock). Empty otherwise. Never a policy input — the deps
	// layer selects a target from it; discovery just records what exists.
	AvailableVersions []string

	// Pinned records that a NATIVE dependency-selection directive already governs
	// this dependency, so StageFreight neither reports it outdated nor proposes an
	// update — it respects the toolchain's own decision. The value names the
	// mechanism (e.g. "replace directive"). Empty = freely resolvable. This is the
	// discovery-side counterpart to what apply already honors, so both agree.
	Pinned string

	// LockPending marks a dependency whose resolvable target exists but whose lockfile
	// entry has not been written yet — a wildcard toolchain constraint with no
	// .stagefreight/toolchains.lock entry. Current already equals the target (nothing to
	// bump), yet the update pass must still MATERIALIZE the lock, so the filter treats it
	// as a candidate rather than "up to date". This is how a first lock is born.
	LockPending bool

	Ecosystem string // one of the Ecosystem* constants below
	File      string // relative path from repo root
	Line      int    // line number of the pinned version
	Indirect  bool   // e.g. go.mod // indirect
	SourceURL string // registry/API URL that was queried
	Binding   string // editable anchor used by source-specific updaters (e.g. ENV var name)

	// Vulnerability info populated by the OSV correlation pass.
	Vulnerabilities []VulnInfo // known CVEs affecting the current version

	// VulnScanError records why OSV vulnerability correlation could NOT complete for
	// this dependency — a batch-query or advisory-detail fetch that failed after
	// retries. When set, the dependency is VULN-UNVERIFIED: its CVE status is unknown
	// and must never be rendered as clean. This mirrors ResolutionError for freshness —
	// StageFreight never claims a security verdict it failed to reach. The audition and
	// lint layers surface a loud coverage-gap warning from it rather than swallowing it.
	VulnScanError string

	// Advisory is an optional informational message set by the resolver
	// when a non-versioned or pre-release tag has stable releases available.
	Advisory string

	// ResolutionError records why Latest could NOT be determined — a registry
	// lookup failure, an empty response, a parse error. When set, the dependency
	// is UNRESOLVED: an indeterminate state that must never be rendered as
	// up-to-date. StageFreight never claims freshness it failed to verify.
	ResolutionError string

	// CooldownHeld is a newer release that exists but is withheld by the MinReleaseAge
	// supply-chain cooldown (younger than the configured window). Latest then points at the
	// newest version old enough to adopt; this records what was held back, for disclosure.
	CooldownHeld string

	// Fields populated by the config/rule engine after resolution.
	// Used by future update commands for MR grouping and automerge.
	Group     string // assigned group name from package rules
	Automerge bool   // whether this dep's MR should automerge

	// ResolvedTarget, when set by the deps layer, is a ceiling-constrained update
	// target that OVERRIDES the natural UpdateTarget(). It lets a max_update ceiling
	// re-target to a lower in-range version — e.g. patch-lock choosing the newest
	// patch of the current minor instead of holding — rather than skipping the dep
	// entirely. Empty means "use the natural target". Never set by discovery.
	ResolvedTarget string

	// ResolvedDigest is the registry manifest digest ("sha256:…") of the update
	// target, resolved for a digest-pinned base image (FROM image:tag@sha256:…). The
	// apply layer writes it alongside the bumped tag so the pin stays immutable AND
	// current — Renovate pinDigests parity. Empty for non-digest-pinned deps.
	ResolvedDigest string

	// PinnedDigest is the digest currently written in the FROM line ("sha256:…"),
	// captured by discovery. Compared against ResolvedDigest to detect a same-tag
	// digest refresh (a CVE rebuild republished under the same version tag). Empty for
	// non-digest-pinned deps.
	PinnedDigest string
}

Dependency is a version-pinned reference extracted from a project file. It is the bridge type consumed by both lint reporting and future update commands (à la Renovate managers).

func (Dependency) MajorAvailable

func (d Dependency) MajorAvailable() bool

MajorAvailable reports whether a newer version exists OUTSIDE the compatible range — a constraint-expanding upgrade. That is a review-domain change (may need feature renames / API migration), never autonomous.

func (Dependency) NeedsDigestRefresh added in v0.9.0

func (d Dependency) NeedsDigestRefresh() bool

NeedsDigestRefresh reports a digest-pinned image whose currently-pinned digest is stale relative to the freshly-resolved digest for the SAME tag — a same-tag refresh (an upstream rebuild under the same version). Both digests must be known and differ. This is the Mode-2 counterpart to a version bump: an update with no tag change.

func (Dependency) UpdateTarget

func (d Dependency) UpdateTarget() string

UpdateTarget is the version autonomous remediation should advance to. A deps-layer ResolvedTarget (a max_update re-target) wins; otherwise the latest semver-COMPATIBLE version when known, else the latest available (ecosystems with no compatibility model, e.g. exact go.mod pins). This is the perform-domain action.

type DigestEntry

type DigestEntry struct {
	Digest  string `yaml:"digest"`
	Checked string `yaml:"checked"`
}

DigestEntry records a single image tag's digest.

type DigestLock

type DigestLock struct {
	Digests map[string]DigestEntry `yaml:"digests"`
}

DigestLock tracks non-versioned tag digests over time.

type DockerFreshnessInfo

type DockerFreshnessInfo struct {
	Stages  []StageInfo
	EnvVars map[string]EnvVar
	// Args holds every ARG declaration with a default value (name → value+line),
	// the resolution source for FROM references that interpolate a build arg
	// (FROM alpine:${ALPINE_VERSION}). Unlike EnvVars — which retains only *_VERSION
	// entries for tool cross-referencing — Args records all ARGs so any ${VAR} base
	// image can be resolved to its concrete tag.
	Args        map[string]EnvVar
	PinnedTools []PinnedTool
	ApkPackages []PackageRef
	AptPackages []PackageRef
	PipPackages []PackageRef
}

DockerFreshnessInfo holds everything extracted from a Dockerfile relevant to freshness checking.

type EnvVar

type EnvVar struct {
	Name  string
	Value string
	Line  int
}

EnvVar describes a single Dockerfile ENV declaration.

type PackageRef

type PackageRef struct {
	Name    string
	Version string // empty if unpinned; resolved when it came from ${VAR}
	Line    int

	// Binding is the ARG/ENV name a ${VAR}-interpolated version resolved from, and
	// BindingLine that declaration's line — the same editable-anchor contract
	// PinnedTool and FROM interpolation use. An update to a bound package rewrites
	// the ARG default rather than the install line, which is where the version
	// actually lives. Empty when the version was written literally.
	Binding     string
	BindingLine int
}

PackageRef describes a single package reference extracted from a RUN install line (apk/apt/pip).

type PinnedTool

type PinnedTool struct {
	EnvName string // e.g. "BUILDX_VERSION"
	Version string // e.g. "v0.31.1"
	Owner   string // GitHub owner
	Repo    string // GitHub repo
	Line    int    // line of the ENV declaration
}

PinnedTool describes a pinned tool version resolved from an ENV *_VERSION variable cross-referenced with a GitHub release URL.

type Snapshot

type Snapshot struct {
	Dependencies []Dependency
}

Snapshot is the immutable result of one dependency-discovery pass across a repository. It is produced exactly once per audition (see discovery.Discover) and shared read-only by every consumer — lint rendering and dependency-update — so registry lookups and vulnerability correlation run a single time instead of once per consumer.

Snapshot performs no filtering of its own: consumers narrow to their own scope (e.g. by Dependency.File) as needed.

func (*Snapshot) UnverifiedVulns added in v0.9.0

func (s *Snapshot) UnverifiedVulns() []Dependency

UnverifiedVulns returns the dependencies whose OSV vulnerability scan could not complete (VulnScanError set). A non-empty result is a security COVERAGE GAP: these dependencies are NOT known-clean, and consumers must surface them loudly rather than let an unreachable OSV silently pass the pipeline as green.

type StageInfo

type StageInfo struct {
	Image string // full image reference (e.g. "golang:1.25-alpine")
	Name  string // AS alias
	Line  int
}

StageInfo describes a single Dockerfile FROM stage.

type VulnIgnore added in v0.11.0

type VulnIgnore struct {
	ID     string // e.g. "GHSA-xxxx-yyyy-zzzz", "CVE-2026-1234", "GO-2026-1234"
	Reason string // why this risk is carried
	Until  string // YYYY-MM-DD; empty = no expiry
}

VulnIgnore is an operator's explicit, recorded decision to carry a known advisory: which one, why, and until when. It is the only sanctioned way past a blocking vulnerability finding — the alternative, excluding a path or a package name, records no reason and never lapses, so it silently outlives whatever justified it.

type VulnInfo

type VulnInfo struct {
	ID       string   // e.g. "GHSA-xxxx-yyyy-zzzz", "CVE-2024-12345"
	Aliases  []string // other identifiers for the SAME advisory (CVE/GHSA/GO-… cross-refs)
	Summary  string   // short description
	Severity string   // "LOW", "MODERATE", "HIGH", "CRITICAL" (from OSV/CVSS)
	FixedIn  string   // version that fixes the vulnerability (if known)
	Source   string   // provenance: "osv" (default), "trivy", "grype", "trivy+grype"
}

VulnInfo describes a single known vulnerability affecting a dependency.

Directories

Path Synopsis
Package analysis is the supply-chain vulnerability analysis layer.
Package analysis is the supply-chain vulnerability analysis layer.
evidence
Package evidence is StageFreight's security-ENRICHMENT layer.
Package evidence is StageFreight's security-ENRICHMENT layer.

Jump to

Keyboard shortcuts

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