gitleaks / gitleaks

Protect and discover secrets using Gitleaks 🔑

Home Page:https://gitleaks.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enhance gitleaks:allow to be usable outside the same line

AnselmD opened this issue · comments

Is your feature request related to a problem? Please describe.
In some "languages" only allows complete comment lines but they do not allow to add comments to the same line as a statement. e.g. key=value in java .properties files.
Or in multi line shell script statements. Between the lines it is not possible (without tricks) to place a comment with gitleaks:allow Example:
echo 1 &&
echo 2 &&
echo "detected secret" &&
echo 4

Describe the solution you'd like
Enhance gitleaks:allow so that it is also usable before or after the line with the secret.
e.g:
gitleaks:allow_next_line
or better:
gitleaks:allow_line:+1 (the leak to allow is 1 lines beyond it; so in the next line)
gitleaks:allow_line:+3 (the leak to allow is 3 lines beyond it)
gitleaks:allow_line:-3 (the leak to allow is 3 lines before it)

Describe alternatives you've considered
Putting fingerprint to .gitleakignore

cc @zricethezav

@AnselmD I like this idea! If any community members want to pick this up I would be happy to review a PR for it. I can try to get to it but I can't guarantee a short turnaround for it