secrets

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package secrets provides regex-based secret detection in files. This is pure pattern matching — no AI/LLM involved.

Index

Constants

This section is empty.

Variables

View Source
var FolderBlacklist = []string{
	"node_modules",
	".git",
	"vendor",
	"__pycache__",
	".venv",
	"dist",
	"build",
	"bin",
	"out",
	".env",
}

FolderBlacklist contains directory names that should never be committed.

View Source
var NameBlacklist = []string{
	".env",
	".env.local",
	".env.production",
	".pem",
	".key",
	".p12",
	".pkcs8",
	".keystore",
	"credentials.json",
	"credentials.yaml",
	"secrets.yaml",
	"secrets.yml",
	"id_rsa",
	"id_ecdsa",
	"id_ed25519",
	"git-courer",
}

NameBlacklist contains file patterns/names that should never be committed.

Functions

func Detect

func Detect(files []string) ([]domain.SecretDetection, error)

Detect checks if files contain secrets using regex patterns.

func ExtractFilename

func ExtractFilename(path string) string

ExtractFilename extracts just the filename from a full path.

func IsBinary

func IsBinary(path string) bool

IsBinary returns true if the file at path is a binary executable.

func IsBlacklistedFolder

func IsBlacklistedFolder(path string) bool

IsBlacklistedFolder checks if any component of the path is in the folder blacklist. Example: "vendor/foo/bar" → true (vendor is blacklisted) Example: "src/main.go" → false

func IsBlacklistedName

func IsBlacklistedName(name string) bool

IsBlacklistedName checks if the filename matches the name blacklist.

Types

This section is empty.

Jump to

Keyboard shortcuts

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