security

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package security provides security scanning capabilities

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatFindings

func FormatFindings(findings []Finding) string

FormatFindings formats findings for display

Types

type Finding

type Finding struct {
	RuleID      string
	Description string
	File        string
	Line        int
	Secret      string // Redacted
	Match       string
	Commit      string
	Author      string
	Date        string
}

Finding represents a detected secret

type LeakScanner

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

LeakScanner provides secret detection capabilities

func NewLeakScanner

func NewLeakScanner() (*LeakScanner, error)

NewLeakScanner creates a new leak scanner with default gitleaks rules

func (*LeakScanner) LoadGitleaksIgnore

func (s *LeakScanner) LoadGitleaksIgnore(repoPath string) error

LoadGitleaksIgnore loads ignore patterns from .gitleaksignore

func (*LeakScanner) ScanDirectory

func (s *LeakScanner) ScanDirectory(ctx context.Context, path string) (*ScanResult, error)

ScanDirectory scans a directory for secrets

func (*LeakScanner) ScanGitRepo

func (s *LeakScanner) ScanGitRepo(ctx context.Context, repoPath string) (*ScanResult, error)

ScanGitRepo scans git history for secrets

func (*LeakScanner) ScanStagedChanges

func (s *LeakScanner) ScanStagedChanges(ctx context.Context, repoPath string) (*ScanResult, error)

ScanStagedChanges scans only staged git changes (for pre-commit/pre-push)

func (*LeakScanner) ScanUnpushedCommits

func (s *LeakScanner) ScanUnpushedCommits(ctx context.Context, repoPath string) (*ScanResult, error)

ScanUnpushedCommits scans commits that haven't been pushed yet

type ScanResult

type ScanResult struct {
	Findings    []Finding
	HasLeaks    bool
	ScannedPath string
}

ScanResult contains the results of a leak scan

Jump to

Keyboard shortcuts

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