Skip to content

Vulnerability Scan #139

Vulnerability Scan

Vulnerability Scan #139

---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Vulnerability Scan
on:
schedule:
- cron: "30 1 * * *"
workflow_dispatch:
permissions:
contents: read
jobs:
apps:
name: Get App Inventory
runs-on: ubuntu-latest
outputs:
apps: ${{ steps.inventory.outputs.apps }}
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false
- name: Get App Inventory
uses: ./.github/actions/app-inventory
id: inventory
grype:
name: Setup Grype
runs-on: ubuntu-latest
steps:
- name: Create Cache Key
id: cache
run: echo "key=$(date -u +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- name: Restore Database
id: database-restore
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
key: grype-db-${{ steps.cache.outputs.key }}
path: ~/.cache/grype/db
- if: ${{ always() && steps.database-restore.outputs.cache-hit != 'true' }}
name: Install Grype
uses: anchore/scan-action/download-grype@1638637db639e0ade3258b51db49a9a137574c3e # v6.5.1
id: grype
- if: ${{ always() && steps.database-restore.outputs.cache-hit != 'true' }}
name: Update Database
run: |
${{ steps.grype.outputs.cmd }} db update
- if: ${{ always() && steps.database-restore.outputs.cache-hit != 'true' }}
name: Cache Database
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
key: grype-db-${{ steps.cache.outputs.key }}
path: ~/.cache/grype/db
vulnerability-scan:
name: Vulnerability Scan (${{ matrix.app }})
needs: ["apps", "grype"]
runs-on: ubuntu-latest
strategy:
matrix:
app: ${{ fromJSON(needs.apps.outputs.apps) }}
max-parallel: 4
fail-fast: false
permissions:
security-events: write
contents: read
steps:
- name: Retreive Cache Key
id: cache
run: echo "key=$(date -u +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- name: Restore Database
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
key: grype-db-${{ steps.cache.outputs.key }}
path: ~/.cache/grype/db
- name: Scan
uses: anchore/scan-action@1638637db639e0ade3258b51db49a9a137574c3e # v6.5.1
id: scan
with:
fail-build: false
image: ghcr.io/${{ github.repository_owner }}/${{ matrix.app }}:rolling
severity-cutoff: high
- name: Upload Report
uses: github/codeql-action/upload-sarif@45c373516f557556c15d420e3f5e0aa3d64366bc # v3.31.9
with:
category: container:${{ matrix.app }}
sarif_file: ${{ steps.scan.outputs.sarif }}