Skip to content

Commit 6c23028

Browse files
authored
feat: expand secret prefixes (#6319)
1 parent 77d7c1c commit 6c23028

File tree

2 files changed

+39
-3
lines changed

2 files changed

+39
-3
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/**
2+
* Likely secret prefixes used for enhanced secret scanning.
3+
* Note: string comparison is case-insensitive so we use all lowercase here.
4+
*/
5+
6+
const AWS_PREFIXES = ['aws_', 'asia', 'akia', 'aida', 'ar0a', 'apka', 'abia', 'asca']
7+
const SLACK_PREFIXES = ['xoxb-', 'xwfp-', 'xoxb-', 'xoxp-', 'xapp-']
8+
const GCP_PREFIXES = ['aiza', 'ya29']
9+
const NETLIFY_PREFIXES = ['nf_']
10+
const GITHUB_PREFIXES = ['ghp_', 'gho_', 'ghu_', 'ghs_', 'ghr_', 'github_pat_']
11+
const SHOPIFY_PREFIXES = ['shpss_', 'shpat_', 'shpca_', 'shppa_']
12+
const SQUARE_PREFIXES = ['sq0atp-']
13+
const OTHER_COMMON_PREFIXES = [
14+
'pk_',
15+
'sk_',
16+
'pat_',
17+
'sk-',
18+
'db_',
19+
'api_',
20+
'secret_',
21+
'auth_',
22+
'access_',
23+
'twilio_',
24+
'-----begin',
25+
'ls0t',
26+
]
27+
28+
export const LIKELY_SECRET_PREFIXES = [
29+
...AWS_PREFIXES,
30+
...SLACK_PREFIXES,
31+
...GCP_PREFIXES,
32+
...NETLIFY_PREFIXES,
33+
...GITHUB_PREFIXES,
34+
...SHOPIFY_PREFIXES,
35+
...SQUARE_PREFIXES,
36+
...OTHER_COMMON_PREFIXES,
37+
]

packages/build/src/plugins_core/secrets_scanning/utils.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { createInterface } from 'node:readline'
55
import { fdir } from 'fdir'
66
import { minimatch } from 'minimatch'
77

8+
import { LIKELY_SECRET_PREFIXES } from './secret_prefixes.js'
9+
810
export interface ScanResults {
911
matches: MatchResult[]
1012
scannedFilesCount: number
@@ -119,9 +121,6 @@ export function getNonSecretKeysToScanFor(env: Record<string, unknown>, secretKe
119121
return nonSecretKeysToScanFor
120122
}
121123

122-
const AWS_PREFIXES = ['aws_', 'asia']
123-
const SLACK_PREFIXES = ['xoxb-', 'xwfp-', 'xoxb-', 'xoxp-', 'xapp-']
124-
const LIKELY_SECRET_PREFIXES = ['pk_', 'sk_', 'pat_', 'db_', 'github_pat_', ...AWS_PREFIXES, ...SLACK_PREFIXES]
125124
const LIKELY_SECRET_MIN_LENGTH = 16
126125

127126
/**

0 commit comments

Comments
 (0)