Documentation
¶
Overview ¶
Package audit runs security scanners (dependency vulnerabilities, static analysis, secrets) for the project aitk manages.
Index ¶
- Variables
- func CompareVersions(a, b string) int
- func DefaultBinDir() string
- func Detect(p *project.Project) (scanners []project.Scanner, missing []string)
- func HasManifest(root string) bool
- func Run(p *project.Project, stream bool) (*task.Audit, []string)
- func ScanTrackedFiles(p *project.Project) []secrets.Finding
- type Install
- type VulnPackage
- type VulnVersion
Constants ¶
This section is empty.
Variables ¶
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
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 ¶
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
HasManifest reports whether the project at root has dependency manifests that a vulnerability scanner can check.
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
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.