|
1 |
| -## My Project |
| 1 | +# Amazon CodeGuru Security for GitHub Actions |
2 | 2 |
|
3 |
| -TODO: Fill this README out! |
| 3 | +Amazon CodeGuru Security finds issues in your code and provides recommendations on how to remediate them. CodeGuru Security identifies [Security vulnerabilities](https://aws.amazon.com/blogs/devops/tightening-application-security-with-amazon-codeguru/), such as risks from the top [10 OWASP categories](https://owasp.org/www-project-top-ten/). |
4 | 4 |
|
5 |
| -Be sure to: |
| 5 | +Amazon CodeGuru Security action can be triggered by a pull request, push, or scheduled run of your CI/CD pipeline. |
6 | 6 |
|
7 |
| -* Change the title in this README |
8 |
| -* Edit your repository description on GitHub |
| 7 | +For more information about setup, see [Create code security reviews with GitHub Actions](https://docs.aws.amazon.com/codeguru/latest/security-ug/get-started-github.html) in the *Amazon CodeGuru Security User Guide*. |
| 8 | + |
| 9 | +To add CodeGuru Security to your CI/CD pipeline, follow the steps under the *Usage* section. |
| 10 | + |
| 11 | +## Usage |
| 12 | + |
| 13 | +**Step 1: Set up Your workflow.yml File** |
| 14 | + |
| 15 | +* **Add checkout to your workflow:** |
| 16 | + |
| 17 | +For CodeGuru Security to run, check out your repository using [actions/checkout@v2](https://github.com/actions/checkout). **You will need to set fetch-depth: 0 to fetch all history for all branches and tags.** For example: |
| 18 | + |
| 19 | +``` |
| 20 | +- name: Checkout repository |
| 21 | + uses: actions/checkout@v2 |
| 22 | + with: |
| 23 | + fetch-depth: 0 # This is a required field for CodeGuru |
| 24 | +``` |
| 25 | + |
| 26 | +* **Provide your AWS Credentials:** |
| 27 | + |
| 28 | +We recommend following the instructions and using [aws-actions/configure-aws-credentials](https://github.com/aws-actions/configure-aws-credentials) to configure your credentials for a job. The IAM user or IAM role requires [AmazonCodeGuruSecurityFullAccess](<url place holder>) policy. The CodeGuru Security action supports credentials from GitHub hosted runners and self-hosted runners. |
| 29 | + |
| 30 | +**Step 2: Add Amazon CodeGuru Security Action** |
| 31 | + |
| 32 | +The source_path is assumed to be the root of the repository (e.g. "."). |
| 33 | + |
| 34 | +Input Parameters: |
| 35 | + |
| 36 | +* aws_region: **Required**. AWS region where you want to run workflow. |
| 37 | + |
| 38 | +``` |
| 39 | +- name: CodeGuru Security |
| 40 | + uses: aws-actions/codeguru-security@v1.0 # to do replace this after action release |
| 41 | + with: |
| 42 | + source_path: . |
| 43 | + aws_region: us-east-1 |
| 44 | +- name: print findings. |
| 45 | + run: | |
| 46 | + ls -l |
| 47 | + cat codeguru-security-results.sarif.json |
| 48 | +``` |
| 49 | + |
| 50 | +**Step 3: Upload Results to GitHub** |
| 51 | + |
| 52 | +After your job is completed, you can view your results within the AWS Console or GitHub. To view the results in GitHub, we recommend uploading the results generated in the SARIF (Static Analysis Results Interchange Format) into GitHub using the following example codeql-action. For more details, see the upload instructions in the [GitHub documentation](https://docs.github.com/en/code-security/secure-coding/uploading-a-sarif-file-to-github#example-workflow-for-sarif-files-generated-outside-of-a-repository). |
| 53 | + |
| 54 | +``` |
| 55 | +- name: Upload review result |
| 56 | + uses: github/codeql-action/upload-sarif@v1 |
| 57 | + with: |
| 58 | + sarif_file: codeguru-security-results.sarif.json # Your results file will be named codeguru-security-results.sarif.json |
| 59 | +``` |
| 60 | + |
| 61 | +## Recommendations |
| 62 | + |
| 63 | +After you run the CodeGuru Security Action, security findings are posted on the Security tab in the GitHub UI and in the Finding section of the CodeGuru Security console. |
9 | 64 |
|
10 | 65 | ## Security
|
11 | 66 |
|
12 | 67 | See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.
|
13 | 68 |
|
14 | 69 | ## License
|
15 | 70 |
|
16 |
| -This project is licensed under the Apache-2.0 License. |
17 |
| - |
| 71 | +This library is licensed under the Apache-2.0 License. See the [LICENSE](LICENSE) file. |
0 commit comments