|
| 1 | +# KICS (Keeping Infrastructure as Code Secure) – whole repo IaC scan. |
| 2 | +# Run alongside Trivy (trivy.yml) to compare findings. |
| 3 | +# Scans: Kubernetes, Helm, Dockerfile, etc. |
| 4 | +# |
| 5 | +# ADVANCED_SECURITY (same as trivy.yml): when "true", upload SARIF + artifacts. |
| 6 | +# |
| 7 | +name: KICS IaC Scan |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + security-events: write |
| 12 | + actions: read |
| 13 | + |
| 14 | +on: |
| 15 | + push: |
| 16 | + branches: [ main ] |
| 17 | + pull_request: |
| 18 | + branches: [ main ] |
| 19 | + |
| 20 | +concurrency: |
| 21 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 22 | + cancel-in-progress: true |
| 23 | + |
| 24 | +env: |
| 25 | + ADVANCED_SECURITY: "false" |
| 26 | + |
| 27 | +jobs: |
| 28 | + kics: |
| 29 | + name: kics-iac |
| 30 | + runs-on: ubuntu-latest |
| 31 | + steps: |
| 32 | + - name: Checkout |
| 33 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 34 | + |
| 35 | + - name: Create results dir |
| 36 | + run: mkdir -p results-dir |
| 37 | + |
| 38 | + - name: Run KICS |
| 39 | + uses: synkube/actions/.github/actions/kics-github-action@main |
| 40 | + with: |
| 41 | + path: . |
| 42 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 43 | + output_path: results-dir/ |
| 44 | + output_formats: json,sarif |
| 45 | + ignore_on_exit: results |
| 46 | + |
| 47 | + - name: Upload KICS SARIF |
| 48 | + if: env.ADVANCED_SECURITY == 'true' |
| 49 | + uses: github/codeql-action/upload-sarif@95e58e9a2cdfd71adc6e0353d5c52f41a045d225 # v4.35.2 |
| 50 | + continue-on-error: true |
| 51 | + with: |
| 52 | + sarif_file: "results-dir/results.sarif" |
| 53 | + category: "kics-iac" |
| 54 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 55 | + |
| 56 | + - name: Upload KICS results as artifacts |
| 57 | + if: env.ADVANCED_SECURITY == 'true' |
| 58 | + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 59 | + with: |
| 60 | + name: kics-results |
| 61 | + path: results-dir/ |
0 commit comments