gitleaks

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectConfigPath

func DetectConfigPath(repoRoot string) string

func GetPlatform

func GetPlatform() string

GetPlatform returns the platform identifier for Gitleaks releases.

Types

type BinaryManager

type BinaryManager struct {
	// contains filtered or unexported fields
}

BinaryManager handles detection and installation of the Gitleaks binary.

func NewBinaryManager

func NewBinaryManager(customPath string) *BinaryManager

NewBinaryManager creates a new binary manager.

func (*BinaryManager) Download

func (bm *BinaryManager) Download(version string) (string, error)

Download fetches the requested version (or latest) and stores it in the cache.

func (*BinaryManager) Find

func (bm *BinaryManager) Find(expectedVersion string) (string, error)

Find locates a Gitleaks binary honoring an expected version (when provided). Search order:

  1. Custom path (if configured)
  2. $PATH
  3. Versioned cache (~/.redactyl/bin/gitleaks-<version>)
  4. Legacy cache (~/.redactyl/bin/gitleaks)

func (*BinaryManager) Version

func (bm *BinaryManager) Version(binaryPath string) (string, error)

Version runs gitleaks --version and parses the output.

type GitleaksFinding

type GitleaksFinding struct {
	Description string   `json:"Description"`
	RuleID      string   `json:"RuleID"`
	Match       string   `json:"Match"`
	Secret      string   `json:"Secret"`
	StartLine   int      `json:"StartLine"`
	EndLine     int      `json:"EndLine"`
	StartColumn int      `json:"StartColumn"`
	EndColumn   int      `json:"EndColumn"`
	File        string   `json:"File"`
	Commit      string   `json:"Commit"`
	Entropy     float64  `json:"Entropy,omitempty"`
	Author      string   `json:"Author,omitempty"`
	Email       string   `json:"Email,omitempty"`
	Date        string   `json:"Date,omitempty"`
	Message     string   `json:"Message,omitempty"`
	Tags        []string `json:"Tags,omitempty"`
	Fingerprint string   `json:"Fingerprint,omitempty"`
}

GitleaksFinding represents Gitleaks JSON output format.

type Scanner

type Scanner struct {
	// contains filtered or unexported fields
}

Scanner implements the scanner.Scanner interface using Gitleaks.

func NewScanner

func NewScanner(cfg config.GitleaksConfig) (*Scanner, error)

NewScanner creates a new Gitleaks scanner from configuration.

func (*Scanner) Detectors

func (s *Scanner) Detectors() ([]string, error)

Detectors implements scanner.Scanner.

func (*Scanner) Scan

func (s *Scanner) Scan(path string, data []byte) ([]types.Finding, error)

Scan implements scanner.Scanner.

func (*Scanner) ScanBatch

func (s *Scanner) ScanBatch(inputs []scanner.BatchInput) ([]types.Finding, error)

ScanBatch implements scanner.Scanner by scanning multiple inputs in a single gitleaks invocation.

func (*Scanner) ScanWithContext

func (s *Scanner) ScanWithContext(ctx scanner.ScanContext, data []byte) ([]types.Finding, error)

ScanWithContext implements scanner.Scanner with artifact context.

func (*Scanner) Version

func (s *Scanner) Version() (string, error)

Version implements scanner.Scanner.

Jump to

Keyboard shortcuts

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