Repository navigation
fix(security): configure gitleaks allowlist for test fixtures and public client IDs (#211) #291
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,15 @@ | |
| useDefault = true | ||
|
|
||
| [allowlist] | ||
| description = "Documentation placeholders, not credentials" | ||
| description = "Documentation placeholders, public OAuth/telemetry client constants, and test fixtures" | ||
| regexTarget = "match" | ||
| regexes = ['''^your_[a-z_]+>'''] | ||
| regexes = [ | ||
| '''^your_[a-z_]+>''', | ||
| '''phc_zjjbX0PnWxERXrMHhkEJWj9A9BhGVLRReICgsfTMmpx''', | ||
| '''9d1c250a-e61b-44d9-88ed-5944d1962f5e''' | ||
| ] | ||
| paths = [ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔎 Supported by static analysis
Limit the global exemptions to tests and documentation. The test and documentation paths match issue Suggested fix
|
||
| '''apps/[^/]+/tests/.*''', | ||
| '''packages/[^/]+/tests/.*''', | ||
| '''docs/quality/.*''' | ||
| ] | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Match only the complete public identifiers.
These regexes are unanchored. With
regexTarget = "match", a finding such asapi_key = phc_zjjbX0PnWxERXrMHhkEJWj9A9BhGVLRReICgsfTMmpx_EXTRAvaluealso matches the global allowlist. Gitleaks can then suppress a different credential. Put the identifiers in a separate[[allowlists]]block withregexTarget = "secret"and anchored regexes. Keep the placeholder rule in a match-target block. Do not mix[allowlist]with[[allowlists]]. Gitleaks definesmatchas the rule’s full match and uses OR as the default allowlist condition. (github.com)Based on learnings, match-target regexes check the full rule match, while secret-target regexes can restrict an exemption to the extracted value.
Source: Learnings