Skip to content

Commit c95e18c

Browse files
authored
Merge pull request #18 from ba-st/add_vulnerability_scanner
Add vulnerability scanning
2 parents e52e6e7 + 54de1d6 commit c95e18c

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed

.github/workflows/docker-build.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ on:
1212
jobs:
1313
build_and_publish:
1414
name: Build and Publish Docker images
15+
permissions:
16+
contents: read
17+
security-events: write
1518
runs-on: ubuntu-latest
1619
strategy:
1720
matrix:
@@ -108,3 +111,21 @@ jobs:
108111
tags: ${{ steps.docker_meta_runtime_gem.outputs.tags }}
109112
labels: ${{ steps.docker_meta_runtime_gem.outputs.labels }}
110113
secrets: GIT_AUTH_TOKEN=${{ secrets.DOCKER_REGISTRY_TOKEN }}
114+
115+
# Scan for vulnerabilities
116+
- name: Run Trivy vulnerability scanner
117+
uses: aquasecurity/trivy-action@master
118+
if: ${{ github.event_name != 'pull_request' }}
119+
with:
120+
image-ref: ghcr.io/${{ github.repository_owner }}/gs64:${{ github.ref_name }}
121+
format: 'sarif'
122+
output: 'trivy-results.sarif'
123+
severity: 'CRITICAL,HIGH'
124+
limit-severities-for-sarif: true
125+
ignore-unfixed: true
126+
127+
- name: Upload Trivy scan results to GitHub Security tab
128+
uses: github/codeql-action/upload-sarif@v3
129+
if: ${{ github.event_name != 'pull_request' }}
130+
with:
131+
sarif_file: 'trivy-results.sarif'
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Scheduled vulnerability scanning
2+
on:
3+
schedule:
4+
- cron: '35 6 * * 2'
5+
workflow_dispatch:
6+
jobs:
7+
vulnerability-scan:
8+
permissions:
9+
contents: read
10+
security-events: write
11+
name: Scheduled scan for vulnerabilities
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Run Trivy vulnerability scanner
15+
uses: aquasecurity/trivy-action@master
16+
with:
17+
image-ref: ghcr.io/${{ github.repository_owner }}/gs64:latest
18+
format: 'sarif'
19+
output: 'trivy-results.sarif'
20+
severity: 'CRITICAL,HIGH'
21+
limit-severities-for-sarif: true
22+
ignore-unfixed: true
23+
24+
- name: Upload Trivy scan results to GitHub Security tab
25+
uses: github/codeql-action/upload-sarif@v3
26+
with:
27+
sarif_file: 'trivy-results.sarif'

source/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ ENV GS_UID=1001
1515
ENV GS_GID=100
1616

1717
RUN apt-get update \
18+
&& apt-get upgrade -y \
1819
&& apt-get install --assume-yes --no-install-recommends \
1920
ca-certificates \
2021
gosu \

0 commit comments

Comments
 (0)