Skip to content

Anchore Grype vulnerability scan #45

Anchore Grype vulnerability scan

Anchore Grype vulnerability scan #45

Workflow file for this run

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow checks out code, builds an image, performs a container image
# vulnerability scan with Anchore's Grype tool, and integrates the results with GitHub Advanced Security
# code scanning feature. For more information on the Anchore scan action usage
# and parameters, see https://github.com/anchore/scan-action. For more
# information on Anchore's container image scanning tool Grype, see
# https://github.com/anchore/grype
name: Anchore Grype vulnerability scan
on:
schedule:
- cron: '39 23 * * 1'
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
permissions:
contents: read
jobs:
Anchore-Build-Scan:
permissions:
contents: read # for actions/checkout to fetch code
packages: read # read registries used by Dockerfile
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
runs-on: ubuntu-latest
steps:
# https://github.com/actions/checkout
- name: Check out the code
uses: actions/checkout@v4
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
# if: github.event_name != 'pull_request'
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# https://github.com/docker/bake-action
- name: build local container
uses: docker/bake-action@v5
with:
push: false
load: true
targets: drupal
set: |
*.tags=ghcr.io/cwrc/drupal:local
# https://github.com/anchore/scan-action
- name: Scan image
uses: anchore/scan-action@v3
with:
image: "ghcr.io/cwrc/drupal:local"
fail-build: false
# severity-cutoff: critical
# https://github.com/github/codeql-action
- name: Upload vulnerability report
uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: ${{ steps.scan.outputs.sarif }}