|
1 | 1 | # `code-scanning-playground`
|
2 | 2 | > :wave: :earth_americas: a playground for **Code Scanning** :roller_coaster:
|
3 | 3 |
|
| 4 | +## Contents |
| 5 | +- [About](#about) |
| 6 | +- [How it works](#how-it-works) |
| 7 | +- [Getting started](#getting-started) |
| 8 | +- [Additional resources](#additional-resources) |
| 9 | + |
4 | 10 | ## About
|
5 |
| -This repo demonstrates GitHub's [Code Scanning feature](), using ESLint to generate a "code scanning alert" in the Security tab. |
| 11 | +This is a template repo, demonstrating GitHub's [Code Scanning capability](https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/about-code-scanning), using ESLint to generate a "code scanning alert" in GitHub's Security tab: |
6 | 12 |
|
7 | 13 | 
|
8 | 14 |
|
9 |
| -Register for the code scanning beta [here](https://github.com/features/security/advanced-security/signup). |
| 15 | +## How it works |
| 16 | +- The ESLint analysis workflow [runs on a schedule, and on every `push`](https://github.com/swinton/code-scanning-playground/blob/20366008d4376dd1899559fba0bf5fbbece109c3/.github/workflows/upload-sarif.yml#L3-L8) |
| 17 | +- The ESLint output is [formatted as SARIF](https://github.com/swinton/code-scanning-playground/blob/20366008d4376dd1899559fba0bf5fbbece109c3/.github/workflows/upload-sarif.yml#L18-L20), using the [`@microsoft/eslint-formatter-sarif`](https://github.com/microsoft/sarif-sdk/tree/master/src/ESLint.Formatter#readme) package |
| 18 | +- The SARIF report is submitted to GitHub via the [`github/codeql-action/upload-sarif`](https://github.com/github/codeql-action/tree/main/upload-sarif) action |
| 19 | + |
| 20 | +## Getting started |
| 21 | +1. Register for the code scanning beta [here](https://github.com/features/security/advanced-security/signup) |
| 22 | +1. [Generate a copy of this repo](https://github.com/swinton/code-scanning-playground/generate) |
| 23 | +1. Push a commit -- it can even be an empty commit (`git commit --allow-empty`) |
| 24 | +1. Observe as a new security alert is generated |
10 | 25 |
|
11 |
| -## Resources |
12 |
| -* microsoft/sarif-tutorials: User-friendly documentation for the SARIF file format., https://github.com/microsoft/sarif-tutorials |
13 |
| -* SARIF support for code scanning - GitHub Docs, https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/sarif-support-for-code-scanning |
14 |
| -* Example workflow that runs the ESLint analysis tool, https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/uploading-a-sarif-file-to-github#example-workflow-that-runs-the-eslint-analysis-tool |
15 |
| -* REST API: https://docs.github.com/en/rest/reference/code-scanning |
| 26 | +## Additional resources |
| 27 | +- [SARIF example output](example.sarif.json) |
| 28 | +- [`microsoft/sarif-tutorials`](https://github.com/microsoft/sarif-tutorials): User-friendly documentation for the SARIF file format |
| 29 | +- [SARIF support for code scanning](https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/sarif-support-for-code-scanning) |
| 30 | +- [Example workflow that runs the ESLint analysis tool](https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/uploading-a-sarif-file-to-github#example-workflow-that-runs-the-eslint-analysis-tool) |
| 31 | +- REST API: https://docs.github.com/en/rest/reference/code-scanning |
0 commit comments