Documentation
¶
Overview ¶
Package beforerun provides a reusable API for statically inspecting untrusted repositories before project-controlled code is executed.
Index ¶
- Constants
- func DiffAgainstBaseline(root, path string, options Options) (Delta, Summary, error)
- func ReadIgnoreFile(root string) ([]string, error)
- func WriteBaseline(writer io.Writer, summary Summary) error
- type Baseline
- type Delta
- type Finding
- type Options
- type Severity
- type SeverityChange
- type Summary
Constants ¶
const ( SeverityInfo = model.SeverityInfo SeverityLow = model.SeverityLow SeverityMedium = model.SeverityMedium SeverityHigh = model.SeverityHigh SeverityCritical = model.SeverityCritical )
const BaselineFormatVersion = 1
BaselineFormatVersion is the supported on-disk baseline schema version.
Variables ¶
This section is empty.
Functions ¶
func DiffAgainstBaseline ¶ added in v1.2.0
DiffAgainstBaseline scans root and compares the result with the stored baseline.
func ReadIgnoreFile ¶
ReadIgnoreFile parses .beforerunignore from root. A missing file is not an error.
Types ¶
type Baseline ¶ added in v1.2.0
type Baseline struct {
FormatVersion int `json:"format_version"`
CreatedAt time.Time `json:"created_at"`
Summary Summary `json:"summary"`
}
Baseline is a durable scan snapshot used for CI diff gates.
type Delta ¶ added in v1.1.0
type Delta struct {
Added []Finding `json:"added"`
Resolved []Finding `json:"resolved"`
Escalated []SeverityChange `json:"escalated"`
Deescalated []SeverityChange `json:"deescalated"`
RiskScoreDelta int `json:"risk_score_delta"`
}
Delta describes the security difference between two scan summaries.
func Compare ¶ added in v1.1.0
Compare returns a deterministic delta between previous and current scans. Finding identity is based on rule, repository-relative path, line, and message.
func (Delta) Clean ¶ added in v1.1.0
Clean reports whether the current scan introduced no findings or severity changes.
func (Delta) IntroducesAt ¶ added in v1.1.0
IntroducesAt reports whether the delta adds or escalates a finding at or above threshold.
type Options ¶
type Options struct {
// Threshold determines when Summary.ThresholdMet becomes true.
Threshold Severity
// Ignores contains repository-relative path prefixes to skip.
Ignores []string
}
Options controls scan behavior.
type Severity ¶
Severity describes the impact of a finding.
func ParseSeverity ¶
ParseSeverity converts a textual severity into its typed value.
type SeverityChange ¶ added in v1.1.0
SeverityChange records a finding whose severity changed between scans.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
beforerun
command
Command beforerun scans untrusted repositories before project-controlled code is executed.
|
Command beforerun scans untrusted repositories before project-controlled code is executed. |
|
internal
|
|
|
model
Package model defines BeforeRun's findings, severities, risk weights, and scan summary data structures.
|
Package model defines BeforeRun's findings, severities, risk weights, and scan summary data structures. |
|
report
Package report renders BeforeRun scan summaries as human-readable text or machine-readable JSON.
|
Package report renders BeforeRun scan summaries as human-readable text or machine-readable JSON. |
|
scanner
Package scanner statically inspects repository files for execution surfaces and suspicious content without running project-controlled code.
|
Package scanner statically inspects repository files for execution surfaces and suspicious content without running project-controlled code. |