audit

package
v2.11.1 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: Apache-2.0 Imports: 21 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package audit runs security scanners (dependency vulnerabilities, static analysis, secrets) for the project aitk manages.

Index

Constants

This section is empty.

Variables

View Source
var OSVReleaseURL = "https://github.com/google/osv-scanner/releases/latest/download"

OSVReleaseURL is where osv-scanner release assets are downloaded from.

Functions

func CompareVersions added in v2.4.0

func CompareVersions(a, b string) int

CompareVersions orders package versions across the common schemes: SemVer (build metadata ignored, pre-releases before the release), PEP 440 ("2.0.0rc1" < "2.0.0", "1.10a1" > "1.9"), and Maven qualifiers (".Final" equals the release). "" is lower than any version.

func DefaultBinDir added in v2.3.0

func DefaultBinDir() string

DefaultBinDir is where downloaded scanners go: next to aitk's own default install.

func Detect

func Detect(p *project.Project) (scanners []project.Scanner, missing []string)

Detect returns the scanners to run: [security].scanners when configured, else the ones installed and relevant to this repository. The built-in secret scan always runs.

func HasManifest added in v2.3.0

func HasManifest(root string) bool

HasManifest reports whether the project at root has dependency manifests that a vulnerability scanner can check.

func Run

func Run(p *project.Project, stream bool) (*task.Audit, []string)

Run executes the scanners and the built-in secret scan.

func ScanTrackedFiles

func ScanTrackedFiles(p *project.Project) []secrets.Finding

ScanTrackedFiles scans every tracked text file for credentials.

Types

type Install added in v2.3.0

type Install struct {
	Path    string `json:"path"`
	Method  string `json:"method"` // present | brew | download
	Version string `json:"version,omitempty"`
}

Install is the result of InstallOSV.

func InstallOSV added in v2.3.0

func InstallOSV(dir string, useBrew bool, log io.Writer) (*Install, error)

InstallOSV makes osv-scanner available: it keeps an installed one (on PATH or in dir), uses Homebrew on macOS when present, and otherwise downloads the official release binary into dir after verifying its SHA-256 against the same release's checksum file. The checksum guards against corrupted or truncated downloads; it is not a signature.

type VulnPackage added in v2.4.0

type VulnPackage struct {
	Ecosystem   string        `json:"ecosystem"`
	Name        string        `json:"name"`
	Versions    []VulnVersion `json:"versions"`
	Advisories  []string      `json:"advisories"`
	MaxSeverity float64       `json:"max_severity,omitempty"` // CVSS
}

VulnPackage is one dependency with known vulnerabilities, as reported by osv-scanner, with every vulnerable version found in the repository.

func OSVPackages added in v2.4.0

func OSVPackages(root string) ([]VulnPackage, error)

OSVPackages runs osv-scanner with JSON output in root and groups advisories by package.

func ParseOSV added in v2.4.0

func ParseOSV(out []byte) ([]VulnPackage, error)

ParseOSV groups osv-scanner JSON output by package.

type VulnVersion added in v2.4.0

type VulnVersion struct {
	Version string   `json:"version"`
	FixedIn string   `json:"fixed_in,omitempty"` // lowest version that fixes every advisory, when known
	Sources []string `json:"sources"`
}

VulnVersion is one installed version of a vulnerable package.

Jump to

Keyboard shortcuts

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