|
| 1 | +# This workflow uses actions that are not certified by GitHub. |
| 2 | +# They are provided by a third-party and are governed by |
| 3 | +# separate terms of service, privacy policy, and support |
| 4 | +# documentation. |
| 5 | + |
| 6 | +# A sample workflow which checks out your Infrastructure as Code Configuration files, |
| 7 | +# such as Kubernetes, Helm & Terraform and scans them for any security issues. |
| 8 | +# The results are then uploaded to GitHub Security Code Scanning |
| 9 | +# |
| 10 | +# For more examples, including how to limit scans to only high-severity issues |
| 11 | +# and fail PR checks, see https://github.com/snyk/actions/ |
| 12 | + |
| 13 | +name: Snyk Infrastructure as Code |
| 14 | + |
| 15 | +on: |
| 16 | + push: |
| 17 | + branches: [ "master" ] |
| 18 | + pull_request: |
| 19 | + # The branches below must be a subset of the branches above |
| 20 | + branches: [ "master" ] |
| 21 | + schedule: |
| 22 | + - cron: '39 16 * * 6' |
| 23 | + |
| 24 | +permissions: |
| 25 | + contents: read |
| 26 | + |
| 27 | +jobs: |
| 28 | + snyk: |
| 29 | + permissions: |
| 30 | + contents: read # for actions/checkout to fetch code |
| 31 | + security-events: write # for github/codeql-action/upload-sarif to upload SARIF results |
| 32 | + actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status |
| 33 | + runs-on: ubuntu-latest |
| 34 | + steps: |
| 35 | + - uses: actions/checkout@v3 |
| 36 | + - name: Run Snyk to check configuration files for security issues |
| 37 | + # Snyk can be used to break the build when it detects security issues. |
| 38 | + # In this case we want to upload the issues to GitHub Code Scanning |
| 39 | + continue-on-error: true |
| 40 | + uses: snyk/actions/iac@14818c4695ecc4045f33c9cee9e795a788711ca4 |
| 41 | + env: |
| 42 | + # In order to use the Snyk Action you will need to have a Snyk API token. |
| 43 | + # More details in https://github.com/snyk/actions#getting-your-snyk-token |
| 44 | + # or you can signup for free at https://snyk.io/login |
| 45 | + SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} |
| 46 | + with: |
| 47 | + # Add the path to the configuration file that you would like to test. |
| 48 | + # For example `deployment.yaml` for a Kubernetes deployment manifest |
| 49 | + # or `main.tf` for a Terraform configuration file |
| 50 | + file: your-file-to-test.yaml |
| 51 | + - name: Upload result to GitHub Code Scanning |
| 52 | + uses: github/codeql-action/upload-sarif@v2 |
| 53 | + with: |
| 54 | + sarif_file: snyk.sarif |
0 commit comments