controllers

package
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package controllers holds Draugr's built-in controllers (e.g. images, sast, opensource, dast), each orchestrating scanners for one security control.

See docs/ARCHITECTURE.md.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDAST added in v0.28.0

func NewDAST() plugin.Controller

NewDAST returns the dast controller.

func NewHeaders added in v0.9.0

func NewHeaders() plugin.Controller

NewHeaders returns the headers controller.

func NewIAC added in v0.4.0

func NewIAC() plugin.Controller

NewIAC returns the iac controller.

func NewImages

func NewImages() plugin.Controller

NewImages returns the images controller.

func NewInfrastructure added in v0.45.0

func NewInfrastructure() plugin.Controller

NewInfrastructure returns the infrastructure controller.

func NewLicenses added in v0.43.0

func NewLicenses() plugin.Controller

NewLicenses returns the licenses controller.

func NewSAST added in v0.3.0

func NewSAST() plugin.Controller

NewSAST returns the sast controller.

func NewSCA

func NewSCA() plugin.Controller

NewSCA returns the sca controller.

func NewSecrets added in v0.2.0

func NewSecrets() plugin.Controller

NewSecrets returns the secrets controller.

func NewTLS added in v0.31.0

func NewTLS() plugin.Controller

NewTLS returns the tls controller.

func SelectedScanners added in v0.48.0

func SelectedScanners(model saga.Model, control string, defaults []string) map[string]bool

SelectedScanners returns the scanner names a control will actually run for this model — the union of the selection across every component.

This is what a control *requires*, as opposed to every scanner that could serve it. Those differ wherever a control has more than one scanner: `sast` demanding gosec from a project that never enabled it, or `infrastructure` demanding kube-bench and kubectl when the default reads the API and needs neither. Either way the report is a list of tools to go and install that the scan would not have used — and, worse, a missing one reads as a control that cannot run.

defaults must be the controller's own DefaultScanners, so the answer matches what Plan will do.

func SeverityFloor added in v0.5.0

func SeverityFloor(control string) sarif.Severity

SeverityFloor returns the minimum normalized severity for a control's findings, or an empty severity (no floor) when the control declares none. Used by prioritization when resolving a finding's severity.

Types

type DAST added in v0.28.0

type DAST struct{}

DAST is the dynamic application security testing control. It plans one Nuclei scan per running host declared on a component and aggregates the findings. Complements the "headers" control: dast covers runtime issues (exposures, misconfigurations, info disclosure, outdated libraries) while headers owns HTTP security-header checks.

func (DAST) Aggregate added in v0.28.0

func (DAST) Aggregate(reports []sarif.Report) (plugin.ControlResult, error)

Aggregate merges the scan reports and summarizes findings by severity.

func (DAST) Info added in v0.28.0

func (DAST) Info() plugin.ControllerInfo

Info identifies the controller (component-scoped).

func (DAST) Plan added in v0.28.0

func (DAST) Plan(_ saga.Model, comp *saga.Component) ([]plugin.ScanJob, error)

Plan produces one scan job per host with a URL declared on the component.

type Headers added in v0.9.0

type Headers struct{}

Headers is the HTTP security-header control. It plans one native header scan per host declared on a component and aggregates the findings. No external tool is required.

func (Headers) Aggregate added in v0.9.0

func (Headers) Aggregate(reports []sarif.Report) (plugin.ControlResult, error)

Aggregate merges the scan reports and summarizes findings by severity.

func (Headers) Info added in v0.9.0

func (Headers) Info() plugin.ControllerInfo

Info identifies the controller (component-scoped).

func (Headers) Plan added in v0.9.0

func (Headers) Plan(_ saga.Model, comp *saga.Component) ([]plugin.ScanJob, error)

Plan produces one scan job per host with a URL declared on the component.

type IAC added in v0.4.0

type IAC struct{}

IAC is the Infrastructure-as-Code / misconfiguration control: it scans a component's repositories for insecure IaC (Terraform, Kubernetes manifests, Dockerfiles, …). It plans one scan per repository.

func (IAC) Aggregate added in v0.4.0

func (IAC) Aggregate(reports []sarif.Report) (plugin.ControlResult, error)

Aggregate merges the scan reports and summarizes findings by severity. Trivy reports per-check severity, so severity is taken as reported.

func (IAC) Info added in v0.4.0

func (IAC) Info() plugin.ControllerInfo

Info identifies the controller (component-scoped).

func (IAC) Plan added in v0.4.0

func (IAC) Plan(_ saga.Model, comp *saga.Component) ([]plugin.ScanJob, error)

Plan produces one scan job per repository declared on the component.

type Images

type Images struct{}

Images is the container-image security control. It plans one Trivy scan per image in a component and aggregates the results.

func (Images) Aggregate

func (Images) Aggregate(reports []sarif.Report) (plugin.ControlResult, error)

Aggregate merges the scan reports and summarizes findings by severity.

func (Images) Info

func (Images) Info() plugin.ControllerInfo

Info identifies the controller (component-scoped).

func (Images) Plan

func (Images) Plan(_ saga.Model, comp *saga.Component) ([]plugin.ScanJob, error)

Plan produces one scan job per image declared on the component.

type Infrastructure added in v0.45.0

type Infrastructure struct{}

Infrastructure assesses the platform a component runs on against the CIS Kubernetes Benchmark.

Component-scoped rather than project-scoped, because that is where the Saga puts the data: `infrastructure:` is a list on a component, describing what that component runs on. Two components on the same cluster produce two jobs with the same target, which the engine collapses — so the shared case costs one scan, not two.

func (Infrastructure) Aggregate added in v0.45.0

func (Infrastructure) Aggregate(reports []sarif.Report) (plugin.ControlResult, error)

Aggregate merges the scan reports and summarizes findings by severity.

func (Infrastructure) Info added in v0.45.0

Info identifies the controller.

func (Infrastructure) Plan added in v0.45.0

func (Infrastructure) Plan(model saga.Model, comp *saga.Component) ([]plugin.ScanJob, error)

Plan produces one scan job per Kubernetes infrastructure entry on the component.

Infrastructure of another kind is skipped rather than failed: a Saga may describe surfaces Draugr has no benchmark for, and refusing to plan the ones it does understand would make the descriptor less useful the more honestly it was written.

type Licenses added in v0.43.0

type Licenses struct{}

Licenses reports dependency licences that carry an obligation.

A separate control rather than part of `sca`, deliberately. Licence risk is not a vulnerability: the exposure is legal and commercial, the policy is owned by different people, and it changes on a different cadence. Keeping it separate is also what lets `config.gate.controls` hold it to its own threshold — "fail on a forbidden licence but only warn on a medium CVE" is a reasonable position that one shared threshold cannot express.

func (Licenses) Aggregate added in v0.43.0

func (Licenses) Aggregate(reports []sarif.Report) (plugin.ControlResult, error)

Aggregate merges the scan reports and summarizes findings by severity.

func (Licenses) Info added in v0.43.0

Info identifies the controller (component-scoped).

func (Licenses) Plan added in v0.43.0

func (Licenses) Plan(model saga.Model, comp *saga.Component) ([]plugin.ScanJob, error)

Plan produces one scan job per repository, carrying the resolved licence policy.

type SAST added in v0.3.0

type SAST struct{}

SAST is the Static Application Security Testing control: it analyzes a component's own source code (not its dependencies) for security bugs. It plans one scan per repository, per selected scanner.

func (SAST) Aggregate added in v0.3.0

func (SAST) Aggregate(reports []sarif.Report) (plugin.ControlResult, error)

Aggregate merges the scan reports and summarizes findings by severity. Semgrep emits per-rule SARIF levels, so severity is taken as reported.

func (SAST) Info added in v0.3.0

func (SAST) Info() plugin.ControllerInfo

Info identifies the controller (component-scoped).

func (SAST) Plan added in v0.3.0

func (SAST) Plan(model saga.Model, comp *saga.Component) ([]plugin.ScanJob, error)

Plan produces a scan job for each repository × each selected sast scanner. Semgrep runs by default; a component opts a non-default scanner in per scanner block, e.g. a Go component enables gosec with `controllers.sast.gosec.enabled: true`.

type SCA

type SCA struct{}

SCA is the Software Composition Analysis control: dependency vulnerabilities (and, later, licenses) for a component's source repositories. It plans one scan per repository.

func (SCA) Aggregate

func (SCA) Aggregate(reports []sarif.Report) (plugin.ControlResult, error)

Aggregate merges the scan reports and summarizes findings by severity.

func (SCA) Info

func (SCA) Info() plugin.ControllerInfo

Info identifies the controller (component-scoped).

func (SCA) Plan

func (SCA) Plan(_ saga.Model, comp *saga.Component) ([]plugin.ScanJob, error)

Plan produces one scan job per repository declared on the component.

type Secrets added in v0.2.0

type Secrets struct{}

Secrets is the secret-detection control: it scans a component's repositories for leaked credentials. Any detected secret is treated as an error — a leaked secret should fail the gate regardless of how the scanner rated it.

func (Secrets) Aggregate added in v0.2.0

func (Secrets) Aggregate(reports []sarif.Report) (plugin.ControlResult, error)

Aggregate merges the scan reports and escalates every finding to error severity — a detected secret is always gate-failing.

func (Secrets) Info added in v0.2.0

func (Secrets) Info() plugin.ControllerInfo

Info identifies the controller (component-scoped).

func (Secrets) Plan added in v0.2.0

func (Secrets) Plan(_ saga.Model, comp *saga.Component) ([]plugin.ScanJob, error)

Plan produces one scan job per repository declared on the component.

type TLS added in v0.31.0

type TLS struct{}

TLS is the transport-security control. It plans one native TLS probe per host declared on a component and aggregates the findings. No external tool is required.

func (TLS) Aggregate added in v0.31.0

func (TLS) Aggregate(reports []sarif.Report) (plugin.ControlResult, error)

Aggregate merges the scan reports and summarizes findings by severity.

func (TLS) Info added in v0.31.0

func (TLS) Info() plugin.ControllerInfo

Info identifies the controller (component-scoped).

func (TLS) Plan added in v0.31.0

func (TLS) Plan(model saga.Model, comp *saga.Component) ([]plugin.ScanJob, error)

Plan produces one scan job per host with a URL declared on the component, honoring the Saga's per-scanner selection and config under controllers.tls.<scanner>.

Jump to

Keyboard shortcuts

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