Skip to content

Commit 943e678

Browse files
meysholdtona-agent
andcommitted
Add security scanners: Trivy, OSV-Scanner, Maven dependency submission
- Trivy filesystem scan for dependency CVEs - OSV-Scanner v2 for push/schedule and PR diff scanning - Maven dependency submission to resolve BOM-inherited versions - Devcontainer Dockerfile for image builds Co-authored-by: Ona <no-reply@ona.com>
1 parent 5132ae3 commit 943e678

4 files changed

Lines changed: 116 additions & 0 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM mcr.microsoft.com/devcontainers/base:ubuntu-24.04
2+
3+
# use this Dockerfile to install additional tools you might need, e.g.
4+
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
5+
# && apt-get -y install --no-install-recommends <your-package-list-here>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Maven Dependency Submission
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
paths:
7+
- 'pom.xml'
8+
- '.mvn/**'
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
submit:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Set up JDK 17
21+
uses: actions/setup-java@v4
22+
with:
23+
java-version: '17'
24+
distribution: 'adopt'
25+
26+
- name: Submit dependency graph
27+
uses: advanced-security/maven-dependency-submission-action@v4

.github/workflows/osv-scanner.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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+
6+
# A sample workflow which sets up periodic OSV-Scanner scanning for vulnerabilities,
7+
# in addition to a PR check which fails if new vulnerabilities are introduced.
8+
#
9+
# For more examples and options, including how to ignore specific vulnerabilities,
10+
# see https://google.github.io/osv-scanner/github-action/
11+
12+
name: OSV-Scanner
13+
14+
on:
15+
pull_request:
16+
branches: [ "main" ]
17+
merge_group:
18+
branches: [ "main" ]
19+
schedule:
20+
- cron: '39 0 * * 4'
21+
push:
22+
branches: [ "main" ]
23+
24+
permissions:
25+
security-events: write
26+
contents: read
27+
actions: read
28+
29+
jobs:
30+
scan-scheduled:
31+
if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }}
32+
uses: "google/osv-scanner-action/.github/workflows/osv-scanner-reusable.yml@98b584ee2ed2da3935ccce10e06739d54cdcd20b" # v2.0.0
33+
with:
34+
fail-on-vuln: false
35+
scan-args: |-
36+
-r
37+
./
38+
scan-pr:
39+
if: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }}
40+
uses: "google/osv-scanner-action/.github/workflows/osv-scanner-reusable-pr.yml@98b584ee2ed2da3935ccce10e06739d54cdcd20b" # v2.0.0
41+
with:
42+
scan-args: |-
43+
-r
44+
./

.github/workflows/trivy.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: trivy
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
schedule:
9+
- cron: '29 6 * * 2'
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
fs-scan:
16+
permissions:
17+
contents: read
18+
security-events: write
19+
actions: read
20+
name: Filesystem Scan
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
26+
- name: Run Trivy filesystem scanner
27+
uses: aquasecurity/trivy-action@0.35.0
28+
with:
29+
scan-type: 'fs'
30+
scan-ref: '.'
31+
format: 'sarif'
32+
output: 'trivy-fs-results.sarif'
33+
severity: 'CRITICAL,HIGH'
34+
35+
- name: Upload filesystem scan results to GitHub Security tab
36+
uses: github/codeql-action/upload-sarif@v3
37+
if: always()
38+
with:
39+
sarif_file: 'trivy-fs-results.sarif'
40+
category: 'trivy-fs'

0 commit comments

Comments
 (0)