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
- func FeedMaxAge() time.Duration
- func NewCosign() plugin.Scanner
- func NewGitleaks() plugin.Scanner
- func NewGosec() plugin.Scanner
- func NewGovulncheck() plugin.Scanner
- func NewGrype() plugin.Scanner
- func NewGrypeFS() plugin.Scanner
- func NewHTTPHeaders() plugin.Scanner
- func NewK8sPolicies() plugin.Scanner
- func NewKubeBench() plugin.Scanner
- func NewKubeBenchJob() plugin.Scanner
- func NewMendLicenses() plugin.Scanner
- func NewMendSCA() plugin.Scanner
- func NewNotation() plugin.Scanner
- func NewNuclei() plugin.Scanner
- func NewProwler() plugin.Scanner
- func NewRetireJS() plugin.Scanner
- func NewSARIFImport() plugin.Scanner
- func NewSemgrep() plugin.Scanner
- func NewTLSProbe() plugin.Scanner
- func NewTrivy() plugin.Scanner
- func NewTrivyConfig() plugin.Scanner
- func NewTrivyFS() plugin.Scanner
- func NewTrivyLicense() plugin.Scanner
- func NewURLhaus() plugin.Scanner
- func NewVirusTotal() plugin.Scanner
- func SetFeedMaxAge(d time.Duration)
- type Signature
Constants ¶
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
FeedMaxAge is the limit SetFeedMaxAge last set.
func NewGitleaks ¶ added in v0.2.0
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
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
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
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
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
NewHTTPHeaders returns the native HTTP security-header scanner.
func NewK8sPolicies ¶ added in v0.47.0
NewK8sPolicies returns a Scanner that reads the CIS policies section through the Kubernetes API.
func NewKubeBench ¶ added in v0.45.0
NewKubeBench returns a Scanner for the "kubernetes" control.
func NewKubeBenchJob ¶ added in v0.46.0
NewKubeBenchJob returns a Scanner that runs the CIS benchmark inside the cluster.
func NewMendLicenses ¶ added in v0.71.0
NewMendLicenses returns a Scanner for the "licenses" control backed by Mend.
func NewMendSCA ¶ added in v0.70.0
NewMendSCA returns a Scanner for the "sca" control backed by Mend.
func NewNotation ¶ added in v0.126.0
NewNotation returns the Notary Project verification scanner.
func NewNuclei ¶ added in v0.28.0
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
NewProwler returns the scanner for the "cloud" control.
func NewRetireJS ¶ added in v0.94.0
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
NewSARIFImport returns the scanner every import is planned for.
func NewSemgrep ¶ added in v0.3.0
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
NewTLSProbe returns the native TLS configuration scanner.
func NewTrivy ¶
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
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 ¶
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
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
NewURLhaus returns the abuse.ch URLhaus threat-intelligence scanner.
func NewVirusTotal ¶ added in v0.66.0
NewVirusTotal returns the VirusTotal domain-reputation scanner.
func SetFeedMaxAge ¶ added in v0.133.0
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
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.
Source Files
¶
- cis_policies_catalog.go
- cosign.go
- csp.go
- csp_page.go
- datasources.go
- datastate.go
- doc.go
- fingerprint.go
- gitleaks.go
- gitleaks_allowed.go
- gitleaks_config.go
- gitleaks_unread.go
- gosec.go
- govulncheck.go
- govulncheck_buildgo.go
- govulncheck_gowork.go
- govulncheck_unloaded.go
- govulndb.go
- grype.go
- grype_excluded.go
- headers.go
- k8s_policies.go
- kube_bench.go
- kube_bench_job.go
- lockretry.go
- mend_licenses.go
- mend_sca.go
- mend_schema.go
- mend_session.go
- mend_settings.go
- notation.go
- nuclei.go
- openapi.go
- options.go
- pomscope.go
- prowler.go
- prowler_gcp_reads.go
- rating.go
- repo.go
- retirejs.go
- sarif_append.go
- sarifimport.go
- sarifimport_bandit.go
- schemas.go
- semgrep.go
- semgrep_rating.go
- semgrep_unread.go
- tls.go
- toolversion.go
- trivy-config.go
- trivy.go
- trivy_config_charts.go
- trivy_config_excluded.go
- trivy_config_modules.go
- trivy_license.go
- trivy_version.go
- trivy_vuln_json.go
- trivy_walk.go
- urlhaus.go
- virustotal.go