Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
jesus-linares committed Jul 9, 2024
1 parent c26762b commit f628c6d
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 5 deletions.
66 changes: 61 additions & 5 deletions .github/workflows/trivy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,72 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Build Docker Image 1 (Vulnerable - Ubuntu)
run: |
docker build -t vulnerable-image-ubuntu -f Dockerfile1 .
- name: Run Trivy vulnerability scanner in fs mode
- name: Build Docker Image 3 (Non-vulnerable)
run: |
docker build -t non-vulnerable-image -f Dockerfile3 .
- name: "Run Trivy vulnerability scanner: image"
uses: aquasecurity/[email protected]
with:
image-ref: 'vulnerable-image-ubuntu'
scan-type: 'image'
vuln-type: 'os'
format: 'sarif'
output: 'trivy-results-image1.sarif'

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'trivy-results-image1.sarif'
category: 'image'

- name: "Run Trivy vulnerability scanner: image"
uses: aquasecurity/[email protected]
with:
image-ref: 'non-vulnerable-image'
scan-type: 'image'
vuln-type: 'os'
format: 'sarif'
output: 'trivy-results-image2.sarif'

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'trivy-results-image2.sarif'
category: 'image'

- name: "Run Trivy vulnerability scanner: image"
uses: aquasecurity/[email protected]
with:
image-ref: 'vulnerable-image-ubuntu'
scan-type: 'image'
scanners: 'vuln,secret'
vuln-type: 'os'
format: 'sarif'
output: 'trivy-results-image1.sarif'

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'trivy-results-image1.sarif'
category: 'image'

- name: "Run Trivy vulnerability scanner: image"
uses: aquasecurity/[email protected]
with:
scan-type: 'fs'
scan-ref: '.'
image-ref: 'non-vulnerable-image'
scan-type: 'image'
scanners: 'vuln,secret'
vuln-type: 'os'
format: 'sarif'
output: 'trivy-results.sarif'
output: 'trivy-results-image2.sarif'

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'trivy-results.sarif'
sarif_file: 'trivy-results-image2.sarif'
category: 'image'
13 changes: 13 additions & 0 deletions Dockerfile1
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Dockerfile 1 (Vulnerable)
FROM ubuntu:18.04

RUN apt-get update && \
apt-get install -y \
openssl \
curl

# Deliberately using an old version of OpenSSL with known vulnerabilities
RUN apt-get install -y openssl=1.1.0g-2ubuntu4.3

# Adding a fake AWS secret key
RUN echo "AWS_SECRET_ACCESS_KEY=AKIAIOSFODNN7EXAMPLE" > /root/.aws/credentials
10 changes: 10 additions & 0 deletions Dockerfile3
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Dockerfile 3 (Non-vulnerable)
FROM ubuntu:20.04

RUN apt-get update && \
apt-get install -y \
openssl \
curl

# Using the latest versions with no known vulnerabilities
RUN apt-get install -y openssl

0 comments on commit f628c6d

Please sign in to comment.