Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4d4b72a

Browse files
committedAug 19, 2024·
[CI] Add Trivy vulnerables check
Signed-off-by: v.oleynikov <[email protected]>
1 parent 738ee1c commit 4d4b72a

File tree

5 files changed

+78
-0
lines changed

5 files changed

+78
-0
lines changed
 

‎.github/workflows/trivy_check.yaml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Trivy check for sub repos
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
test:
11+
name: Trivy check for sub repos
12+
runs-on: [self-hosted, regular]
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v2
17+
18+
- name: Prepare sub repo
19+
run: |
20+
git clone --depth 1 --branch v4.7.0 ${{ secrets.SOURCE_REPO }}/kubernetes-csi/csi-driver-nfs.git ./csi-driver-nfs
21+
cp -R ./images/csi-nfs/patches ./csi-driver-nfs
22+
cd ./csi-driver-nfs
23+
for patchfile in ./patches/*.patch ; do echo -n "Apply ${patchfile} ... "; git apply ${patchfile}; done
24+
cd ..
25+
26+
- name: Run Trivy vulnerability scanner in fs mode
27+
uses: aquasecurity/trivy-action@master
28+
with:
29+
scan-type: 'fs'
30+
scan-ref: '.'
31+
trivy-config: trivy.yaml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
Subject: [PATCH] Fix go.mod
2+
---
3+
Index: go.mod
4+
IDEA additional info:
5+
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
6+
<+>UTF-8
7+
===================================================================
8+
diff --git a/go.mod b/go.mod
9+
--- a/go.mod (revision d774c858aa291b744ab83d9cf315dfea1056f1ce)
10+
+++ b/go.mod (revision 6a23511b5c0f26227f0fc78479ce4bd18bcedfd2)
11+
@@ -16,7 +16,7 @@
12+
k8s.io/apimachinery v0.28.9
13+
k8s.io/client-go v0.28.9
14+
k8s.io/klog/v2 v2.120.1
15+
- k8s.io/kubernetes v1.28.9
16+
+ k8s.io/kubernetes v1.28.12
17+
k8s.io/mount-utils v0.29.4
18+
k8s.io/pod-security-admission v0.0.0
19+
k8s.io/utils v0.0.0-20230726121419-3b25d923346b
20+
Index: go.sum
21+
IDEA additional info:
22+
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
23+
<+>UTF-8
24+
===================================================================
25+
diff --git a/go.sum b/go.sum
26+
--- a/go.sum (revision d774c858aa291b744ab83d9cf315dfea1056f1ce)
27+
+++ b/go.sum (revision 6a23511b5c0f26227f0fc78479ce4bd18bcedfd2)
28+
@@ -692,8 +692,8 @@
29+
k8s.io/kubectl v0.28.9/go.mod h1:ip/zTUr1MM/H2M+YbPHnSKLt0x6kb85SJtRSjwEGDfs=
30+
k8s.io/kubelet v0.28.9 h1:76v00fFLeniz27kXhGGUIxONdwa9LKcD2Jd5cXYAZko=
31+
k8s.io/kubelet v0.28.9/go.mod h1:46P39DFjI+E59nU2OgpatyS3oWy58ClulKO6riZ/97o=
32+
-k8s.io/kubernetes v1.28.9 h1:I4sYGQJOuxEo4/QWoY7M8kDB7O0HcH266t6o6mR6ogg=
33+
-k8s.io/kubernetes v1.28.9/go.mod h1:chlmcCDBnOA/y+572cw8dO0Rci1wiA8bm5+zhPdFLCk=
34+
+k8s.io/kubernetes v1.28.12 h1:DtWB8ZjoYiN/PXD4qDXFppf9IouVUavn6r3S+3NMUkU=
35+
+k8s.io/kubernetes v1.28.12/go.mod h1:chlmcCDBnOA/y+572cw8dO0Rci1wiA8bm5+zhPdFLCk=
36+
k8s.io/mount-utils v0.29.4 h1:tW/URea4gtXlaVW7VObr52NQhS+z3SXTg1GUaFZjRL4=
37+
k8s.io/mount-utils v0.29.4/go.mod h1:SHUMR9n3b6tLgEmlyT36cL6fV6Sjwa5CJhc0guCXvb0=
38+
k8s.io/pod-security-admission v0.28.9 h1:towoNqSp7aU7gF8T89zftCuQUfliyib3ds20Kz/hysg=

‎images/csi-nfs/patches/README.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## Patches
2+
3+
### Fix go.mod
4+
5+
It fixes https://avd.aquasec.com/nvd/2024/cve-2024-5321/
6+
MUST BE removed after switching to v4.9.0

‎images/csi-nfs/werf.inc.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# While changing tag, you MUST change it in .github/workflows/trivy_check.yaml
12
{{- $version := "4.7.0" }}
23

34
{{- $_ := set . "BASE_GOLANG_22_ALPINE" "registry.deckhouse.io/base_images/golang:1.22.3-alpine@sha256:dbf216b880b802c22e3f4f2ef0a78396b4a9a6983cb9b767c5efc351ebf946b0" }}

‎trivy.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
format: table
2+
exit-code: 1

0 commit comments

Comments
 (0)
Please sign in to comment.