Documentation
¶
Overview ¶
Package rust implements the Rust/Cargo ecosystem.Ecosystem, backed by omnibump's RustAnalyzer.
Index ¶
- type Ecosystem
- func (e *Ecosystem) Analyze(ctx context.Context, files map[string][]byte) (*ecosystem.ModuleDeps, error)
- func (e *Ecosystem) BumpCoords(_ context.Context, bumps []scan.SecurityBump, deps *ecosystem.ModuleDeps) map[string]scan.SecurityBump
- func (e *Ecosystem) FilterBumps(_ context.Context, existing []string, bumps []scan.SecurityBump, ...) ([]string, []ecosystem.HeldBump)
- func (e *Ecosystem) ManifestFiles() (required, optional []string)
- func (e *Ecosystem) Name() string
- func (e *Ecosystem) ScanPackages(_ context.Context, deps *ecosystem.ModuleDeps) []scan.Package
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Ecosystem ¶
type Ecosystem struct {
// contains filtered or unexported fields
}
Ecosystem implements ecosystem.Ecosystem for Rust/Cargo projects. omnibump's RustAnalyzer has no checkout-free AnalyzeRemote, so Analyze materializes the fetched Cargo.lock into a real temp directory (via ecosystem.WriteTempFiles) and calls the local Analyze against it.
func (*Ecosystem) BumpCoords ¶
func (e *Ecosystem) BumpCoords(_ context.Context, bumps []scan.SecurityBump, deps *ecosystem.ModuleDeps) map[string]scan.SecurityBump
BumpCoords maps each OSV bump to its rendered-grammar coordinate (see ecosystem.SplitDep): the crate name for a crate locked at one version, "crate@locked" for one locked at several, matching the pinned entries FilterBumps renders for it.
func (*Ecosystem) FilterBumps ¶
func (e *Ecosystem) FilterBumps(_ context.Context, existing []string, bumps []scan.SecurityBump, deps *ecosystem.ModuleDeps) ([]string, []ecosystem.HeldBump)
FilterBumps merges existing entries and candidate bumps per crate and Cargo semver line, keeping the highest version in each line (an existing entry is never lowered). A pinned entry "crate@from=to" belongs to the line of from, a bump to the line of its CurrentVersion. An entry is dropped when no locked version shares its line, or when the highest locked version in that line is already at or above it, so a stale pin never downgrades. A fix that is not a Cargo-compatible upgrade of its locked version (a different major, or for 0.x a different minor: 0.12 -> 0.14 is a breaking change under Cargo's caret rules, which Cargo.toml requirements - not fetched here - would refuse) is held back, never written. A crate locked at one version renders as "crate@version"; one locked at several renders one "crate@<locked>=version" per line, since omnibump keys plain entries by crate name and a second would overwrite the first. Omnibump's own per-line constraint resolution is not replicated.
ponytail: two locked versions in the same semver line (Cargo normally merges them) share one entry, pinned from the highest; split by exact locked version if that ever shows up in a real Cargo.lock.
func (*Ecosystem) ManifestFiles ¶
ManifestFiles returns Cargo.lock only: omnibump's RustAnalyzer.Analyze reads Cargo.lock exclusively and never consults Cargo.toml.