Skip to content

DockerVulnerabilities #48

DockerVulnerabilities

DockerVulnerabilities #48

name: DockerVulnerabilities
on:
push:
branches:
- main
schedule:
# At the end of every day
- cron: "0 0 * * *"
jobs:
docker-analysis:
name: Trivy analysis for Docker image
runs-on: ubuntu-latest
steps:
- uses: step-security/harden-runner@v2
with:
disable-sudo: false
egress-policy: audit
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
id: buildx
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-v1.0-validator-node-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-v1.0-validator-node-
- name: Build and load
run: |
docker buildx bake \
--set "*.cache-from=type=local,src=/tmp/.buildx-cache" \
--set "*.cache-to=type=local,dest=/tmp/.buildx-cache-new" \
--set "*.platform=linux/amd64" \
--builder ${{ steps.buildx.outputs.name }} \
-f docker-compose.yml \
--load \
app worker
env:
DOCKER_TAG: analysis-latest
- name: Scan vulnerabilities validator app image
uses: aquasecurity/[email protected]
with:
image-ref: 'pantosio/validator-node-app:analysis-latest'
format: 'sarif'
output: 'trivy-validator-app-results.sarif'
severity: 'CRITICAL,HIGH'
- name: Upload Trivy scan results for app to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
if: always()
with:
category: 'validator-app'
sarif_file: 'trivy-validator-app-results.sarif'
- name: Scan vulnerabilities validator worker image
uses: aquasecurity/[email protected]
with:
image-ref: 'pantosio/validator-node-worker:analysis-latest'
format: 'sarif'
output: 'trivy-validator-worker-results.sarif'
severity: 'CRITICAL,HIGH'
- name: Upload Trivy scan results for app to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
if: always()
with:
category: 'validator-worker'
sarif_file: 'trivy-validator-worker-results.sarif'
- name: Move cache
if: always()
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache