Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add research-vuln-scan workflow #23

Open
wants to merge 35 commits into
base: main
Choose a base branch
from
Open
Changes from 23 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
ad29083
Add research-vuln-scan workflow
robert-schardt Oct 24, 2024
a5ce9af
Update research-vuln-scan.yml
robert-schardt Oct 24, 2024
d9e95ce
Update research-vuln-scan.yml
robert-schardt Oct 24, 2024
8fa555f
Update research-vuln-scan.yml
robert-schardt Oct 24, 2024
e4e74e0
Update research-vuln-scan.yml
robert-schardt Oct 24, 2024
0db1823
Update research-vuln-scan.yml
robert-schardt Oct 24, 2024
f65e2d8
Update research-vuln-scan.yml
robert-schardt Oct 24, 2024
8a2e14f
Update research-vuln-scan.yml
robert-schardt Nov 1, 2024
358b744
Update research-vuln-scan.yml
robert-schardt Nov 4, 2024
43e8a98
Update research-vuln-scan.yml
robert-schardt Nov 5, 2024
add9a0d
Update research-vuln-scan.yml
robert-schardt Nov 5, 2024
fd29f39
Update research-vuln-scan.yml
robert-schardt Nov 5, 2024
29f23c1
Update research-vuln-scan.yml
robert-schardt Nov 5, 2024
6778f49
Update research-vuln-scan.yml
robert-schardt Nov 5, 2024
671326f
Update research-vuln-scan.yml
robert-schardt Nov 5, 2024
5faebef
Update research-vuln-scan.yml
robert-schardt Nov 5, 2024
7dd49e3
Update research-vuln-scan.yml
robert-schardt Nov 5, 2024
460ddd3
Update research-vuln-scan.yml
robert-schardt Nov 5, 2024
ceda75b
Run docker-scout only for testing
robert-schardt Nov 5, 2024
785e461
Enable other jobs again and docker-scout ignores unspecified
robert-schardt Nov 5, 2024
4cb94ac
Remove low from docker-scout
robert-schardt Nov 5, 2024
8d160a6
Set trivy and grype to medium too
robert-schardt Nov 5, 2024
6348fca
Merge branch 'main' into DEVOPS-1249_rschardt
robert-schardt Nov 19, 2024
487c4e4
Update .github/workflows/research-vuln-scan.yml
robert-schardt Nov 22, 2024
c821967
Update .github/workflows/research-vuln-scan.yml
robert-schardt Nov 22, 2024
8f44b31
Update .github/workflows/research-vuln-scan.yml
robert-schardt Nov 22, 2024
44c071b
Apply suggestions from code review
robert-schardt Nov 22, 2024
dfb66ea
Change: Switch to harbor, use image built by push.yml and use self ho…
robert-schardt Nov 25, 2024
f622801
Merge branch 'main' into DEVOPS-1249_rschardt
robert-schardt Nov 25, 2024
e0ed4bc
Add: Slash to image
robert-schardt Nov 25, 2024
4700ed2
Update research-vuln-scan.yml
robert-schardt Nov 26, 2024
762c940
Add trivy env variables for private registry and remove recommendatio…
robert-schardt Nov 26, 2024
b5c0ce4
Fix env indent
robert-schardt Nov 26, 2024
66da04a
Remove docker login for trivy
robert-schardt Nov 26, 2024
55f1cc0
Merge branch 'main' into DEVOPS-1249_rschardt
robert-schardt Dec 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 109 additions & 0 deletions .github/workflows/research-vuln-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: trivy & grype & sarif & docker scout vulnerability scan

on:
push:
branches: [ "main" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]

permissions:
contents: read

jobs:
trivy:
permissions:
contents: read # for actions/checkout to fetch code
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
name: Trivy
runs-on: "ubuntu-20.04"
steps:
- name: Checkout code
uses: actions/checkout@v4
robert-schardt marked this conversation as resolved.
Show resolved Hide resolved

- name: Build an image from Dockerfile
run: |
docker build -t greenbone/opensight-postgres:${{ github.sha }} .

- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@7b7aa264d83dc58691451798b4d117d53d21edfe
with:
image-ref: 'greenbone/opensight-postgres:${{ github.sha }}'
format: 'template'
template: '@/contrib/sarif.tpl'
output: 'trivy-results.sarif'
severity: 'MEDIUM,HIGH,CRITICAL'
github-pat: ${{ secrets.GITHUB_TOKEN }} # or ${{ secrets.github_pat_name }} if you're using a PAT

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
robert-schardt marked this conversation as resolved.
Show resolved Hide resolved
with:
sarif_file: 'trivy-results.sarif'
category: ${{ github.jobs[github.job].name }}

grype:
permissions:
contents: read # for actions/checkout to fetch code
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
name: Grype
runs-on: "ubuntu-20.04"
steps:
- name: Checkout code
uses: actions/checkout@v4
robert-schardt marked this conversation as resolved.
Show resolved Hide resolved

- name: Build an image from Dockerfile
run: |
docker build -t greenbone/opensight-postgres:${{ github.sha }} .

- name: Run the Anchore Grype scan action
uses: anchore/scan-action@d5aa5b6cb9414b0c7771438046ff5bcfa2854ed7
id: grype
with:
image: "greenbone/opensight-postgres:${{ github.sha }}"
fail-build: false
severity-cutoff: medium

- name: Upload grype vulnerability report
uses: github/codeql-action/upload-sarif@v3
robert-schardt marked this conversation as resolved.
Show resolved Hide resolved
with:
sarif_file: ${{ steps.grype.outputs.sarif }}
category: ${{ github.jobs[github.job].name }}

docker-scout:
permissions:
contents: read # for actions/checkout to fetch code
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
pull-requests: write
name: "Docker Scout"
runs-on: "ubuntu-20.04"
steps:
- name: Checkout code
uses: actions/checkout@v4
robert-schardt marked this conversation as resolved.
Show resolved Hide resolved

- name: Build an image from Dockerfile
run: |
docker build -t greenbone/opensight-postgres:${{ github.sha }} .

- name: Analyze for critical and high CVEs
id: docker-scout-cves
if: ${{ github.event_name != 'pull_request_target' }}
uses: docker/scout-action@v1
with:
command: cves, recommendations, compare
image: "greenbone/opensight-postgres:${{ github.sha }}"
sarif-file: sarif.output.json
summary: true
dockerhub-user: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub-password: ${{ secrets.DOCKERHUB_TOKEN }}
only-severities: critical, high, medium

- name: Upload docker scout SARIF result
id: upload-sarif
if: ${{ github.event_name != 'pull_request_target' }}
uses: github/codeql-action/upload-sarif@v3
robert-schardt marked this conversation as resolved.
Show resolved Hide resolved
with:
sarif_file: sarif.output.json
category: ${{ github.jobs[github.job].name }}
Loading