Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scan All Configured Docker Images #31

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading