Documentation
¶
Overview ¶
Package rules holds the built-in gk guard policy rule implementations. Each file in this package contributes exactly one Rule to policy.Default.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SecretPatternsRule ¶
type SecretPatternsRule struct {
// GitleaksOpts are forwarded to scan.RunGitleaks. WorkDir is filled
// from Input.WorkDir so callers typically leave it empty.
GitleaksOpts scan.GitleaksOptions
}
SecretPatternsRule delegates secret scanning to the gitleaks binary when present, and returns a single informational Violation when the binary is missing so users see why the rule is a no-op in their environment.
Per the 2026-04-22 probe verdict, gk prefers the industry-standard gitleaks over maintaining a parallel scanner. The rule is intentionally thin — all detection logic lives in gitleaks; this adapter just maps GitleaksFindings to policy.Violations.
func NewSecretPatternsRule ¶
func NewSecretPatternsRule() *SecretPatternsRule
NewSecretPatternsRule returns a SecretPatternsRule with redaction enabled and git-history scan mode. Callers can tweak the exposed GitleaksOpts field after construction.
func (*SecretPatternsRule) Evaluate ¶
func (r *SecretPatternsRule) Evaluate(ctx context.Context, in policy.Input) ([]policy.Violation, error)
Evaluate runs gitleaks against the repo rooted at in.WorkDir. Each gitleaks Finding becomes a Violation with SeverityError. When gitleaks is absent, Evaluate emits one Info Violation explaining the fallback so users see why no findings appeared.
func (*SecretPatternsRule) Name ¶
func (*SecretPatternsRule) Name() string
Name implements policy.Rule.