IaC Scanning with Checkmarx KICS #79
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/Checkmarx/kics | |
# https://github.com/Checkmarx/kics/blob/master/docs/integrations_ghactions.md | |
# https://github.com/Checkmarx/kics-github-action | |
name: IaC Scanning with Checkmarx KICS | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
schedule: | |
- cron: '15 03 * * 5' | |
permissions: | |
contents: read # for actions/checkout to fetch code | |
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results | |
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status | |
jobs: | |
kics-scan: | |
name: Run KICS scan | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Mkdir results-dir | |
# make sure results dir is created | |
run: mkdir -p results-dir | |
- name: Run kics Scan | |
uses: checkmarx/[email protected] | |
with: | |
path: 'terraform' | |
# when provided with a directory on output_path | |
# it will generate the specified reports file named 'results.{extension}' | |
# in this example it will generate: | |
# - results-dir/results.json | |
# - results-dir/results.sarif | |
ignore_on_exit: results | |
output_path: results-dir | |
platform_type: terraform | |
output_formats: 'json,sarif' | |
enable_comments: true | |
- name: Show results | |
run: | | |
cat results-dir/results.sarif | |
cat results-dir/results.json | |
- name: Upload SARIF file to GitHub Security tab | |
uses: github/codeql-action/upload-sarif@v3 | |
with: | |
sarif_file: results-dir/results.sarif |