5151 contents : read # for docker/build-push-action to read repo content
5252 security-events : write # for github/codeql-action/upload-sarif to upload SARIF results
5353 id-token : write # for OIDC login to AWS
54+ pull-requests : write # for scout report
5455 runs-on : ubuntu-22.04
5556 steps :
5657 - name : Checkout Repository
@@ -195,8 +196,12 @@ jobs:
195196 ${{ contains(inputs.image, 'ubi') && format('"rhel_license={0}"', secrets.RHEL_LICENSE) || '' }}
196197 if : ${{ steps.base_exists.outputs.exists != 'true' || steps.target_exists.outputs.exists != 'true' }}
197198
198- - name : Extract image name for Trivy
199- id : trivy-tag
199+ - name : Make directory for security scan results
200+ run : |
201+ mkdir -p "${{ inputs.image }}-results/"
202+
203+ - name : Extract image name for Scans
204+ id : scan-tag
200205 run : |
201206 tag=$(echo $DOCKER_METADATA_OUTPUT_JSON | jq -r '[ .tags[] | select(contains("f5-gcs-7899"))] | .[0]')
202207 echo "tag=$tag" >> $GITHUB_OUTPUT
@@ -206,23 +211,38 @@ jobs:
206211 uses : aquasecurity/trivy-action@595be6a0f6560a0a8fc419ddf630567fc623531d # 0.22.0
207212 continue-on-error : true
208213 with :
209- image-ref : ${{ steps.trivy -tag.outputs.tag }}
214+ image-ref : ${{ steps.scan -tag.outputs.tag }}
210215 format : " sarif"
211- output : " trivy-results- ${{ inputs.image }}.sarif"
216+ output : " ${{ inputs.image }}-results/trivy .sarif"
212217 ignore-unfixed : " true"
213218 if : ${{ inputs.authenticated && steps.build-push.conclusion == 'success' }}
214219
215- - name : Upload Trivy scan results to GitHub Security tab
216- uses : github/codeql-action/upload-sarif@530d4feaa9c62aaab2d250371e2061eb7a172363 # v3.25.9
220+ - name : DockerHub Login for Docker Scount
221+ uses : docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
222+ with :
223+ username : ${{ secrets.DOCKER_USERNAME }}
224+ password : ${{ secrets.DOCKER_PASSWORD }}
225+ if : ${{ inputs.authenticated && steps.build-push.conclusion == 'success' }}
226+
227+ - name : Run Docker Scout vulnerability scanner
228+ id : docker-scout
229+ uses : docker/scout-action@5dae9c7571dd0f3de81f5b501240c593c13c3eb6 # v1.9.3
217230 continue-on-error : true
218231 with :
219- sarif_file : " trivy-results-${{ inputs.image }}.sarif"
232+ command : cves,recommendations
233+ image : ${{ steps.scan-tag.outputs.tag }}
234+ ignore-base : true
235+ only-fixed : true
236+ sarif-file : " ${{ inputs.image }}-results/scout.sarif"
237+ write-comment : false
238+ github-token : ${{ secrets.GITHUB_TOKEN }} # to be able to write the comment
239+ summary : true
220240 if : ${{ inputs.authenticated && steps.build-push.conclusion == 'success' }}
221241
222242 - name : Upload Scan Results
223243 uses : actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
224244 continue-on-error : true
225245 with :
226- name : " trivy-results- ${{ inputs.image }}.sarif "
227- path : " trivy-results- ${{ inputs.image }}.sarif "
228- if : always()
246+ name : " ${{ inputs.image }}-results "
247+ path : " ${{ inputs.image }}-results/ "
248+ if : ${{ inputs.authenticated && steps.build-push.conclusion == 'success' }}
0 commit comments