Skip to content

Scan All Configured Docker Images #279

Scan All Configured Docker Images

Scan All Configured Docker Images #279

Workflow file for this run

name: CI
on:
push:
branches:
- main
- develop
tags:
- v[0-9]+.[0-9]+.[0-9]+**
pull_request:
branches:
- main
- develop
env:
FEASIBILITY_COMPOSE_PROJECT: test
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- name: Check shell scripts
uses: ludeeus/action-shellcheck@master
with:
ignore_paths: .github/scripts
test-feasibility-triangle-fhir-server:
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- name: Install Blazectl
run: .github/scripts/install-blazectl.sh
- name: Initialize .env's
run: feasibility-triangle/initialise-triangle-env-files.sh
- name: Change Configuration for localhost
run: |
sed -i -r -e 's#^(FHIR_SERVER_OPENID_PROVIDER_URL)=.*$#\1=https://auth.localhost:444/realms/blaze#' \
-e 's#^(FHIR_SERVER_FRONTEND_KEYCLOAK_HOSTNAME_URL)=.*$#\1=https://auth.localhost:444/#' \
-e 's#^(FHIR_SERVER_FRONTEND_KEYCLOAK_HTTP_RELATIVE_PATH)=.*$#\1=/#' \
feasibility-triangle/fhir-server/.env
sed -i -r -e 's#8084#18084#g' \
-e 's#^(FLARE_FHIR_OAUTH_ISSUER_URI)=.*$#\1=https://auth.localhost:444/realms/blaze#' \
feasibility-triangle/flare/.env
sed -i -r -e 's#^(FHIR_SERVER_HOSTNAME)=.*$#\1=fhir.localhost#' \
-e 's#^(FLARE_HOSTNAME)=.*$#\1=flare.localhost#' \
-e 's#^(KEYCLOAK_HOSTNAME)=.*$#\1=auth.localhost#' \
-e 's#^(FEASIBILITY_TRIANGLE_REV_PROXY_NGINX_CONFIG)=.*$#\1=./subdomains.nginx.conf#' \
feasibility-triangle/rev-proxy/.env
- name: Generate certificate
env:
CERT_DOMAINS: "fhir.localhost, flare.localhost, auth.localhost"
run: feasibility-triangle/generate-cert.sh
- name: Start Triangle
run: feasibility-triangle/start-triangle.sh
- name: Load Data
run: |
ACCESS_TOKEN="$(feasibility-triangle/get-fhir-server-access-token.sh)"
blazectl --no-progress --server https://fhir.localhost:444/fhir --certificate-authority feasibility-triangle/auth/cert.pem --token "$ACCESS_TOKEN" upload .github/test-data
- name: Run Test Queries
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