Configuration
Exclude paths, allow known test values, tune entropy detection and record reviewed findings.
nosecrets loads .nosecrets.toml and .nosecretsignore from the repository root. Common generated
directories such as .git, node_modules, target, dist, build and coverage output are ignored
by default.
Repository configuration
[ignore]
paths = ["vendor/", "fixtures/**"]
[allow]
patterns = ["^test_[A-Za-z0-9]+$"]
values = ["AKIAIOSFODNN7EXAMPLE"]
[entropy]
enabled = true
min_length = 20
threshold = 4.2
require_context = true
[entropy.allow]
patterns = ["^[a-f0-9]{32,}$"]
[scan]
max_file_size = 5242880
Global allow patterns and values apply to all findings. Entropy-specific patterns apply only to
the high-entropy detector. With require_context = true, entropy candidates must appear near terms
such as secret, token, key, auth or password.
Files larger than scan.max_file_size bytes (default 5 MiB) are skipped; nosecrets states on stderr
how many. Set it to 0 to scan files of any size.
An unknown key anywhere in .nosecrets.toml stops the scan with an error that names the key.
Fingerprint ignores
.nosecretsignore accepts one stable fingerprint per line. Add :<path-glob> to limit an exception:
nsi_a1b2c3d4e5f6
nsi_b2c3d4e5f6a7:tests/fixtures/**
The CLI can append the same entries:
nosecrets ignore nsi_a1b2c3d4e5f6
nosecrets ignore nsi_b2c3d4e5f6a7 --path 'tests/fixtures/**'
Inline ignores
Use an inline marker only when the reason is obvious beside the value:
api_key = "documented-example" # @nosecrets-ignore
api_key = "documented-example" # @nsi test fixture
api_key = "documented-example" # gitleaks:allow
A marker must stand as a separate word, after whitespace or a comment opener. The same characters inside an e-mail address or a longer word are not a marker.
Caution
An allowlist suppresses a finding; it does not make the value safe. Prefer narrow path-scoped fingerprints for individual reviewed cases.