Skip to content

Commit

Permalink
Refactor scanning
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Prodan <[email protected]>
  • Loading branch information
stefanprodan committed Feb 3, 2024
1 parent ab118bb commit 5c4bdc4
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/e2e-fips.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: FIPS conformance tests
on:
workflow_dispatch:
schedule:
- cron: '00 5 * * 1-5'
- cron: '00 6 * * 1-5'

permissions:
contents: read
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scan-fips.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: FIPS vulnerability scan
on:
workflow_dispatch:
schedule:
- cron: '00 4 * * 1-5'
- cron: '00 5 * * 1-5'

permissions:
contents: read
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/scan-upstream.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
packages: read
uses: ./.github/workflows/x-scan-controllers.yaml
with:
check-scan-error: false
sc: ${{ needs.get-controllers.outputs.sc }}
kc: ${{ needs.get-controllers.outputs.kc }}
hc: ${{ needs.get-controllers.outputs.hc }}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/x-release.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: release
name: x-release
on:
push:
tags: [ 'v*' ]
Expand Down Expand Up @@ -64,6 +64,7 @@ jobs:
run: |
cosign sign --yes ${{ steps.push.outputs.img_repository }}@${{ steps.push.outputs.img_digest }}
- name: Create release
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand Down
52 changes: 34 additions & 18 deletions .github/workflows/x-scan-controllers.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: scan-controllers
name: x-scan-controllers

on:
workflow_call:
Expand Down Expand Up @@ -27,8 +27,13 @@ on:
description: 'image-automation-controller image'
required: true
type: string
continue-on-error:
description: 'continue on error'
severity:
description: 'vulnerability severity'
required: false
type: string
default: 'CRITICAL,HIGH,MEDIUM'
check-scan-error:
description: 'check for scan errors'
required: false
type: boolean
default: true
Expand All @@ -54,96 +59,107 @@ jobs:
password: ${{ secrets.pull-token }}
- name: Scan source-controller
id: sc
continue-on-error: ${{ inputs.continue-on-error }}
continue-on-error: true
uses: aquasecurity/trivy-action@d43c1f16c00cfd3978dde6c07f4bbcf9eb6993ca # v0.16.1
with:
image-ref: ${{ inputs.sc }}
format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
severity: ${{ inputs.severity }}
env:
TRIVY_USERNAME: ${{ github.actor }}
TRIVY_PASSWORD: ${{ secrets.pull-token }}
- name: Scan kustomize-controller
id: kc
continue-on-error: ${{ inputs.continue-on-error }}
continue-on-error: true
uses: aquasecurity/trivy-action@d43c1f16c00cfd3978dde6c07f4bbcf9eb6993ca # v0.16.1
with:
image-ref: ${{ inputs.kc }}
format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
severity: ${{ inputs.severity }}
env:
TRIVY_USERNAME: ${{ github.actor }}
TRIVY_PASSWORD: ${{ secrets.pull-token }}
- name: Scan helm-controller
id: hc
continue-on-error: ${{ inputs.continue-on-error }}
continue-on-error: true
uses: aquasecurity/trivy-action@d43c1f16c00cfd3978dde6c07f4bbcf9eb6993ca # v0.16.1
with:
image-ref: ${{ inputs.hc }}
format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
severity: ${{ inputs.severity }}
env:
TRIVY_USERNAME: ${{ github.actor }}
TRIVY_PASSWORD: ${{ secrets.pull-token }}
- name: Scan notification-controller
id: nc
continue-on-error: ${{ inputs.continue-on-error }}
continue-on-error: true
uses: aquasecurity/trivy-action@d43c1f16c00cfd3978dde6c07f4bbcf9eb6993ca # v0.16.1
with:
image-ref: ${{ inputs.nc }}
format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
severity: ${{ inputs.severity }}
env:
TRIVY_USERNAME: ${{ github.actor }}
TRIVY_PASSWORD: ${{ secrets.pull-token }}
- name: Scan image-reflector-controller
id: irc
continue-on-error: ${{ inputs.continue-on-error }}
continue-on-error: true
uses: aquasecurity/trivy-action@d43c1f16c00cfd3978dde6c07f4bbcf9eb6993ca # v0.16.1
with:
image-ref: ${{ inputs.irc }}
format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
severity: ${{ inputs.severity }}
env:
TRIVY_USERNAME: ${{ github.actor }}
TRIVY_PASSWORD: ${{ secrets.pull-token }}
- name: Scan image-automation-controller
id: iac
continue-on-error: ${{ inputs.continue-on-error }}
continue-on-error: true
uses: aquasecurity/trivy-action@d43c1f16c00cfd3978dde6c07f4bbcf9eb6993ca # v0.16.1
with:
image-ref: ${{ inputs.iac }}
format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
severity: ${{ inputs.severity }}
env:
TRIVY_USERNAME: ${{ github.actor }}
TRIVY_PASSWORD: ${{ secrets.pull-token }}
- name: Scan result
if : steps.sc.outcome == 'failure' || steps.kc.outcome == 'failure' || steps.hc.outcome == 'failure' || steps.nc.outcome == 'failure' || steps.irc.outcome == 'failure' || steps.iac.outcome == 'failure'
run: |
echo "One or more controllers have vulnerabilities"
echo "source-controller: ${{ steps.sc.outcome }}"
echo "image: ${{ inputs.sc }}"
echo "kustomize-controller: ${{ steps.kc.outcome }}"
echo "image: ${{ inputs.kc }}"
echo "helm-controller: ${{ steps.hc.outcome }}"
echo "image: ${{ inputs.hc }}"
echo "notification-controller: ${{ steps.nc.outcome }}"
echo "image: ${{ inputs.nc }}"
echo "image-reflector-controller: ${{ steps.irc.outcome }}"
echo "image: ${{ inputs.irc }}"
echo "image-automation-controller: ${{ steps.iac.outcome }}"
exit 1
echo "image: ${{ inputs.iac }}"
- name: Check result
shell: bash
if : steps.sc.outcome == 'failure' || steps.kc.outcome == 'failure' || steps.hc.outcome == 'failure' || steps.nc.outcome == 'failure' || steps.irc.outcome == 'failure' || steps.iac.outcome == 'failure'
run: |
echo "One or more controllers have vulnerabilities"
if [ "${{ inputs.check-scan-error }}" = "true" ]; then
exit 1
fi

0 comments on commit 5c4bdc4

Please sign in to comment.