|
| 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 | +#This workflow runs the Zscaler Infrastructure as Code (IaC) Scan app, |
| 7 | +#which detects security misconfigurations in IaC templates and publishes the findings |
| 8 | +#under the code scanning alerts section within the repository. |
| 9 | + |
| 10 | +#Log into the Zscaler Posture Control(ZPC) Portal to begin the onboarding process. |
| 11 | +#Copy the client ID and client secret key generated during the onboarding process and configure. |
| 12 | +#GitHub secrets (ZSCANNER_CLIENT_ID, ZSCANNER_CLIENT_SECRET). |
| 13 | + |
| 14 | +#Refer https://github.com/marketplace/actions/zscaler-iac-scan for additional details on setting up this workflow. |
| 15 | +#Any issues with this workflow, please raise it on https://github.com/ZscalerCWP/Zscaler-IaC-Action/issues for further investigation. |
| 16 | + |
| 17 | +name: Zscaler IaC Scan |
| 18 | +on: |
| 19 | + push: |
| 20 | + branches: [ "main" ] |
| 21 | + pull_request: |
| 22 | + branches: [ "main" ] |
| 23 | + schedule: |
| 24 | + - cron: '29 18 * * 1' |
| 25 | + |
| 26 | +permissions: |
| 27 | + contents: read |
| 28 | + |
| 29 | +jobs: |
| 30 | + zscaler-iac-scan: |
| 31 | + permissions: |
| 32 | + contents: read # for actions/checkout to fetch code |
| 33 | + security-events: write # for github/codeql-action/upload-sarif to upload SARIF results |
| 34 | + runs-on: ubuntu-latest |
| 35 | + steps: |
| 36 | + - name : Code Checkout |
| 37 | + uses: actions/checkout@v4 |
| 38 | + - name : Zscaler IAC Scan |
| 39 | + uses : ZscalerCWP/Zscaler-IaC-Action@8d2afb33b10b4bd50e2dc2c932b37c6e70ac1087 |
| 40 | + id : zscaler-iac-scan |
| 41 | + with: |
| 42 | + client_id : ${{ secrets.ZSCANNER_CLIENT_ID }} |
| 43 | + client_secret : ${{ secrets.ZSCANNER_CLIENT_SECRET }} |
| 44 | + #This is the user region specified during the onboarding process within the ZPC Admin Portal. |
| 45 | + region : 'US' |
| 46 | + iac_dir : #Enter the IaC directory path from root. |
| 47 | + iac_file : #Enter the IaC file path from root. |
| 48 | + output_format : #(Optional) By default, the output is provided in a human readable format. However, if you require a different format, you can specify it here. |
| 49 | + #To fail the build based on policy violations identified in the IaC templates, set the input value (fail_build) to true. |
| 50 | + fail_build : #Enter true/false |
| 51 | + #Ensure that the following step is included in order to post the scan results under the code scanning alerts section within the repository. |
| 52 | + - name: Upload SARIF file |
| 53 | + if: ${{ success() || failure() && (steps.zscaler-iac-scan.outputs.sarif_file_path != '') }} |
| 54 | + uses: github/codeql-action/upload-sarif@v3 |
| 55 | + with: |
| 56 | + sarif_file: ${{ steps.zscaler-iac-scan.sarif_file_path }} |
0 commit comments