Secret Scanning Beyond the Repository
The CI/CD course runs gitleaks on Git history, with custom rules, allowlists and baselines, and TruffleHog with verification. This lesson points the same scanner at the places teams forget: logs, build outputs and unpacked artifacts, and adds a rule for the secret linkly cares about most, its database URL.
A rule for connection strings
Database URLs with an embedded password (postgres://user:pass@host/db) are one of the most common leaks, and the default rules don't always flag them (as the CI/CD lesson showed). A custom rule with a capture group reports only the password part as the secret:
bash · try it yourself
cat > .gitleaks.toml <<'TOML'
[extend]
useDefault = true
[[rules]]
id = "postgres-url-password"
description = "Password embedded in a PostgreSQL connection URL"
regex = '''postgres(?:ql)?://[^:/\s]+:([^@\s]{6,})@'''
secretGroup = 1
keywords = ["postgres://", "postgresql://"]
[[rules.allowlists]]
description = "local development defaults"
regexes = ['''^(postgres|changeme|password)