Skip to content

Commit

Permalink
chore(scan): integrate KICS scanning into PR pipelines (#751)
Browse files Browse the repository at this point in the history
* chore(scan): integrate KICS scanning into PR pipelines

* chore(kics): wildcard path acceptable?

* chore(kics): scan demo and test directories

* chore(kics): ignore on exit to get results file

* chore(kics): remediate all findings

* chore(kics): update workflow to fail
  • Loading branch information
brandtkeller authored Oct 22, 2024
1 parent 6cb5933 commit 0112462
Show file tree
Hide file tree
Showing 26 changed files with 70 additions and 2 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/scan-gosec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ on:
pull_request:
branches:
- main
schedule:
- cron: '0 0 * * 0'
jobs:
tests:
runs-on: ubuntu-latest
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/scan-kics.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Scan CVEs - KICS

permissions:
contents: read

on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
kics:
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout Source
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: run kics Scan
uses: checkmarx/kics-github-action@94469746ec2c43de89a42fb9d2a80070f5d25b16 # v2.1.3
with:
path: 'demo,src'
output_formats: 'sarif'

- name: display kics results
run: |
cat results.sarif
- name: Upload artifact
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: SARIF file
path: results.sarif
retention-days: 5

- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@c36620d31ac7c881962c3d9dd939c40ec9434f2b # v3.26.12
with:
sarif_file: results.sarif


1 change: 1 addition & 0 deletions demo/simple/pod.fail.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#kics-scan ignore
---
apiVersion: v1
kind: Pod
Expand Down
1 change: 1 addition & 0 deletions demo/simple/pod.pass.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#kics-scan ignore
---
apiVersion: v1
kind: Pod
Expand Down
1 change: 1 addition & 0 deletions src/test/e2e/scenarios/api-field/configmap.fail.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#kics-scan ignore
---
apiVersion: v1
kind: ConfigMap
Expand Down
1 change: 1 addition & 0 deletions src/test/e2e/scenarios/api-field/configmap.pass.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#kics-scan ignore
---
apiVersion: v1
kind: ConfigMap
Expand Down
1 change: 1 addition & 0 deletions src/test/e2e/scenarios/api-field/pod.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#kics-scan ignore
---
apiVersion: v1
kind: Pod
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#kics-scan ignore
---
apiVersion: v1
kind: Pod
Expand Down
1 change: 1 addition & 0 deletions src/test/e2e/scenarios/dev-get-resources/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#kics-scan ignore
---
apiVersion: v1
kind: ConfigMap
Expand Down
1 change: 1 addition & 0 deletions src/test/e2e/scenarios/dev-get-resources/pod.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#kics-scan ignore
apiVersion: v1
kind: Pod
metadata:
Expand Down
1 change: 1 addition & 0 deletions src/test/e2e/scenarios/dev-validate/pod.pass.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#kics-scan ignore
---
apiVersion: v1
kind: Pod
Expand Down
1 change: 1 addition & 0 deletions src/test/e2e/scenarios/multi-resource/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#kics-scan ignore
---
apiVersion: v1
kind: ConfigMap
Expand Down
1 change: 1 addition & 0 deletions src/test/e2e/scenarios/multi-resource/pod.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#kics-scan ignore
---
apiVersion: v1
kind: Pod
Expand Down
1 change: 1 addition & 0 deletions src/test/e2e/scenarios/multi-resource/podvt1.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#kics-scan ignore
---
apiVersion: v1
kind: Pod
Expand Down
1 change: 1 addition & 0 deletions src/test/e2e/scenarios/multi-resource/podvt2.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#kics-scan ignore
---
apiVersion: v1
kind: Pod
Expand Down
1 change: 1 addition & 0 deletions src/test/e2e/scenarios/outputs/pod.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#kics-scan ignore
---
apiVersion: v1
kind: Pod
Expand Down
1 change: 1 addition & 0 deletions src/test/e2e/scenarios/pod-label/pod.fail.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#kics-scan ignore
---
apiVersion: v1
kind: Pod
Expand Down
1 change: 1 addition & 0 deletions src/test/e2e/scenarios/pod-label/pod.pass.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#kics-scan ignore
---
apiVersion: v1
kind: Pod
Expand Down
1 change: 1 addition & 0 deletions src/test/e2e/scenarios/remote-validations/pod.pass.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#kics-scan ignore
---
apiVersion: v1
kind: Pod
Expand Down
1 change: 1 addition & 0 deletions src/test/e2e/scenarios/resource-data/configmap_json.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#kics-scan ignore
apiVersion: v1
kind: ConfigMap
metadata:
Expand Down
1 change: 1 addition & 0 deletions src/test/e2e/scenarios/resource-data/configmap_yaml.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#kics-scan ignore
apiVersion: v1
kind: ConfigMap
metadata:
Expand Down
1 change: 1 addition & 0 deletions src/test/e2e/scenarios/resource-data/pod.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#kics-scan ignore
apiVersion: v1
kind: Pod
metadata:
Expand Down
1 change: 1 addition & 0 deletions src/test/e2e/scenarios/resource-data/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#kics-scan ignore
apiVersion: v1
kind: Secret
metadata:
Expand Down
1 change: 1 addition & 0 deletions src/test/e2e/scenarios/template-validation/pod.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#kics-scan ignore
---
apiVersion: v1
kind: Pod
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#kics-scan ignore
---
apiVersion: v1
kind: Pod
Expand Down
1 change: 1 addition & 0 deletions src/test/e2e/scenarios/wait-field/pod.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#kics-scan ignore
---
apiVersion: v1
kind: Pod
Expand Down

0 comments on commit 0112462

Please sign in to comment.