Skip to content

Commit

Permalink
Scan All Configured Docker Images
Browse files Browse the repository at this point in the history
  • Loading branch information
EmteZogaf committed Nov 21, 2024
1 parent 5814031 commit b692b33
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,69 @@ jobs:
run: |
ACCESS_TOKEN="$(feasibility-triangle/get-fhir-server-access-token.sh)"
.github/scripts/test-consent-queries.sh https://fhir.localhost:444/fhir "$ACCESS_TOKEN" feasibility-triangle/auth/cert.pem
prepare-security-scan:
runs-on: ubuntu-latest
outputs:
images: ${{ steps.matrixgen.outputs.images }}
steps:

- uses: actions/checkout@v4

- name: Generate Image Test Matrix
id: matrixgen
run: |
echo "images=$(
first=true
echo -n '['
for i in $(grep -r --include="*docker-compose.yml" -Pho 'image: \K(.+)$' | tr -d "\"'" | sort | uniq)
do
if $first
then
first=false
else
echo -n ","
fi
echo -n '"'$i'"'
done
echo ']')" >> "$GITHUB_OUTPUT"
security-scan:
runs-on: ubuntu-latest
needs: prepare-security-scan
strategy:
fail-fast: false
matrix:
image: ${{ fromJSON(needs.prepare-security-scan.outputs.images) }}
steps:
- name: Run Trivy Vulnerability Scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: ${{ matrix.image }}
exit-code: 1
ignore-unfixed: true
severity: 'CRITICAL,HIGH'
timeout: '15m0s'

security-scan-upload:
runs-on: ubuntu-latest
needs: prepare-security-scan
strategy:
fail-fast: false
matrix:
image: ${{ fromJSON(needs.prepare-security-scan.outputs.images) }}
steps:
- name: Run Trivy Vulnerability Scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: ${{ matrix.image }}
format: sarif
ignore-unfixed: true
output: trivy-results.sarif
severity: 'CRITICAL,HIGH'
timeout: '15m0s'

- name: Upload Trivy Scan Results to GitHub Security Tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: trivy-results.sarif

0 comments on commit b692b33

Please sign in to comment.