Skip to content

Commit 02b85b8

Browse files
authored
Dpstat 1397 trivy update (#168)
* DPSTAT-1397 trivy build set up * DPSTAT-1397 trivy build set up for build test yml * DPSTAT-1397 adding fail build on high and critical * DPSTAT-1397 adding fail build on high and critical * DPSTAT-1397 updating build test yaml file for trivy * DPSTAT-1397 updating pom file for vulnerability
1 parent 5bb9d0c commit 02b85b8

File tree

3 files changed

+68
-7
lines changed

3 files changed

+68
-7
lines changed

.github/workflows/build-deploy-app.yml

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ on:
99
- "Makefile"
1010
- ".mvn"
1111
- ".gitignore"
12-
1312
jobs:
1413
build-push:
1514
name: Build and push to registries
@@ -20,6 +19,7 @@ jobs:
2019
permissions:
2120
contents: read
2221
id-token: write
22+
security-events: write
2323

2424
outputs:
2525
nais-tag: ${{steps.nais-deploy-vars.outputs.nais_tag}}
@@ -29,6 +29,32 @@ jobs:
2929
steps:
3030
- uses: actions/checkout@v4
3131

32+
- name: Fail build on High/Critical Vulnerabilities
33+
uses: aquasecurity/trivy-action@master
34+
with:
35+
scan-type: 'fs'
36+
format: 'table'
37+
scan-ref: '.'
38+
severity: 'HIGH,CRITICAL'
39+
ignore-unfixed: true
40+
exit-code: 1
41+
42+
- name: Run Trivy vulnerability scanner
43+
uses: aquasecurity/trivy-action@master
44+
with:
45+
scan-type: 'fs'
46+
ignore-unfixed: true
47+
scan-ref: '.'
48+
format: 'sarif'
49+
output: 'trivy-results.sarif'
50+
severity: 'CRITICAL,HIGH'
51+
skip-setup-trivy: true
52+
53+
- name: Upload Trivy results to GitHub Security tab
54+
uses: github/codeql-action/upload-sarif@v3
55+
with:
56+
sarif_file: 'trivy-results.sarif'
57+
3258
- name: Set up JDK 21
3359
uses: actions/setup-java@v4
3460
with:
@@ -104,7 +130,10 @@ jobs:
104130
echo "cluster=test" >> "$GITHUB_OUTPUT"
105131
echo "nais_config_path=.nais/test/nais.yaml" >> "$GITHUB_OUTPUT"
106132
fi
107-
133+
134+
135+
136+
108137
deploy:
109138
name: Deploy to NAIS
110139
needs: build-push

.github/workflows/build-test.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,51 @@ env:
1414
jobs:
1515
build-test:
1616
name: Build and test with Maven
17+
1718
if: ${{github.event_name == 'pull_request'}}
1819
runs-on: ubuntu-latest
1920
permissions:
2021
contents: read
2122
id-token: write
23+
security-events: write
2224

2325
steps:
2426
- uses: actions/checkout@v4
2527

28+
- name: Fail build on High/Critical Vulnerabilities
29+
uses: aquasecurity/trivy-action@master
30+
with:
31+
scan-type: 'fs'
32+
format: 'table'
33+
scan-ref: '.'
34+
severity: 'HIGH,CRITICAL'
35+
ignore-unfixed: true
36+
exit-code: 1
37+
38+
- name: Run Trivy vulnerability scanner
39+
uses: aquasecurity/trivy-action@master
40+
with:
41+
scan-type: 'fs'
42+
ignore-unfixed: true
43+
scan-ref: '.'
44+
format: 'sarif'
45+
output: 'trivy-results.sarif'
46+
severity: 'CRITICAL,HIGH'
47+
skip-setup-trivy: true
48+
49+
- name: Upload Trivy results to GitHub Security tab
50+
uses: github/codeql-action/upload-sarif@v3
51+
with:
52+
sarif_file: 'trivy-results.sarif'
53+
2654
- name: Set up JDK 21
2755
uses: actions/setup-java@v4
2856
with:
2957
java-version: 21
3058
distribution: temurin
3159
cache: maven
3260

61+
3362
- name: Setup Maven authentication to GitHub packages
3463
uses: s4u/maven-settings-action@v3.1.0
3564
id: maven_settings

pom.xml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
<dapla-dlp-pseudo-core.version>2.0.8</dapla-dlp-pseudo-core.version>
2828
<micronaut.version>4.10.7</micronaut.version>
2929
<micronaut.openapi.version>6.19.1</micronaut.openapi.version>
30+
<micronaut-gcp-version>5.13.0</micronaut-gcp-version>
31+
<grpc-netty-shaded-version>1.75.0</grpc-netty-shaded-version>
3032
<micronaut.validation.version>4.12.0</micronaut.validation.version>
3133
<auto-service.version>1.1.1</auto-service.version>
3234
<maven-javadoc-plugin.version>3.11.2</maven-javadoc-plugin.version>
@@ -137,19 +139,20 @@
137139
<dependency>
138140
<groupId>io.micronaut.gcp</groupId>
139141
<artifactId>micronaut-gcp-common</artifactId>
140-
<version>5.13.0</version>
142+
<version>${micronaut-gcp-version}</version>
141143
<scope>compile</scope>
142144
</dependency>
143145
<dependency>
144146
<groupId>io.micronaut.gcp</groupId>
145147
<artifactId>micronaut-gcp-secret-manager</artifactId>
146-
<version>5.13.0</version>
148+
<version>${micronaut-gcp-version}</version>
147149
</dependency>
148150
<dependency>
149-
<groupId>com.google.cloud</groupId>
150-
<artifactId>google-cloud-secretmanager</artifactId>
151-
<version>2.63.0</version>
151+
<groupId>io.grpc</groupId>
152+
<artifactId>grpc-netty-shaded</artifactId>
153+
<version>${grpc-netty-shaded-version}</version>
152154
</dependency>
155+
153156
<dependency>
154157
<groupId>com.google.cloud</groupId>
155158
<artifactId>google-cloud-core</artifactId>

0 commit comments

Comments
 (0)