Private key regex is greedy
Author: SimonGurneyCreated Jan 30, 2023Updated Sep 23, 2026
When a file contains two private keys, gitleaks greedy matches both into one detection.
The regex should be changed to be none greedy so it detects two private keys seperately.
-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY( BLOCK)?-----[\s\S-]*?KEY( BLOCK)?----
^Source: gitleaks/gitleaks