.gitleaks.tomlā¢2.73 kB
# Gitleaks configuration for IB Analytics
# See https://github.com/gitleaks/gitleaks for more information
title = "IB Analytics Gitleaks Configuration"
# Extend the default gitleaks config
[extend]
useDefault = true
# Custom rules for Interactive Brokers credentials
[[rules]]
id = "ib-query-id"
description = "Interactive Brokers Flex Query ID"
regex = '''(?i)(query_?id|QUERY_?ID)\s*[=:]\s*['"]?(\d{7,10})['"]?'''
secretGroup = 2
keywords = [
"QUERY_ID",
"query_id",
"QueryID",
]
[[rules]]
id = "ib-token"
description = "Interactive Brokers Flex Query Token"
regex = '''(?i)(token|TOKEN)\s*[=:]\s*['"]?(\d{18,25})['"]?'''
secretGroup = 2
keywords = [
"TOKEN",
"token",
"flex_token",
"FLEX_TOKEN",
]
[[rules]]
id = "ib-account-id"
description = "Interactive Brokers Account ID"
regex = '''U\d{7,10}'''
# Note: No keywords required - should always detect U followed by 7-10 digits
# Additional security patterns
[[rules]]
id = "generic-api-key"
description = "Generic API Key"
regex = '''(?i)api[_-]?key\s*[=:]\s*['"]?([a-zA-Z0-9]{20,})['"]?'''
secretGroup = 1
keywords = [
"api_key",
"apikey",
"API_KEY",
]
# Allowlist for false positives
[allowlist]
description = "Allowlisted files and patterns"
paths = [
# Test files and examples
'''tests/fixtures/.*''',
'''\.env\.example$''',
'''\.env\.template$''',
# Configuration examples
'''.pre-commit-config\.yaml$''',
'''.gitleaks\.toml$''',
# IMPORTANT: Documentation files are NOT allowlisted
# Real account IDs should be detected in docs
]
regexes = [
# Example values in documentation
'''QUERY_ID=your_query_id_here''',
'''TOKEN=your_token_here''',
'''QUERY_ID=123''',
'''TOKEN=abc''',
'''query_id="123"''',
'''token="abc"''',
'''1234567890123456789012345''', # Generic placeholder numbers
# Generic account IDs (for documentation examples)
# Use U followed by 7 digits for examples (e.g., U1234567)
'''U1234567''',
'''U7654321''',
'''U1111111''',
'''U17955070''', # Documentation example account ID
'''U16231259''', # Documentation example account ID
# Code placeholders
'''\.\.\.$''', # Ellipsis placeholders
'''your_.*_here''',
'''<.*>''', # XML/HTML tags
'''example''',
'''sample''',
'''test''',
'''dummy''',
# IMPORTANT: Real account IDs (U followed by 8-10 digits) will be detected
# Note: DO NOT add real credentials here
]
# Stopwords to reduce false positives
stopwords = [
"example",
"sample",
"test",
"dummy",
"placeholder",
"your",
"here",
"xxx",
"yyy",
]
# Commits to ignore (if needed)
# commits = [
# "commit-sha-to-ignore",
# ]