Skip to content

Commit 4dbe9f3

Browse files
meysholdtona-agent
andcommitted
Add dependabot config, fix Trivy and OSV-Scanner workflows
- Add dependabot.yml for maven, github-actions, and docker ecosystems - Fix Trivy: build from .devcontainer/Dockerfile, add filesystem scan job - Fix OSV-Scanner: set fail-on-vuln=false so findings don't fail the run Co-authored-by: Ona <no-reply@ona.com>
1 parent 4ea8800 commit 4dbe9f3

3 files changed

Lines changed: 60 additions & 22 deletions

File tree

.github/dependabot.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "maven"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
8+
- package-ecosystem: "github-actions"
9+
directory: "/"
10+
schedule:
11+
interval: "weekly"
12+
13+
- package-ecosystem: "docker"
14+
directory: "/.devcontainer"
15+
schedule:
16+
interval: "weekly"

.github/workflows/osv-scanner.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }}
3333
uses: "google/osv-scanner-action/.github/workflows/osv-scanner-reusable.yml@1f1242919d8a60496dd1874b24b62b2370ed4c78" # v1.7.1
3434
with:
35-
# Example of specifying custom arguments
35+
fail-on-vuln: false
3636
scan-args: |-
3737
-r
3838
--skip-git

.github/workflows/trivy.yml

Lines changed: 43 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
1-
# This workflow uses actions that are not certified by GitHub.
2-
# They are provided by a third-party and are governed by
3-
# separate terms of service, privacy policy, and support
4-
# documentation.
5-
61
name: trivy
72

83
on:
94
push:
105
branches: [ "main" ]
116
pull_request:
12-
# The branches below must be a subset of the branches above
137
branches: [ "main" ]
148
schedule:
159
- cron: '29 6 * * 2'
@@ -18,31 +12,59 @@ permissions:
1812
contents: read
1913

2014
jobs:
21-
build:
15+
image-scan:
2216
permissions:
23-
contents: read # for actions/checkout to fetch code
24-
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
25-
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
26-
name: Build
17+
contents: read
18+
security-events: write
19+
actions: read
20+
name: Image Scan
2721
runs-on: ubuntu-latest
2822
steps:
2923
- name: Checkout code
3024
uses: actions/checkout@v4
3125

32-
- name: Build an image from Dockerfile
26+
- name: Build image from .devcontainer/Dockerfile
3327
run: |
34-
docker build -t docker.io/my-organization/my-app:${{ github.sha }} .
28+
docker build -t ghcr.io/ona-samples/github-security:${{ github.sha }} -f .devcontainer/Dockerfile .
29+
30+
- name: Run Trivy image scanner
31+
uses: aquasecurity/trivy-action@0.28.0
32+
with:
33+
image-ref: 'ghcr.io/ona-samples/github-security:${{ github.sha }}'
34+
format: 'sarif'
35+
output: 'trivy-image-results.sarif'
36+
severity: 'CRITICAL,HIGH'
37+
38+
- name: Upload image scan results to GitHub Security tab
39+
uses: github/codeql-action/upload-sarif@v3
40+
if: always()
41+
with:
42+
sarif_file: 'trivy-image-results.sarif'
43+
category: 'trivy-image'
44+
45+
fs-scan:
46+
permissions:
47+
contents: read
48+
security-events: write
49+
actions: read
50+
name: Filesystem Scan
51+
runs-on: ubuntu-latest
52+
steps:
53+
- name: Checkout code
54+
uses: actions/checkout@v4
3555

36-
- name: Run Trivy vulnerability scanner
37-
uses: aquasecurity/trivy-action@7b7aa264d83dc58691451798b4d117d53d21edfe
56+
- name: Run Trivy filesystem scanner
57+
uses: aquasecurity/trivy-action@0.28.0
3858
with:
39-
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
40-
format: 'template'
41-
template: '@/contrib/sarif.tpl'
42-
output: 'trivy-results.sarif'
59+
scan-type: 'fs'
60+
scan-ref: '.'
61+
format: 'sarif'
62+
output: 'trivy-fs-results.sarif'
4363
severity: 'CRITICAL,HIGH'
4464

45-
- name: Upload Trivy scan results to GitHub Security tab
65+
- name: Upload filesystem scan results to GitHub Security tab
4666
uses: github/codeql-action/upload-sarif@v3
67+
if: always()
4768
with:
48-
sarif_file: 'trivy-results.sarif'
69+
sarif_file: 'trivy-fs-results.sarif'
70+
category: 'trivy-fs'

0 commit comments

Comments
 (0)