Skip to content

Commit c33c470

Browse files
committed
Updated README.md
1 parent fec8417 commit c33c470

File tree

3 files changed

+155
-8
lines changed

3 files changed

+155
-8
lines changed

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ Custom Secret Scanning Patterns repository.
5757

5858
- Generic Passwords
5959

60+
- Generic Password with hex encoded secrets
61+
62+
- Generic Password with Base64 encoded secrets
63+
6064
- UUIDs
6165

6266
- Bearer Tokens

configs/README.md

+31-3
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ Add these additional matches to the [Secret Scanning Custom Pattern](https://doc
183183
- Not Match:
184184

185185
```regex
186-
^(?:(?:[a-zA-Z_]+(?:\(\))?\.)*[a-zA-Z_]+\(\)|\|\s*)$
186+
^(?:(?:[a-zA-Z_]+(?:\(\))?\.)*[a-zA-Z_]+\(\)|\|\s*)$|\{\{[^}]+\}\}|\$\{\{ |^!Ref
187187
```
188188
- Not Match:
189189

@@ -261,7 +261,7 @@ Add these additional matches to the [Secret Scanning Custom Pattern](https://doc
261261
- Not Match:
262262

263263
```regex
264-
^(?:[a-zA-Z_]+(?:\(\))?\.)*[a-zA-Z_]+\(\)$
264+
^(?:[a-zA-Z_]+(?:\(\))?\.)*[a-zA-Z_]+\(\)$|\$\{\{[^}]+\}\}
265265
```
266266
- Not Match:
267267

@@ -315,6 +315,20 @@ _version: v0.1_
315315

316316
</details>
317317

318+
<details>
319+
<summary>Additional Matches</summary>
320+
321+
Add these additional matches to the [Secret Scanning Custom Pattern](https://docs.github.com/en/enterprise-cloud@latest/code-security/secret-scanning/defining-custom-patterns-for-secret-scanning#example-of-a-custom-pattern-specified-using-additional-requirements).
322+
323+
324+
- Not Match:
325+
326+
```regex
327+
\{\{[^{}]+\}\}
328+
```
329+
330+
</details>
331+
318332
## YAML hardcoded passwords (double quoted strings)
319333

320334
**⚠️ WARNING: THIS RULE IS EXPERIMENTAL AND MIGHT CAUSE A HIGH FALSE POSITIVE RATE (test before commiting to org level) ⚠️**
@@ -359,6 +373,20 @@ _version: v0.1_
359373

360374
</details>
361375

376+
<details>
377+
<summary>Additional Matches</summary>
378+
379+
Add these additional matches to the [Secret Scanning Custom Pattern](https://docs.github.com/en/enterprise-cloud@latest/code-security/secret-scanning/defining-custom-patterns-for-secret-scanning#example-of-a-custom-pattern-specified-using-additional-requirements).
380+
381+
382+
- Not Match:
383+
384+
```regex
385+
\{\{[^{}]+\}\}
386+
```
387+
388+
</details>
389+
362390
## YAML hardcoded passwords (multiline strings)
363391

364392
**⚠️ WARNING: THIS RULE IS EXPERIMENTAL AND MIGHT CAUSE A HIGH FALSE POSITIVE RATE (test before commiting to org level) ⚠️**
@@ -761,7 +789,7 @@ _version: v0.1_
761789
<summary>Start Pattern</summary>
762790

763791
```regex
764-
[{[,][ \t]*[ \t\r\n]*"(?i)[a-z_-]*(?:secret|service_pass(wd|word|code|phrase)|pass(?:wd|word|code|phrase)?|key|token)"[ \t]*:[ \t]*"
792+
[{[,][ \t]*[ \t\r\n]*"(?i)[a-z_.-]*(?:secret|service_pass(wd|word|code|phrase)|pass(?:wd|word|code|phrase)?|key|token)"[ \t]*:[ \t]*"
765793
```
766794

767795
</details><details>

generic/README.md

+120-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111

12-
_version: v0.4_
12+
_version: v0.5_
1313

1414
**Comments / Notes:**
1515

@@ -36,7 +36,7 @@ _version: v0.4_
3636
<summary>Start Pattern</summary>
3737

3838
```regex
39-
(?:\A|[^a-zA-Z0-9])(?i)(?:api|jwt|mysql|db)?[_.-]?(?:pass?(?:wo?r?d|code|phrase)|secret)([ \t]+As[ \t]+String)?[\t ]*(={1,3}|:)[\t ]*(?:["']|b["'])?
39+
(?:\A|[^a-zA-Z0-9])(?i)(?:api|auth[a-z]+|jwt|mysql|db)?[_.-]?(?:pass?(?:wo?r?d|code|phrase)|secret|key|token)([_-][a-z0-9]+){0,3}([ \t]+As[ \t]+String)?[\t ]*(={1,3}|:)[\t ]*(?:["']|b["'])?
4040
```
4141

4242
</details><details>
@@ -57,7 +57,7 @@ Add these additional matches to the [Secret Scanning Custom Pattern](https://doc
5757
- Not Match:
5858

5959
```regex
60-
^(?i)(?:[a-z0-9_.]*,\s*)?(?:str\()?[[<(]?(?:(?:(?:user|key)_?)?(?:[a-zA-Z0-9._]+[_.])?(?:the )?(?:pass?(wo?r?d|code|phrase)|pass|pwd|secret|token|tok|redacted|placeholder|dummy|pw|thephrase)|write|read|on|off|true|false|none|null|nil|undefined|eof|ignore|eol|git|yes|no|y|n),?[\]>)]?(?:\)\s*\{)?\\?( or )?$
60+
_?)?(?:[a-zA-Z0-9._]+[_.])?(?:the )?(?:pass?(wo?r?d|code|phrase)|pass|pwd|secret|token|tok|redacted|placeholder|dummy|pw|thephrase)|write|read|on|off|true|false|none|null( \? )?|nil|undefined|eof|ignore|eol|git|yes|no|y|n),?\s*\){0,2}[\]>)]?(?:\)\s*\{)?\\?(( or | \|\| ).*)?$
6161
```
6262
- Not Match:
6363

@@ -67,12 +67,12 @@ Add these additional matches to the [Secret Scanning Custom Pattern](https://doc
6767
- Not Match:
6868

6969
```regex
70-
^\s*(?:\.\.\.|\\|\\n|\\0|[,()[\]{}`.]\\?|-[)(]|0x[A-Fa-f0-9]+|[0-9]{1,4}|(?:~|/tmp|\.\.|\.)|\\{1,2}w\+/g,( \\?)?|%[sr]|geheim\$parole|\([Oo]ptional\).*|\$?(?:\{\{?[^}]+\}\}?|\(\(?[^)]+\)\)?|\[\[?[^\]+]\]\]?))?,?\s*(?:\s*(?:/\*|#|//).*)?$
70+
^\s*(?:\.\.\.|\\|\\n|\\0|\?|\$\(|[,()[\]{}`.]\\?|-[)(]|\\f21b|0x[A-Fa-f0-9]+|[0-9]{1,4}|(?:~|/tmp|\.\.|\.)|\\{1,2}w\+/g,( \\?)?|%[sr]|geheim\$parole|\([Oo]ptional\).*|\$?(?:\{\{?[^}]+\}\}?|\(\(?[^)]+\)\)?|\[\[?[^\]+]\]\]?)|(before|hover|focus)(,| \{))?,?\s*(?:\s*(?:/\*|#|//).*)?$
7171
```
7272
- Not Match:
7373

7474
```regex
75-
^(?:function\s*\([^)]*\)\s*{\s*.*|\([^)]*\)\s*=>\s*(?:{\s*|[^;)]+[;)])|(?:new )?[a-zA-Z0-9_.]+\(.*|(?:public|private) [A-Za-z0-9_]+ \{)$
75+
^(?:function\s*\([^)]*\)\s*{\s*.*|\([^)]*\)\s*=>\s*(?:{\s*|[^;)]+[;)])|(?:new |\([A-Za-z]+\)\s*)?[a-zA-Z0-9_.]+\s*\(.*|(?:public|private) [A-Za-z0-9_]+ \{|[A-Za-z0-9_.-]+\s*\) \{)$|\{\{[^}]+\}\}|\$\{\{
7676
```
7777
- Not Match:
7878

@@ -82,6 +82,121 @@ Add these additional matches to the [Secret Scanning Custom Pattern](https://doc
8282

8383
</details>
8484

85+
## Generic Password with hex encoded secrets
86+
87+
88+
89+
_version: v0.1_
90+
91+
**Comments / Notes:**
92+
93+
94+
- `password`, `secret`, `key`, or password like prefix (fuzzy)
95+
96+
- Delimiters like `=` or `:` (with padding)
97+
98+
- Has to be a token-like value
99+
100+
101+
<details>
102+
<summary>Pattern Format</summary>
103+
104+
```regex
105+
[0-9a-f]{32}|[0-9a-f]{40}|[0-9a-f]{64}
106+
```
107+
108+
</details>
109+
110+
<details>
111+
<summary>Start Pattern</summary>
112+
113+
```regex
114+
(?:\A|[^a-zA-Z0-9])(?i)(?:api|auth[a-z]+|jwt|mysql|db)?[_.-]?(?:pass?(?:wo?r?d|code|phrase)|secret|key|token)([_-][a-z0-9]+){0,3}([ \t]+As[ \t]+String)?[\t ]*(={1,3}|:)[\t ]*(?:["']|b["'])?
115+
```
116+
117+
</details><details>
118+
<summary>End Pattern</summary>
119+
120+
```regex
121+
(\z|[\r\n'"])
122+
```
123+
124+
</details>
125+
126+
## Generic Password with Base64 encoded secrets
127+
128+
129+
130+
_version: v0.1_
131+
132+
**Comments / Notes:**
133+
134+
135+
- The Base64 must contain numbers, upper case and lower case and be at least 12 characters long
136+
137+
- `password`, `secret`, `key`, or password like prefix (fuzzy)
138+
139+
- Delimiters like `=` or `:` (with padding)
140+
141+
142+
<details>
143+
<summary>Pattern Format</summary>
144+
145+
```regex
146+
(([A-Za-z0-9+/]){4})+[A-Za-z0-9+/]{1,2}={0,2}
147+
```
148+
149+
</details>
150+
151+
<details>
152+
<summary>Start Pattern</summary>
153+
154+
```regex
155+
(?:\A|[^a-zA-Z0-9])(?i)(?:api|auth[a-z]+|jwt|mysql|db)?[_.-]?(?:pass?(?:wo?r?d|code|phrase)|secret|key|token)([_-][a-z0-9]+){0,3}([ \t]+As[ \t]+String)?[\t ]*(={1,3}|:)[\t ]*(?:["']|b["'])?
156+
```
157+
158+
</details><details>
159+
<summary>End Pattern</summary>
160+
161+
```regex
162+
(\z|[\r\n'"])
163+
```
164+
165+
</details>
166+
167+
<details>
168+
<summary>Additional Matches</summary>
169+
170+
Add these additional matches to the [Secret Scanning Custom Pattern](https://docs.github.com/en/enterprise-cloud@latest/code-security/secret-scanning/defining-custom-patterns-for-secret-scanning#example-of-a-custom-pattern-specified-using-additional-requirements).
171+
172+
173+
174+
- Match:
175+
176+
```regex
177+
[0-9]
178+
```
179+
180+
- Match:
181+
182+
```regex
183+
[A-Z]
184+
```
185+
186+
- Match:
187+
188+
```regex
189+
[a-z]
190+
```
191+
192+
- Match:
193+
194+
```regex
195+
^.{12,}$
196+
```
197+
198+
</details>
199+
85200
## UUIDs
86201

87202

0 commit comments

Comments
 (0)