Skip to content

Commit 98444ad

Browse files
feat: remove skip scan option and add optional removal of high severity scan
1 parent 1762af6 commit 98444ad

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

.github/workflows/build-docker-artifacts-config.schema.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@
3535
"type": "string",
3636
"description": "ECR repository to push the image to"
3737
},
38-
"skip_image_scan": {
38+
"scan_high_severity": {
3939
"type": "boolean",
40-
"default": false,
41-
"description": "Skip scanning the image for vulnerabilities"
40+
"default": true,
41+
"description": "Scan the image for high severity vulnerabilities"
4242
}
4343
},
4444
"required": ["directory", "ecr_repository"]

.github/workflows/build-docker-artifacts.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ on:
2222
type: boolean
2323
required: false
2424
default: true
25-
skip_image_scan:
25+
scan_high_severity:
26+
description: 'Include high severity'
2627
type: boolean
2728
required: false
28-
default: false
29+
default: true
2930
runs_on:
3031
type: string
3132
required: false
@@ -240,16 +241,23 @@ jobs:
240241
# https://github.com/docker/build-push-action/issues/1156#issuecomment-2437227730
241242
DOCKER_BUILD_SUMMARY: false
242243

244+
- name: Determine trivy scan severity levels
245+
id: set_severity
246+
run: |
247+
if [[ ${{ inputs.scan_high_severity }} != true ]]; then
248+
echo "severity=CRITICAL" >> $GITHUB_OUTPUT
249+
else
250+
echo "severity=HIGH,CRITICAL" >> $GITHUB_OUTPUT
251+
fi
243252
- name: Run Trivy vulnerability scanner
244-
if: ${{ inputs.skip_image_scan != true && fromJson(vars.SKIP_IMAGE_SCAN || 'false') != true && matrix.component.skip_image_scan != true }}
245253
uses: aquasecurity/[email protected]
246254
with:
247255
image-ref: ${{ vars.DV_AWS_ECR_REGISTRY }}/${{ matrix.component.ecr_repository }}:${{ matrix.component.image_tag }}
248256
format: 'table'
249257
exit-code: '1'
250258
ignore-unfixed: false
251259
vuln-type: 'os,library'
252-
severity: 'HIGH,CRITICAL'
260+
severity: ${{ steps.set_severity.outputs.severity }}
253261
continue-on-error: false
254262

255263
- name: Push image

0 commit comments

Comments
 (0)