|
1 | | -# custom-pattern-secrets |
| 1 | +# Secret Scanning Tools |
2 | 2 |
|
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. |
4 | 4 |
|
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. |
6 | 6 |
|
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. |
9 | 8 |
|
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). |
11 | 10 |
|
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). |
13 | 12 |
|
14 | | -### [Configuration Secrets](./configs) |
| 13 | +## Usage in Actions |
15 | 14 |
|
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 | +``` |
22 | 19 |
|
23 | | -### [Database passwords](./database) |
| 20 | +### Advanced Configuration |
24 | 21 |
|
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 | +``` |
29 | 30 |
|
30 | | -### [Generic Secrets / Passwords](./generic) |
| 31 | +### Using GitHub App Token |
31 | 32 |
|
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 }} |
35 | 40 |
|
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 | +``` |
37 | 46 |
|
38 | | -- JWT |
| 47 | +## Offline testing of Secret Scanning custom patterns |
39 | 48 |
|
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. |
41 | 50 |
|
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. |
43 | 52 |
|
44 | | -### [Personally identifiable information (PII)](./pii) |
| 53 | +### Local test script usage |
45 | 54 |
|
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`. |
52 | 56 |
|
53 | | -### [RSA Keys](./rsa) |
| 57 | +First run `make requirements` to install required dependencies. |
54 | 58 |
|
55 | | -- Generic RSA keys |
56 | | -- SSH Private Keys |
57 | | -- GPG Private Key |
| 59 | +``` bash |
| 60 | +./test.py |
| 61 | +``` |
58 | 62 |
|
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. |
60 | 64 |
|
61 | | -- Hardcoded Internal Emails |
62 | | -- Hardcoded Internal URLs |
63 | | -- Hardcoded URI Passwords |
64 | | -- Routable IPv4 Addresses |
65 | | -- GitHub Container Registry typos |
| 65 | +or |
66 | 66 |
|
67 | | -### [Vendors](./vendors) |
| 67 | +``` bash |
| 68 | +./test.py --tests <directory> |
| 69 | +``` |
68 | 70 |
|
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. |
0 commit comments