schema_version = 1
detector_id = "basic-auth-credentials"
service = "generic"
severity = "high"
[[positive]]
text = "Authorization: Basic YWxhZGRpbjpvcGVuc2VzYW1l"
credential = "YWxhZGRpbjpvcGVuc2VzYW1l"
reason = "Canonical RFC 7617 Authorization header; blob = base64(aladdin:opensesame)."
[[positive]]
text = "curl -H 'Authorization: Basic YWRtaW46czNjcmV0UEBzc3cwcmQ=' https://api.internal/health"
credential = "YWRtaW46czNjcmV0UEBzc3cwcmQ="
reason = "Basic-auth header embedded in a curl command (the dominant real leak shape)."
[[positive]]
text = "headers = { \"Authorization\": \"Basic c3ZjLWRlcGxveTpHaDlfa0xtTjJwUXI=\" }"
credential = "c3ZjLWRlcGxveTpHaDlfa0xtTjJwUXI="
reason = "Hardcoded Basic-auth header in source (svc-deploy:Gh9_kLmN2pQr), 32-char blob."
[[negative]]
text = "Basic auth is required to reach this endpoint."
reason = "`Basic ` followed by the 4-char word `auth`, not a >=16-char base64 blob."
[[negative]]
text = "Covers the basics of authentication and session handling."
reason = "`basics`: no whitespace immediately after `basic`, so the `\\bbasic\\s+` anchor cannot match."
[[negative]]
text = "Basic Plan: upgrade for more storage."
reason = "Marketing prose; `Basic ` + short word, no base64 blob."
[[negative]]
text = "Authorization: Basic YWJjZGVm"
reason = "Blob `YWJjZGVm` is only 8 chars (< the 16-char floor) (too short to be a real credential)."
[[evasion]]
text = "authorization: basic dXNlcm5hbWU6cGFzc3dvcmQ="
credential = "dXNlcm5hbWU6cGFzc3dvcmQ="
reason = "Lower-cased header + scheme token (the (?i) flag must still surface it)."
[[evasion]]
text = "# Authorization: Basic cm9vdDp0b29yMTIzNGFiY2Q="
credential = "cm9vdDp0b29yMTIzNGFiY2Q="
reason = "Commented-out header stashed in a config/script (must still fire)."
[perf]
fixture_bytes = 4096
max_microseconds = 15000
note = "Single anchored alternation; the >=16-char base64 capture cannot run away."
[scale]
fixture_bytes = 1048576
min_findings = 1
max_seconds = 2.0
note = "1 MiB punctuation filler with one planted Basic-auth header; anchored regex stays linear."