sca

package
v0.45.4 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BinDirs = []string{"bin/", "sbin/", "usr/bin/", "usr/sbin/"}

BinDirs is the list of binary directories to search for commands. This is exported so that callers can append to it as needed.

View Source
var BootDirs = []string{"boot/...", "lib/modules/...", "usr/lib/modules/..."}

BootDirs is the list of directories to search for kernels. This is exported so that callers can append to it as needed. Scanning lib/modules and usr/lib/modules is done to make this work well for bootc, which suggests sticking kernel images at /usr/lib/modules/`uname -r`/vmlinuz.

View Source
var LibDirs = []string{"lib/", "usr/lib/", "lib64/", "usr/lib64/"}

LibDirs is the list of library directories to search for shared objects. This is exported so that callers can append to it as needed.

View Source
var ModuleDirs = []string{"usr/lib/modules/...", "lib/modules/..."}

ModuleDirs is the list of directories to search for kernel modules. This is exported so that callers can append to it as needed.

Functions

func Analyze

func Analyze(ctx context.Context, hdl SCAHandle, generated *config.Dependencies) error

Analyze runs the SCA analyzers on a given SCA handle, modifying the generated dependencies set as needed.

Types

type DependencyGenerator

type DependencyGenerator func(context.Context, SCAHandle, *config.Dependencies, []string) error

DependencyGenerator takes an SCAHandle, config.Dependencies pointer and a list of paths to be appended to LibDirs and returns findings based on analysis.

type SCAFS

type SCAFS interface {
	apkofs.ReadLinkFS

	Stat(name string) (fs.FileInfo, error)
}

SCAFS represents the minimum required filesystem accessors which are needed by the SCA engine.

type SCAHandle

type SCAHandle interface {
	// PackageName returns the name of the current package being analyzed.
	PackageName() string

	// RelativeNames returns the name of other packages related to the current
	// package being analyzed.
	RelativeNames() []string

	// Version returns the version and epoch of the package being analyzed.
	Version() string

	// FilesystemForRelative returns a usable filesystem representing the package
	// contents for a given package name.
	FilesystemForRelative(pkgName string) (SCAFS, error)

	// Filesystem returns a usable filesystem representing the current package.
	// It is equivalent to FilesystemForRelative(PackageName()).
	Filesystem() (SCAFS, error)

	// Options returns a config.PackageOption struct.
	Options() config.PackageOption

	// BaseDependencies returns the underlying set of declared dependencies before
	// the SCA engine runs.
	BaseDependencies() config.Dependencies

	// InstalledPackages returns a map [package name] => [package
	// version] for all build dependencies installed during build.
	InstalledPackages() map[string]string

	// PkgResolver returns the package resolver associated with
	// the current package/build being analyzed.
	PkgResolver() *apk.PkgResolver
}

SCAHandle represents all of the state necessary to analyze a package.

Jump to

Keyboard shortcuts

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