rules

package
v0.151.2 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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.

Jump to

Keyboard shortcuts

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