Skip to content

Commit 5aef6fc

Browse files
committed
Release v1.0.1: Add max file size flag, enhance pattern accuracy, and introduce new detection patterns for improved secret detection
1 parent 28a7054 commit 5aef6fc

File tree

7 files changed

+66
-30
lines changed

7 files changed

+66
-30
lines changed

.github/workflows/release.yml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,19 @@ jobs:
5656
# SecretHound v${{ env.VERSION }}
5757
5858
## New Features
59-
- **Expanded Pattern Library**: Introduced new pattern categories including PII (Personally Identifiable Information) and Web3 (e.g., Ethereum/Bitcoin addresses, private keys), increasing total patterns to over 60.
60-
- **URL/Domain Extraction Mode**: Added `--scan-urls` flag to exclusively scan for URL and domain patterns, overriding other category filters.
61-
- **Grouped Output Format**: Introduced `--group-by-source` flag to group found secrets by their source URL/file in TXT and JSON output formats, improving readability for large scans.
62-
- **Pattern Category Control**: Implemented `--include-categories` and `--exclude-categories` flags to allow users to specify which pattern categories to use or ignore during scans.
59+
- **Max File Size Flag**: Added `--max-file-size` flag to set the maximum file size for local file scanning.
60+
- **Netlify Access Token Pattern**: Added new detection pattern for Netlify Access Tokens.
6361
6462
## Improvements
65-
- **Enhanced Pattern Accuracy**: Iteratively refined numerous existing patterns (IPv4, Bitcoin Address, Email Address, MAC Address, Generic Domain, Session Token) to significantly reduce false positives and improve detection of legitimate secrets based on extensive real-world test cases.
66-
- **Log Custom Headers**: Initial configuration log now indicates if custom HTTP headers (`-H`) are being used.
67-
- **Queue Logic & Rate Limiting**: Improved URL processing queue logic and refined the auto mode for rate limiting for more efficient and considerate scanning.
68-
- **CLI Options Refinement**: Corrected and improved behavior of `--silent` and `--no-progress` flags.
69-
- **Regex Engine Compatibility**: Added internal logging for regex compilation errors and refactored incompatible regex syntax (e.g., unsupported lookaheads) to ensure all patterns load correctly with Go's standard regex engine.
63+
- **Enhanced Pattern Accuracy**: Refined multiple regex patterns (MAC Address, IPv4, IPv6, PayPal, Private Key, Phone Number) to significantly reduce false positives based on real-world testing.
7064
7165
## Bug Fixes
72-
- **JSON Output Formatting**: Addressed issues to ensure valid JSON output, especially when no secrets are found or in raw mode.
73-
- **Progress Bar Rendering**: Fixed a bug where the progress bar would sometimes only update when new logs were printed, ensuring it now refreshes independently and consistently.
74-
- **Execution Deadlocks**: Resolved potential deadlocks and improved goroutine management for more stable execution during long scans.
75-
- **Pattern Loading**: Fixed an issue where the incorrect number of loaded patterns was reported when using category filters, ensuring accurate reflection of active patterns.
66+
- Fixed false positives where SVG path data was detected as MAC addresses.
67+
- Fixed false positives where OIDs were detected as IPv4 addresses.
68+
- Fixed false positives where SHA-256 fingerprints were detected as IPv6 addresses.
69+
- Fixed false positives where CSS class names were detected as PayPal credentials.
70+
- Fixed false positives where event tracking strings were detected as private keys.
71+
- Fixed Private Key Content pattern to require actual key data after BEGIN header.
7672
7773
## Installation
7874

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
# SecretHound Changelog
22

3+
## v1.0.1 (2025-12-05)
4+
5+
### New Features
6+
- **Max File Size Flag**: Added `--max-file-size` flag to set the maximum file size for local file scanning, allowing users to skip large files that may slow down scans.
7+
- **Netlify Access Token Pattern**: Added new detection pattern for Netlify Access Tokens.
8+
9+
### Improvements
10+
- **Enhanced Pattern Accuracy**: Refined multiple regex patterns to significantly reduce false positives:
11+
- **MAC Address**: Now requires explicit keywords (`mac_address`, `ethernet_addr`, `hw_addr`) and only matches colon-separated format to avoid false positives from SVG paths.
12+
- **IPv4 Address**: More restrictive pattern requiring explicit keywords (`ip_addr`, `host_addr`, `server_ip`). Added exclusions for OIDs (`1.3.6.1`, `2.16.840`).
13+
- **IPv6 Address**: Simplified regex requiring `ipv6` or `ip6` keywords. Added exclusions for SHA-256 fingerprints.
14+
- **PayPal/Braintree**: Now requires specific keywords (`paypal_client_id`, `braintree_secret`) instead of loose matching. Added exclusions for CSS class names.
15+
- **Private Key Variable**: Added exclusions for tracking/event patterns (`click_`, `export_`, `track_`).
16+
- **Phone Number**: More restrictive US format pattern, now keyword-dependent.
17+
18+
### Bug Fixes
19+
- Fixed false positives where SVG path data was being detected as MAC addresses.
20+
- Fixed false positives where OIDs (Object Identifiers) were being detected as IPv4 addresses.
21+
- Fixed false positives where SHA-256 fingerprints were being detected as IPv6 addresses.
22+
- Fixed false positives where CSS class names containing "paypal" were being detected as PayPal credentials.
23+
- Fixed false positives where event tracking strings were being detected as private keys.
24+
- Fixed Private Key Content pattern to require actual key data after the BEGIN header, preventing false positives from standalone headers.
25+
326
## v1.0.0 (2025-05-06)
427

528
### New Features

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ SecretHound supports the following options:
117117
| `--include-categories` | Comma-separated list of pattern categories to include (e.g., aws,gcp). | all enabled |
118118
| `--exclude-categories` | Comma-separated list of pattern categories to exclude (e.g., pii,url). | none |
119119
| `--scan-urls` | URL Extraction Mode: Scan ONLY for URL/Endpoint patterns (overrides category filters). | false |
120+
| `--max-file-size` | Maximum file size to scan in MB (0 for no limit). | 10 |
120121
| `--list-patterns` | List available pattern categories and patterns, then exit. | false |
121122
| `-v, --verbose` | Enable verbose logging output. | false |
122123
| `-n, --no-progress` | Disable the progress bar display. | false |

cmd/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010

1111
// Build information
1212
var (
13-
Version = "1.0.0"
13+
Version = "1.0.1"
1414
)
1515

1616
// versionCmd represents the version command

core/patterns/patterns.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,11 @@ var DefaultPatterns = &PatternDefinitions{
176176
MinLength: 70,
177177
},
178178
"private_key_content": {
179-
Regex: `-----BEGIN (?:RSA|OPENSSH|DSA|EC|PGP) PRIVATE KEY( BLOCK)?-----`,
180-
Description: "Private Key Content (BEGIN Block)",
179+
Regex: `-----BEGIN (?:RSA |OPENSSH |DSA |EC |PGP |ENCRYPTED )?PRIVATE KEY(?:\sBLOCK)?-----[\s]*[A-Za-z0-9+/=]{20,}`,
180+
Description: "Private Key Content (with actual key data)",
181181
Enabled: true,
182182
Category: "crypto",
183-
MinLength: 30,
183+
MinLength: 60,
184184
},
185185
"square_access_token": {
186186
Regex: `sq0atp-[0-9A-Za-z\-_]{22}`,

docs/SUPPORTED_SECRETS.md

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,25 @@ secrethound --list-patterns
4141
- PGP Private Keys
4242
- SSH Private Keys
4343

44-
### Personally Identifiable Information (PII) - *New Category*
45-
- Email Addresses
46-
- Phone Numbers (various international formats)
47-
- Credit Card Numbers (heuristic based, common prefixes)
48-
- Social Security Numbers (SSN - US format, heuristic)
49-
50-
### Web3 & Cryptocurrency - *New Category*
44+
### Personally Identifiable Information (PII)
45+
- Email Addresses (keyword-dependent)
46+
- Phone Numbers (US format, keyword-dependent)
47+
- IP Addresses (IPv4/IPv6, keyword-dependent with OID exclusions)
48+
- MAC Addresses (keyword-dependent, colon format only)
49+
- US ZIP Codes (keyword-dependent)
50+
- Serial Numbers (keyword-dependent)
51+
52+
### Web3 & Cryptocurrency
5153
- Ethereum Addresses
5254
- Ethereum Private Keys
5355
- Bitcoin Addresses (P2PKH, P2SH, Bech32)
5456
- Bitcoin Private Keys (WIF format)
5557
- Generic Cryptocurrency Private Keys (common hex patterns)
5658

5759
### Network & Infrastructure
58-
- IP Addresses (IPv4, IPv6)
59-
- MAC Addresses
6060
- Generic Domain Names / Hostnames
6161
- URLs with potentially sensitive parameters or paths
62+
- Netlify Access Tokens
6263

6364
### Generic & Miscellaneous
6465
- Generic High Entropy Strings (potential secrets)
@@ -68,6 +69,8 @@ secrethound --list-patterns
6869

6970
This list is continuously updated. Always refer to `secrethound --list-patterns` for the most current set of patterns and their categories.
7071

72+
> **Note**: Many patterns are now "keyword-dependent", meaning they only match when specific keywords (like `ip_addr`, `mac_address`, `phone`, etc.) are found near the value. This significantly reduces false positives.
73+
7174
## API Keys and Tokens
7275

7376
| Secret Type | Description | Example Pattern |
@@ -90,7 +93,7 @@ This list is continuously updated. Always refer to `secrethound --list-patterns`
9093
| Stripe Test Publishable Key | Stripe test publishable key | `pk_test_[0-9a-zA-Z]{24,34}` |
9194
| Square Access Token | Square OAuth token | `sq0atp-[0-9A-Za-z\-_]{22}` |
9295
| Square OAuth Secret | Square OAuth secret | `sq0csp-[0-9A-Za-z\-_]{43}` |
93-
| PayPal/Braintree | PayPal/Braintree credentials | `(?i)(?:paypal\|braintree).{0,20}['\"][A-Za-z0-9_-]{20,64}['\"]` |
96+
| PayPal/Braintree Client ID | PayPal/Braintree Client ID (keyword-dependent) | `(?i)(?:paypal\|braintree)[_-]?(?:client[_-]?)?(?:id\|key\|secret)\s*[:=]\s*['"](...)['"` |
9497
| Braintree Token | Braintree access token | `access_token\$production\$[0-9a-z]{16}\$[0-9a-f]{32}` |
9598

9699
## Email and Communication Services
@@ -138,7 +141,7 @@ This list is continuously updated. Always refer to `secrethound --list-patterns`
138141
| OAuth 2.0 Access Token | OAuth 2.0 access token | `ya29\.[0-9A-Za-z\-_]+` |
139142
| Generic Password | Password in configuration | `(?i)(?:password\|passwd\|pwd\|secret)[\s]*[=:]+[\s]*["']([^'"]{8,30})["']` |
140143
| Authentication Token | Authentication token with comment | `['"]?([a-zA-Z0-9_\-\.]{32,64})['"]?\s*[,;]?\s*\/\/\s*[Aa]uth(?:entication)?\s+[Tt]oken` |
141-
| Private Key Variable | Private key variable | `['"]?(?:private_?key\|secret_?key)['"]?\s*[:=]\s*['"]([^'"]{20,})['"]` |
144+
| Private Key Variable | Private key variable (excludes tracking events) | `['"?(?:private_?key\|secret_?key)['"?\s*[:=]\s*['"(...)['"]` |
142145
| Encryption Key | Encryption key | `(?i)['"]?enc(?:ryption)?[_-]?key['"]?\s*[=:]\s*['"]([a-zA-Z0-9+/]{16,64})['"]` |
143146
| Signing Key | Signing key/secret | `(?i)['"]?sign(?:ing)?[_-]?(?:secret\|key)['"]?\s*[=:]\s*['"]([a-zA-Z0-9+/]{16,64})['"]` |
144147

@@ -159,21 +162,33 @@ This list is continuously updated. Always refer to `secrethound --list-patterns`
159162

160163
| Secret Type | Description | Example Pattern |
161164
|-------------|-------------|-----------------|
162-
| Private Key Content | Private key content | `-----BEGIN (?:RSA\|OPENSSH\|DSA\|EC\|PGP) PRIVATE KEY( BLOCK)?-----` |
165+
| Private Key Content | Private key with actual key data | `-----BEGIN (?:RSA \|OPENSSH \|...) PRIVATE KEY-----[\s]*[A-Za-z0-9+/=]{20,}` |
163166

164167
## CI/CD and DevOps
165168

166169
| Secret Type | Description | Example Pattern |
167170
|-------------|-------------|-----------------|
168-
| Jenkins API Token | Jenkins API token | `(?i)(?:jenkins\|hudson).{0,5}(?:api)?.{0,5}(?:token).{0,5}['\"]([0-9a-zA-Z]{30,})['\"]` |
171+
| Jenkins API Token | Jenkins API token | `(?i)(?:jenkins\|hudson).{0,5}(?:api)?.{0,5}(?:token).{0,5}['"]([0-9a-zA-Z]{30,})['"]` |
169172
| NPM Access Token | NPM access token | `npm_[A-Za-z0-9]{36}` |
170173
| Docker Hub Personal Access Token | Docker Hub personal access token | `dckr_pat_[A-Za-z0-9_-]{56}` |
171174
| GitLab Runner Token | GitLab runner registration token | `glrt-[0-9a-zA-Z_\-]{20,}` |
172175
| GitLab Personal Token | GitLab personal access token | `glpat-[0-9a-zA-Z_\-]{20,}` |
176+
| Netlify Access Token | Netlify personal access token | `nf[pcfub]_[a-zA-Z0-9_\-]{36}` |
173177

174178
## Generic Secret Patterns
175179

176180
| Secret Type | Description | Example Pattern |
177181
|-------------|-------------|-----------------|
178182
| Generic API Key | Generic API key format | `['"]?(?:api_?key\|api_?secret\|app_?key\|app_?secret)['"]?\s*[=:]\s*['"]([a-zA-Z0-9_\-\.]{16,64})['"]` |
179183
| API Key Assignment | API key assignment | `['"]?(?:api_?key\|api_?secret\|app_?key\|app_?secret)['"]?\s*[=:]\s*['"]([a-zA-Z0-9_\-\.]{16,64})['"]` |
184+
185+
## PII (Personally Identifiable Information)
186+
187+
| Secret Type | Description | Example Pattern |
188+
|-------------|-------------|-----------------|
189+
| Email Address | Email address (keyword-dependent) | `[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}` |
190+
| Phone Number | Phone number (US format, keyword-dependent) | Requires keywords like `phone`, `mobile`, `tel` |
191+
| IPv4 Address | IPv4 address (keyword-dependent) | Requires keywords like `ip_addr`, `host_addr`, `server_ip` |
192+
| IPv6 Address | IPv6 address (keyword-dependent) | Requires keywords like `ipv6`, `ip6` |
193+
| MAC Address | MAC address (keyword-dependent, colon format) | Requires keywords like `mac_address`, `ethernet_addr`, `hw_addr` |
194+
| US ZIP Code | US ZIP code (keyword-dependent) | Requires keywords like `zip`, `postal`, `postcode` |

docs/USAGE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ SecretHound supports the following options:
8888
| `-n, --concurrency` | Number of concurrent workers | 10 |
8989
| `-l, --rate-limit` | Requests per second per domain (0 = auto) | 0 |
9090
| `-H, --header` | Custom HTTP header (format: 'Name: Value') | - |
91+
| `--max-file-size` | Maximum file size to scan in MB (0 for no limit) | 10 |
9192
| `--insecure` | Disable SSL/TLS certificate verification | false |
9293
| `-v, --verbose` | Enable verbose output | false |
9394

0 commit comments

Comments
 (0)