Documentation
¶
Overview ¶
Package ghainit writes a repository's managed Vulnetix workflow from what the repository is made of and a small policy file. The workflow uses the granular actions: one or two languages or package managers get parallel jobs plus a rest step, three or more get the high-level scanner.
Index ¶
Constants ¶
const ( // TriggerPR scans pull requests and pushes to main. TriggerPR = "pr" // TriggerPush scans pushes to main. TriggerPush = "push" // TriggerBelai scans pushes to main and pull requests from belai/ branches. TriggerBelai = "belai" )
Trigger models. Each maps to the `on:` and job conditions of one kind of repo.
const PolicyPath = ".vulnetix/workflow.yaml"
PolicyPath is the policy file, relative to the repository root.
const WorkflowPath = ".github/workflows/vulnetix.yml"
WorkflowPath is the file `gha init` manages.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Extra ¶
type Extra struct {
Action string `yaml:"action"`
ID string `yaml:"id,omitempty"`
With map[string]string `yaml:"with,omitempty"`
// Prior are catalogue actions run first in the same job, for an action that
// reads what they write (report after sca, bom-validate after sbom).
Prior []string `yaml:"prior,omitempty"`
// Run are shell lines run before the action.
Run []string `yaml:"run,omitempty"`
// Then are shell lines run after the action, to check what it left behind.
Then []string `yaml:"then,omitempty"`
// Needs names a job whose SBOM or results this one reads.
Needs string `yaml:"needs,omitempty"`
// Permissions are added to the job's contents: read.
Permissions map[string]string `yaml:"permissions,omitempty"`
}
Extra is one catalogue action run as its own job.
type Options ¶
type Options struct {
// Ref is the action ref, v0 by default.
Ref string
// CheckoutRef is the actions/checkout ref.
CheckoutRef string
}
Options are the values a render needs beyond the policy.
type Policy ¶
type Policy struct {
Version int `yaml:"version"`
Triggers string `yaml:"triggers"`
// Runner is the self-hosted pool's label. Empty uses ubuntu-latest everywhere.
Runner string `yaml:"runner,omitempty"`
// Publish uploads SARIF to code scanning. Code scanning returns 403 on a
// private repository without Code Security, so private repositories leave it off.
Publish bool `yaml:"publish,omitempty"`
SAST Selection `yaml:"sast"`
SCA Selection `yaml:"sca"`
// NoRest leaves out the rest step, for a fixture whose legs are every
// language it has. Without the step a finding outside the legs goes unseen.
NoRest bool `yaml:"no_rest,omitempty"`
Secrets *bool `yaml:"secrets,omitempty"`
SBOM *bool `yaml:"sbom,omitempty"`
IaC string `yaml:"iac,omitempty"` // auto, on, off
Containers string `yaml:"containers,omitempty"` // auto, on, off
License bool `yaml:"license,omitempty"`
Malscan bool `yaml:"malscan,omitempty"`
CBOM bool `yaml:"cbom,omitempty"`
AIBOM bool `yaml:"aibom,omitempty"`
Analyze bool `yaml:"analyze,omitempty"`
// Gates maps a scanner to its --fail-on. A scanner with no gate reports and
// never fails the job. There is no baseline, so a gate goes on once a run is
// clean at that level.
Gates map[string]string `yaml:"gates,omitempty"`
// Rules are external rule packs per scanner: sast, secrets, iac, sast/go.
Rules map[string][]string `yaml:"rules,omitempty"`
// TEA publishes each run's BOMs to the Transparency Exchange API. Nil is on.
TEA *TEA `yaml:"tea,omitempty"`
Extras []Extra `yaml:"extras,omitempty"`
}
Policy is .vulnetix/workflow.yaml.
func LoadPolicy ¶
LoadPolicy reads root's policy, or nil when it has none.