-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Algolia key support #865
Comments
Hi @SimonGurney, all semi-generic regexes follow a similar pattern to that of https://github.com/zricethezav/gitleaks/blob/master/config/gitleaks.toml#L74, for example. I generate these rules with a utility here https://github.com/zricethezav/gitleaks/blob/master/cmd/generate/config/main.go. I can add this sometime in the next two weeks if you haven't gotten to it already |
I'll get a PR in tomorrow. So does the keyword need to be found in the document for the regex to find the secret? |
@SimonGurney yes, the keyword is essentially a ROI marker or prefilter. If a git patch fragment does not contain a the keyword, that rule can be ignored. |
Ok understood. I think in most cases the word "Algolia" would be on the same line, but it's definitely not required and I imagine a diff which changes the key could be as simple as Key=[key] Would you want the keyword including or not? I guess it's a balance between eliminating false positives and missing secrets right? |
I don't follow
Keywords should always be included to reduce fps and help performance. The generic key would likely catch keys that don't contain |
Makes sense, I'll raise the PR tomorrow. Thanks for your help 😃 |
Is this what you were thinking, I just based it off old PRs, or do you want me to use the rule generator and add one to here cmd/generate/config/rules/? |
@zricethezav are you happy with the PR? |
An Algolia key matches the regex
[a-zA-Z0-9]{32}
.Algolia keys are quite common now and are often included in front end JS code to build autocomplete forms etc. Overly permissive keys are an issue as it means attackers can manipulate data etc and gitleaks would make an awesome tool to find them.
The regex for the key is likely prone to false positives, but no more so than "generic-api-key".
I am happy to do the PR on this, but I was wondering if you would consider a regex without an obvious prefix/suffix which would eliminate false positives.
cc @zricethezav
The text was updated successfully, but these errors were encountered: