Skip to content

Commit

Permalink
Merge pull request #18 from ba-st/add_vulnerability_scanner
Browse files Browse the repository at this point in the history
Add vulnerability scanning
  • Loading branch information
gcotelli authored Apr 18, 2024
2 parents e52e6e7 + 54de1d6 commit c95e18c
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:
jobs:
build_and_publish:
name: Build and Publish Docker images
permissions:
contents: read
security-events: write
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -108,3 +111,21 @@ jobs:
tags: ${{ steps.docker_meta_runtime_gem.outputs.tags }}
labels: ${{ steps.docker_meta_runtime_gem.outputs.labels }}
secrets: GIT_AUTH_TOKEN=${{ secrets.DOCKER_REGISTRY_TOKEN }}

# Scan for vulnerabilities
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
if: ${{ github.event_name != 'pull_request' }}
with:
image-ref: ghcr.io/${{ github.repository_owner }}/gs64:${{ github.ref_name }}
format: 'sarif'
output: 'trivy-results.sarif'
severity: 'CRITICAL,HIGH'
limit-severities-for-sarif: true
ignore-unfixed: true

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
if: ${{ github.event_name != 'pull_request' }}
with:
sarif_file: 'trivy-results.sarif'
27 changes: 27 additions & 0 deletions .github/workflows/scheduled-security-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Scheduled vulnerability scanning
on:
schedule:
- cron: '35 6 * * 2'
workflow_dispatch:
jobs:
vulnerability-scan:
permissions:
contents: read
security-events: write
name: Scheduled scan for vulnerabilities
runs-on: ubuntu-latest
steps:
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: ghcr.io/${{ github.repository_owner }}/gs64:latest
format: 'sarif'
output: 'trivy-results.sarif'
severity: 'CRITICAL,HIGH'
limit-severities-for-sarif: true
ignore-unfixed: true

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'trivy-results.sarif'
1 change: 1 addition & 0 deletions source/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ ENV GS_UID=1001
ENV GS_GID=100

RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install --assume-yes --no-install-recommends \
ca-certificates \
gosu \
Expand Down

0 comments on commit c95e18c

Please sign in to comment.