rustaudit

package module
v0.0.0-...-78e69ef Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2025 License: MIT Imports: 10 Imported by: 0

README

go-rustaudit

Go library for extracting Rust dependency information from Rust binaries built with cargo-auditable (previously named rust-audit).

It's used by trivy and syft to consume cargo-auditable information.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Returned if an executable is not a known format
	ErrUnknownFileFormat = errors.New("unknown file format")
	// errNoRustDepInfo is returned when an executable file doesn't contain Rust dependency information
	ErrNoRustDepInfo = errors.New("rust dependency information not found")
)

Functions

This section is empty.

Types

type DependencyKind

type DependencyKind string
const (
	Build   DependencyKind = "build"
	Runtime DependencyKind = "runtime"
)

type Package

type Package struct {
	Name         string         `json:"name"`
	Version      string         `json:"version"`
	Source       string         `json:"source"`
	Kind         DependencyKind `json:"kind"`
	Dependencies []uint         `json:"dependencies"`
	Features     []string       `json:"features"` // Removed in cargo-auditable 0.5.0
	Root         bool           `json:"root"`
}

func (*Package) UnmarshalJSON

func (p *Package) UnmarshalJSON(text []byte) error

Default the Kind to Runtime during unmarshalling

type VersionInfo

type VersionInfo struct {
	Packages []Package `json:"packages"`
}

This struct is embedded in dependencies produced with rust-audit: https://github.com/Shnatsel/rust-audit/blob/bc805a8fdd1492494179bd01a598a26ec22d44fe/auditable-serde/src/lib.rs#L89

func GetDependencyInfo

func GetDependencyInfo(r io.ReaderAt) (VersionInfo, error)

Jump to

Keyboard shortcuts

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