Skip to content

Commit 889dac0

Browse files
committed
Updated README.md
1 parent f15e2bd commit 889dac0

File tree

12 files changed

+379
-266
lines changed

12 files changed

+379
-266
lines changed

README.md

Lines changed: 78 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,101 @@
1-
# custom-pattern-secrets
1+
# Secret Scanning Tools
22

3-
Custom Secret Scanning Patterns repository created and maintained by the GitHub Field Services.
3+
> ℹ️ This is an _unofficial_ tool created by Field Security Services, and is not officially supported by GitHub.
44
5-
This repository extends the [list of supported Vendors out of the box](https://docs.github.com/en/enterprise-cloud@latest/code-security/secret-scanning/secret-scanning-patterns) with GitHub's Advanced Security Secret Scanning.
5+
This is a testing suite for GitHub Secret Scanning Custom Patterns.
66

7-
> :warning: This repository does not guarantee the quality or precision of the patterns which might result in False Positives
8-
Click on each header to find the patterns and additional information for that section.
7+
It can be used in combination with GitHub Actions to test custom patterns before they are deployed.
98

10-
### [Commonly Used Secrets / Passwords](./common)
9+
An example repository that uses this Action is [advanced-security/secret-scanning-custom-patterns](https://github.com/advanced-security/secret-scanning-custom-patterns).
1110

12-
- Common Passwords Shortlist
11+
A sample custom patterns config file compatible with this tool suite is provided in [`examples/config/patterns.yml`](examples/config/patterns.yml).
1312

14-
### [Configuration Secrets](./configs)
13+
## Usage in Actions
1514

16-
- Hardcoded Database Passwords
17-
- Hardcoded Spring SQL passwords
18-
- Django Secret Key
19-
- GitHub Actions SHA Checker
20-
- .NET Configuration file
21-
- .NET MachineKey
15+
```yaml
16+
- name: Secret Scanning Test Suite
17+
uses: advanced-security/secret-scanning-tools@main
18+
```
2219
23-
### [Database passwords](./database)
20+
### Advanced Configuration
2421
25-
- Database Connection String (1)
26-
- Database Connection String (2)
27-
- Database Connection String (3)
28-
- TSQL CREATE LOGIN/USER
22+
```yaml
23+
- name: Secret Scanning Test Suite
24+
uses: advanced-security/secret-scanning-tools@main
25+
with:
26+
# Modes to run
27+
# > 'validate' (default), 'all', 'snapshot', 'markdown'
28+
mode: 'validate'
29+
```
2930
30-
### [Generic Secrets / Passwords](./generic)
31+
### Using GitHub App Token
3132
32-
- Generic Passwords
33-
- UUIDs
34-
- Bearer Tokens
33+
```yaml
34+
- name: Get Token
35+
id: get_workflow_token
36+
uses: peter-murray/workflow-application-token-action@v1
37+
with:
38+
application_id: ${{ secrets.ADVANCED_SECURITY_APP_ID }}
39+
application_private_key: ${{ secrets.ADVANCED_SECURITY_APP_KEY }}
3540

36-
### [JWT](./jwt)
41+
- name: Secret Scanning Test Suite
42+
uses: advanced-security/secret-scanning-tools@main
43+
with:
44+
token: ${{ steps.get_workflow_token.outputs.token }}
45+
```
3746
38-
- JWT
47+
## Offline testing of Secret Scanning custom patterns
3948
40-
### [Password stores](./password_store)
49+
We have a test Python script, `secretscanning/test.py` that uses Intel's `hyperscan` to test custom GitHub Advanced Security Secret Scanning patterns.
4150

42-
- Arc
51+
This is useful for thorough testing of patterns before they are deployed, whereas the rest of the test suite is primarily designed to be run in GitHub Actions for testing in CI.
4352

44-
### [Personally identifiable information (PII)](./pii)
53+
### Local test script usage
4554

46-
- Credit Cards
47-
- Credit Cards - Visa
48-
- Credit Cards - MasterCard
49-
- Credit Cards - American Express
50-
- Credit Cards - Discover
51-
- IBAN
55+
Change directory to `secretscanning`.
5256

53-
### [RSA Keys](./rsa)
57+
First run `make requirements` to install required dependencies.
5458

55-
- Generic RSA keys
56-
- SSH Private Keys
57-
- GPG Private Key
59+
``` bash
60+
./test.py
61+
```
5862

59-
### [URI / URL Custom Patterns](./uri)
63+
By default it searches the directory above the `testing` directory for `pattern.yml` files, and tests those patterns on the same directory that file was found in.
6064

61-
- Hardcoded Internal Emails
62-
- Hardcoded Internal URLs
63-
- Hardcoded URI Passwords
64-
- Routable IPv4 Addresses
65-
- GitHub Container Registry typos
65+
or
6666

67-
### [Vendors](./vendors)
67+
``` bash
68+
./test.py --tests <directory>
69+
```
6870

69-
- Azure SQL Connection String
70-
- Grafana API token
71-
- SendGrid (deprecated)
72-
- Sentry Auth Token
73-
- Sentry API Key
74-
- Sentry DSN secret
75-
- Sentry webpack plugin token
76-
- Sentry Terraform provider token
77-
- Okta token
78-
- DataDog API key
79-
- DataDog APP key
71+
For full usage use `./test.py --help`
72+
73+
### Local test script requirements
74+
75+
This only works on Intel-compatible platforms, since `hyperscan` is an Intel application and written to use Intel-specific instructions.
76+
77+
* Python 3.9+
78+
* `hyperscan` module, which provides Python bindings to Intel's Hyperscan
79+
* `python-pcre` module, which provides Python bindings to libPCRE
80+
81+
### Development notes
82+
83+
Please run `make lint` after any changes
84+
85+
## License
86+
87+
This project is licensed under the terms of the MIT open source license. Please refer to the [LICENSE](LICENSE) for the full terms.
88+
89+
## Maintainers
90+
91+
See [CODEOWNERS](CODEOWNERS) for the list of maintainers.
92+
93+
## Support
94+
95+
> ℹ️ This is an _unofficial_ tool created by Field Security Services, and is not officially supported by GitHub.
96+
97+
See the [SUPPORT](SUPPORT.md) file.
98+
99+
## Background
100+
101+
See the [CHANGELOG](CHANGELOG.md), [CONTRIBUTING](CONTRIBUTING.md), [SECURITY](SECURITY.md), [SUPPORT](SUPPORT.md), [CODE OF CONDUCT](CODE_OF_CONDUCT.md) and [PRIVACY](PRIVACY.md) files for more information.

common/README.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
11
<!-- WARNING: This README is generated automatically
22
-->
3+
34
# Commonly Used Secrets / Passwords
45

56
## Common Passwords Shortlist
67

78

89

9-
*version: v0.1*
10+
_version: v0.1_
1011

1112
**Comments / Notes:**
1213

14+
1315
- ⚠️ prone to high numbers of false positives, use with caution ⚠️
16+
1417
- very small common password shortlist from SecLists
18+
1519
- allows for numbers and common punctuation at the end
20+
1621
- case insensitive
17-
- adds some l33tsp3@k variations
1822

23+
- adds some l33tsp3@k variations
24+
1925

2026
<details>
2127
<summary>Pattern Format</summary>
@@ -47,16 +53,17 @@
4753

4854
</p>
4955
</details>
56+
5057
<details>
5158
<summary>Additional Matches</summary>
5259
<p>
5360
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).
5461

5562

56-
- Not Match: `^red'?$`
57-
- Not Match: `^(master|shadow|password|\$PASSWORD|MASTER|www\.)$`
58-
- Not Match: `^\#[0-9]+$`
59-
- Not Match: `^.{20,}`
63+
- Not Match: ```^red'?$```
64+
- Not Match: ```^(master|shadow|password|\$PASSWORD|MASTER|www\.)$```
65+
- Not Match: ```^\#[0-9]+$```
66+
- Not Match: ```^.{20,}```
6067

6168
</p>
6269
</details>

configs/README.md

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
11
<!-- WARNING: This README is generated automatically
22
-->
3+
34
# Configuration Secrets
45

56
## Hardcoded Database Passwords
67

78

89

9-
*version: v0.1*
10+
_version: v0.1_
1011

1112
**Comments / Notes:**
1213

14+
1315
- Only support for Postgres and MySQL password strings
16+
1417
- Checks if the password is null / length of 0
18+
1519
- Supports quoted passwords
16-
- Not case sensative
1720

21+
- Not case sensative
22+
1823

1924
<details>
2025
<summary>Pattern Format</summary>
@@ -52,7 +57,7 @@
5257

5358
Hardcoded JDBC / Spring datasource passwords which typically are in property files or passed in at runtime
5459

55-
*version: v0.1*
60+
_version: v0.1_
5661

5762

5863

@@ -91,12 +96,13 @@ Hardcoded JDBC / Spring datasource passwords which typically are in property fil
9196

9297

9398

94-
*version: v0.1*
99+
_version: v0.1_
95100

96101
**Comments / Notes:**
97102

98-
- _If the secret is at the start of the file, its not picked up_
99103

104+
- _If the secret is at the start of the file, its not picked up_
105+
100106

101107
<details>
102108
<summary>Pattern Format</summary>
@@ -134,14 +140,17 @@ Hardcoded JDBC / Spring datasource passwords which typically are in property fil
134140
**⚠️ WARNING: THIS RULE IS EXPERIMENTAL AND MIGHT CAUSE A HIGH FALSE POSITIVE RATE (test before commiting to org level) ⚠️**
135141
Pattern to find Static passwords in YAML configuration files
136142

137-
*version: v0.1*
143+
_version: v0.1_
138144

139145
**Comments / Notes:**
140146

147+
141148
- The hardcoded password is between 12 and 32 chars long
149+
142150
- Some false positives in Code might appear
143-
- The pattern only checks for certain key words to begin the pattern (`secret`, `password`, etc.)
144151

152+
- The pattern only checks for certain key words to begin the pattern (`secret`, `password`, etc.)
153+
145154

146155
<details>
147156
<summary>Pattern Format</summary>
@@ -173,17 +182,18 @@ Pattern to find Static passwords in YAML configuration files
173182

174183
</p>
175184
</details>
185+
176186
<details>
177187
<summary>Additional Matches</summary>
178188
<p>
179189
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).
180190

181191

182-
- Not Match: `^(?:keyPassphrase|password|key|[ \t]+|\$\{[A-Za-z0-9_-]+\}|(?:str|string|int|bool)( +#.*)?),?$`
183-
- Not Match: `^(?:.* = )?(?:None|[Tt]rue|[Ff]alse|[Nn]ull|Default(?:Type)?|Event|[A-Z]+_KEY|VERSION|NAME|update|destroy|(?:dis|en)ableEventListeners|\.\.\.),?$`
184-
- Not Match: `^(?:(?:this|self|obj)\.)(?:[A-Za-z_]+\,|[A-Za-z_].*)$`
185-
- Not Match: `^(?:[a-zA-Z_]+(?:\(\))?\.)*[a-zA-Z_]+\(\)$`
186-
- Not Match: `^\s*(?:typing\.)?(?:[Tt]uple|[Ll]ist|[Dd]ict|Callable|Iterable|Sequence|Optional|Union)\[.*$`
192+
- Not Match: ```^(?:keyPassphrase|password|key|[ \t]+|\$\{[A-Za-z0-9_-]+\}|(?:str|string|int|bool)( +#.*)?),?$```
193+
- Not Match: ```^(?:.* = )?(?:None|[Tt]rue|[Ff]alse|[Nn]ull|Default(?:Type)?|Event|[A-Z]+_KEY|VERSION|NAME|update|destroy|(?:dis|en)ableEventListeners|\.\.\.),?$```
194+
- Not Match: ```^(?:(?:this|self|obj)\.)(?:[A-Za-z_]+\,|[A-Za-z_].*)$```
195+
- Not Match: ```^(?:[a-zA-Z_]+(?:\(\))?\.)*[a-zA-Z_]+\(\)$```
196+
- Not Match: ```^\s*(?:typing\.)?(?:[Tt]uple|[Ll]ist|[Dd]ict|Callable|Iterable|Sequence|Optional|Union)\[.*$```
187197

188198
</p>
189199
</details>
@@ -192,15 +202,19 @@ Add these additional matches to the [Secret Scanning Custom Pattern](https://doc
192202

193203

194204

195-
*version: v0.1*
205+
_version: v0.1_
196206

197207
**Comments / Notes:**
198208

209+
199210
- Checks for all github action susing a version that isn't a pinned SHA-1 commit hash
211+
200212
- Checks for uses: org name / repo name @ string under 40 characters
213+
201214
- Not case sensative
202-
- exclude all actions in actions, github and advanced-security repo
203215

216+
- exclude all actions in actions, github and advanced-security repo
217+
204218

205219
<details>
206220
<summary>Pattern Format</summary>
@@ -232,13 +246,14 @@ Add these additional matches to the [Secret Scanning Custom Pattern](https://doc
232246

233247
</p>
234248
</details>
249+
235250
<details>
236251
<summary>Additional Matches</summary>
237252
<p>
238253
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).
239254

240255

241-
- Not Match: `^(actions|github|advanced-security)/`
256+
- Not Match: ```^(actions|github|advanced-security)/```
242257

243258
</p>
244259
</details>
@@ -247,12 +262,13 @@ Add these additional matches to the [Secret Scanning Custom Pattern](https://doc
247262

248263

249264

250-
*version: v0.1*
265+
_version: v0.1_
251266

252267
**Comments / Notes:**
253268

254-
- XML key/value format, <add key="key name" value="value of key" />
255269

270+
- XML key/value format, <add key="key name" value="value of key" />
271+
256272

257273
<details>
258274
<summary>Pattern Format</summary>
@@ -289,12 +305,13 @@ Add these additional matches to the [Secret Scanning Custom Pattern](https://doc
289305

290306

291307

292-
*version: v0.1*
308+
_version: v0.1_
293309

294310
**Comments / Notes:**
295311

296-
- contents of the validationKey or decryptionKey of a machineKey XML element
297312

313+
- contents of the validationKey or decryptionKey of a machineKey XML element
314+
298315

299316
<details>
300317
<summary>Pattern Format</summary>

0 commit comments

Comments
 (0)