Skip to content

Commit cca968e

Browse files
authored
Merge pull request #379 from accuknox/main
Merge Main into V0.9
2 parents 231b5b6 + d2235c3 commit cca968e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

cmd/imagescan.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package cmd
22

33
import (
44
"fmt"
5+
"os"
56
"strings"
67

78
"github.com/accuknox/accuknox-cli-v2/pkg/imagescan"
@@ -13,6 +14,8 @@ var (
1314
HOST_NAME string
1415
RUN_TIME string
1516
artifactEndpointPath string
17+
vulnerabilityDB string
18+
javaDB string
1619
allContainers bool
1720
imagesOnly bool
1821
cfg = kubesheildScanner.ScanConfig{}
@@ -51,6 +54,12 @@ and sends back the result to saas
5154
artifactEndpointPath = "/" + artifactEndpointPath
5255
}
5356

57+
// trivy can make use of this variable to download the trivyDB from the
58+
// specified source. If it is empty, trivy will download from one of its public
59+
// registries.
60+
_ = os.Setenv("TRIVY_DB_REPOSITORY", vulnerabilityDB)
61+
_ = os.Setenv("TRIVY_JAVA_DB_REPOSITORY", javaDB)
62+
5463
cfg.ArtifactConfig.ArtifactAPI += artifactEndpointPath
5564
return imagescan.DiscoverAndScan(cfg, HOST_NAME, RUN_TIME, !allContainers, imagesOnly)
5665
},
@@ -72,6 +81,10 @@ func init() {
7281
imageScanCmd.Flags().BoolVar(&allContainers, "all-containers", false, "If set, discover containers in all states. By default, only running containers are discovered.")
7382
imageScanCmd.Flags().BoolVar(&imagesOnly, "images-only", false, "If set, discovers and scans all images. By default, only images from running containers are scanned.")
7483

84+
// Trivy Configurations
85+
imageScanCmd.Flags().StringVarP(&vulnerabilityDB, "db-repository", "", "", "OCI repository to retrieve vulnerability db")
86+
imageScanCmd.Flags().StringVarP(&javaDB, "java-db-repository", "", "", "OCI repository to retrieve java db")
87+
7588
// Required Flags Validation
7689
imageScanCmd.MarkFlagsOneRequired("artifactEndpoint", "token", "label")
7790
imageScanCmd.MarkFlagsRequiredTogether("artifactEndpoint", "token", "label")

0 commit comments

Comments
 (0)