Skip to content

Commit 5a554fe

Browse files
turbomamclaude
andcommitted
gitleaks: handle whitespace around token= and case-insensitive domain
Addresses Copilot review on #527: - rule 1: allow optional whitespace around 'token =' so 'apikey token = <uuid>' is caught (the no-space 'apikey token=<uuid>' form already matched). - rule 2: add '(?i)' so case variants of the bioontology.org domain are caught. Validated with gitleaks 8.30.1: all documented BioPortal key forms flagged, contextless bare UUID not flagged. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent b33f477 commit 5a554fe

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

.gitleaks.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ useDefault = true
1414
[[rules]]
1515
id = "bioportal-ncbo-api-key"
1616
description = "BioPortal / NCBO BioOntology API key (UUID in an apikey context)"
17-
regex = '''(?i)(?:bioportal[_-]?(?:api[_-]?key|token)|api[_-]?key|apikey)["'\s:=>]{0,4}(?:token=)?[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}'''
17+
regex = '''(?i)(?:bioportal[_-]?(?:api[_-]?key|token)|api[_-]?key|apikey)["'\s:=>]{0,4}(?:token\s*=\s*)?[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}'''
1818
keywords = ["apikey", "api_key", "bioportal", "bioontology"]
1919

2020
[[rules]]
2121
id = "bioportal-ncbo-apikey-url"
2222
description = "BioPortal / NCBO API key embedded in a bioontology.org URL"
23-
regex = '''bioontology\.org[^\s"'<>]*apikey=[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}'''
23+
regex = '''(?i)bioontology\.org[^\s"'<>]*apikey=[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}'''
2424
keywords = ["bioontology"]

0 commit comments

Comments
 (0)