scanners

package
v0.167.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 67 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 scanners holds Draugr's built-in scanners, which wrap individual security tools and normalize their output to SARIF.

See docs/ARCHITECTURE.md.

Index

Constants

View Source
const ReportPathToken = "{{draugr:report-path}}" // #nosec G101 -- an argv placeholder, not a credential

ReportPathToken marks the argv slot where a tool wants a path to write its report to. The harness replaces it with a real file and reads that back.

A tool that *opens* a file cannot be pointed at /dev/stdout. That is a symlink to the process's own fd 1, and opening it is not the same as writing to the descriptor it inherited: where stdout is a pipe. Which is every containerised runner, the open lands somewhere the parent never reads, and the tool exits 0 having written nothing. The parse then fails on empty input and blames the JSON.

Variables

This section is empty.

Functions

func FeedMaxAge added in v0.135.1

func FeedMaxAge() time.Duration

FeedMaxAge is the limit SetFeedMaxAge last set.

func NewCosign added in v0.126.0

func NewCosign() plugin.Scanner

NewCosign returns the Sigstore verification scanner.

func NewGitleaks added in v0.2.0

func NewGitleaks() plugin.Scanner

NewGitleaks returns a Scanner that runs Gitleaks over a checked-out repository to detect leaked secrets (credentials, tokens, keys). It serves the "secrets" control.

func NewGosec added in v0.14.0

func NewGosec() plugin.Scanner

NewGosec returns a Scanner that runs gosec, a Go-specialized static analyzer, over a checked-out repository. It is an optional second scanner for the "sast" control (alongside Semgrep); it only makes sense on Go components, so it is opt-in via controls.sast.gosec.enabled.

func NewGovulncheck added in v0.101.0

func NewGovulncheck() plugin.Scanner

NewGovulncheck returns the govulncheck scanner: reachability analysis for Go modules.

It answers a different question from the other sca scanners. Trivy reads a manifest and says which dependencies have known vulnerabilities; govulncheck builds a call graph from the packages that are actually in the build and says which of those vulnerabilities this code can reach. The two are complementary rather than competing, which is why what this produces is folded onto existing findings rather than reported alongside them.

func NewGrype added in v0.91.0

func NewGrype() plugin.Scanner

NewGrype returns a Scanner that runs Anchore Grype against container images and returns its native SARIF output. It serves the "images" control, alongside Trivy rather than instead of it.

func NewGrypeFS added in v0.91.0

func NewGrypeFS() plugin.Scanner

NewGrypeFS returns a Scanner that runs Grype over a checked-out repository to find dependency vulnerabilities (SCA). It serves the "sca" control.

func NewHTTPHeaders added in v0.9.0

func NewHTTPHeaders() plugin.Scanner

NewHTTPHeaders returns the native HTTP security-header scanner.

func NewK8sPolicies added in v0.47.0

func NewK8sPolicies() plugin.Scanner

NewK8sPolicies returns a Scanner that reads the CIS policies section through the Kubernetes API.

func NewKubeBench added in v0.45.0

func NewKubeBench() plugin.Scanner

NewKubeBench returns a Scanner for the "kubernetes" control.

func NewKubeBenchJob added in v0.46.0

func NewKubeBenchJob() plugin.Scanner

NewKubeBenchJob returns a Scanner that runs the CIS benchmark inside the cluster.

func NewMendLicenses added in v0.71.0

func NewMendLicenses() plugin.Scanner

NewMendLicenses returns a Scanner for the "licenses" control backed by Mend.

func NewMendSCA added in v0.70.0

func NewMendSCA() plugin.Scanner

NewMendSCA returns a Scanner for the "sca" control backed by Mend.

func NewNotation added in v0.126.0

func NewNotation() plugin.Scanner

NewNotation returns the Notary Project verification scanner.

func NewNuclei added in v0.28.0

func NewNuclei() plugin.Scanner

NewNuclei returns a Scanner that runs Nuclei for the "dast" control. Nuclei is a single Go binary that probes a live endpoint with a large community template library; Draugr parses its JSONL output rather than its SARIF export, so severity, the matched URL, and CWEs map cleanly onto Draugr's model.

func NewProwler added in v0.145.0

func NewProwler() plugin.Scanner

NewProwler returns the scanner for the "cloud" control.

func NewRetireJS added in v0.94.0

func NewRetireJS() plugin.Scanner

NewRetireJS returns a Scanner that runs retire.js over a checked-out repository to find known vulnerable JavaScript that never appears in a lockfile. It serves the "sca" control, opt-in beside Trivy rather than instead of it.

Lockfile-based SCA answers for what the package manager installed. Front-end code routinely ships JavaScript it did not: a library pulled from a CDN, a vendored file under static/, bundled output shipped without its manifest. retire.js fingerprints those by content, which is the only way to identify a file whose provenance was never recorded.

The gap matters because of its shape rather than its size. A repository serving a five-year-old jQuery scans clean today. The control runs, reports, and passes, so nothing about the output suggests anywhere left to look.

func NewSARIFImport added in v0.151.0

func NewSARIFImport() plugin.Scanner

NewSARIFImport returns the scanner every import is planned for.

func NewSemgrep added in v0.3.0

func NewSemgrep() plugin.Scanner

NewSemgrep returns a Scanner that runs Semgrep over a checked-out repository for static application security testing (SAST). It serves the "sast" control.

func NewTLSProbe added in v0.31.0

func NewTLSProbe() plugin.Scanner

NewTLSProbe returns the native TLS configuration scanner.

func NewTrivy

func NewTrivy() plugin.Scanner

NewTrivy returns a Scanner that runs Aqua Trivy against container images. It serves the "images" control.

JSON rather than SARIF, for the reason the filesystem scanner already reads JSON: the SARIF names the package only in prose. An image finding needs three facts a consumer can act on, which package, which image, and which operating system. And the last two have no SARIF field at all, so a platform that files findings by report type has nothing to file these under.

func NewTrivyConfig added in v0.4.0

func NewTrivyConfig() plugin.Scanner

NewTrivyConfig returns a Scanner that runs Trivy's misconfiguration scanner over a checked-out repository to find insecure Infrastructure-as-Code (Terraform, Kubernetes manifests, Dockerfiles, Helm, …). It serves the "iac" control.

func NewTrivyFS

func NewTrivyFS() plugin.Scanner

NewTrivyFS returns a Scanner that runs Trivy in filesystem mode over a checked-out repository to find dependency vulnerabilities (SCA). It serves the "sca" control. (License findings are not included in Trivy's SARIF output and are tracked separately.)

func NewTrivyLicense added in v0.43.0

func NewTrivyLicense() plugin.Scanner

NewTrivyLicense returns a Scanner that reports licenses carrying an obligation, in a component's repositories and in its images.

Both, because the reader's question, what am I obliged by. Has no target kind in it. A license obligation inside an image was invisible while this read repositories only, and silently so: the control ran, reported covered, and the surface it had not examined had no name in the output. A third-party image is exactly where the source repository is not declared, because the team does not build it, so the gap landed hardest where the question was least answerable by hand.

One scanner over two kinds rather than two scanners, so a component's license policy cannot differ by where the code happens to live, and `doctor` lists one tool.

func NewURLhaus added in v0.66.0

func NewURLhaus() plugin.Scanner

NewURLhaus returns the abuse.ch URLhaus threat-intelligence scanner.

func NewVirusTotal added in v0.66.0

func NewVirusTotal() plugin.Scanner

NewVirusTotal returns the VirusTotal domain-reputation scanner.

func SetFeedMaxAge added in v0.133.0

func SetFeedMaxAge(d time.Duration)

SetFeedMaxAge sets how old a cached feed may be before a scan refuses to read it. Zero or less means never too old, for a runner deliberately pinned to a known copy.

Types

type Signature added in v0.129.0

type Signature struct {
	Identity string // the Fulcio SAN, empty where a signature is present and its identity is not
	Issuer   string // the OIDC issuer that vouched for it
	Signed   bool   // whether the registry holds a signature at all
}

Signature is who a registry says signed an image.

Unsigned and unreadable are separate answers. An image nobody signed is the ordinary case for anything published by somebody else, and an image signed by an identity that could not be read is a signature the reader should go and look at.

func WhoSigned added in v0.129.0

func WhoSigned(ctx context.Context, ref, trustRoot string) (Signature, error)

WhoSigned reports the Sigstore signature on an image, for a caller proposing who should be trusted to sign it.

The same read the control performs when a descriptor has declared no signer, exported so that discovery and verification ask the registry the same question. Written twice they would answer differently on the case that matters: an attestation carries its identity in the certificate rather than the payload, so the naive read succeeds with an empty answer and the images most likely to have provenance are the ones discovery would say nothing about. trustRoot is the descriptor's own Sigstore root where it set one, and empty for the public root. A discovery that skipped it would report nothing for exactly the organizations that run their own Sigstore, which are the ones whose signers are least guessable.

Jump to

Keyboard shortcuts

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