gitguard

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package gitguard provides security checks for environment files and git repositories.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GeneratePreCommitHook

func GeneratePreCommitHook() string

GeneratePreCommitHook returns the content of a pre-commit hook script.

func InstallHook

func InstallHook(repoPath string) error

InstallHook installs the pre-commit hook in the given git repository.

Types

type Finding

type Finding struct {
	Type     string `json:"type"`
	File     string `json:"file,omitempty"`
	Line     int    `json:"line,omitempty"`
	Pattern  string `json:"pattern,omitempty"`
	Message  string `json:"message"`
	Severity string `json:"severity"`
}

Finding represents a security finding.

func CheckGitignore

func CheckGitignore(rootPath, envFile string) *Finding

CheckGitignore checks if the given env file is listed in .gitignore.

func ScanForSecrets

func ScanForSecrets(filePath string, patterns []SecretPattern) ([]Finding, error)

ScanForSecrets scans a file for common secret patterns.

type SecretPattern

type SecretPattern struct {
	Name    string
	Pattern *regexp.Regexp
}

SecretPattern represents a pattern for detecting secrets.

func DefaultPatterns

func DefaultPatterns() []SecretPattern

DefaultPatterns returns the built-in secret detection patterns.

Jump to

Keyboard shortcuts

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