Skip to content

Commit 56dbe1f

Browse files
authored
fix: include packages unless it is not needed (#6765)
Signed-off-by: knqyf263 <[email protected]>
1 parent 5ccfd17 commit 56dbe1f

32 files changed

+1880
-612
lines changed

docs/docs/references/configuration/cli/trivy_aws.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ trivy aws [flags]
8989
--ignorefile string specify .trivyignore file (default ".trivyignore")
9090
--include-deprecated-checks include deprecated checks
9191
--include-non-failures include successes and exceptions, available with '--scanners misconfig'
92-
--list-all-pkgs enabling the option will output all packages regardless of vulnerability
92+
--list-all-pkgs output all packages in the JSON report regardless of vulnerability
9393
--max-cache-age duration The maximum age of the cloud cache. Cached data will be required from the cloud provider if it is older than this. (default 24h0m0s)
9494
--misconfig-scanners strings comma-separated list of misconfig scanners to use for misconfiguration scanning (default [azure-arm,cloudformation,dockerfile,helm,kubernetes,terraform,terraformplan-json,terraformplan-snapshot])
9595
-o, --output string output file name

docs/docs/references/configuration/cli/trivy_convert.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ trivy convert [flags] RESULT_JSON
2626
-h, --help help for convert
2727
--ignore-policy string specify the Rego file path to evaluate each vulnerability
2828
--ignorefile string specify .trivyignore file (default ".trivyignore")
29-
--list-all-pkgs enabling the option will output all packages regardless of vulnerability
29+
--list-all-pkgs output all packages in the JSON report regardless of vulnerability
3030
-o, --output string output file name
3131
--output-plugin-arg string [EXPERIMENTAL] output plugin arguments
3232
--report string specify a report format for the output (all,summary) (default "all")

docs/docs/references/configuration/cli/trivy_filesystem.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ trivy filesystem [flags] PATH
5555
--java-db-repository string OCI repository to retrieve trivy-java-db from (default "ghcr.io/aquasecurity/trivy-java-db:1")
5656
--license-confidence-level float specify license classifier's confidence level (default 0.9)
5757
--license-full eagerly look for licenses in source code headers and license files
58-
--list-all-pkgs enabling the option will output all packages regardless of vulnerability
58+
--list-all-pkgs output all packages in the JSON report regardless of vulnerability
5959
--misconfig-scanners strings comma-separated list of misconfig scanners to use for misconfiguration scanning (default [azure-arm,cloudformation,dockerfile,helm,kubernetes,terraform,terraformplan-json,terraformplan-snapshot])
6060
--module-dir string specify directory to the wasm modules that will be loaded (default "$HOME/.trivy/modules")
6161
--no-progress suppress progress bar

docs/docs/references/configuration/cli/trivy_image.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ trivy image [flags] IMAGE_NAME
7373
--java-db-repository string OCI repository to retrieve trivy-java-db from (default "ghcr.io/aquasecurity/trivy-java-db:1")
7474
--license-confidence-level float specify license classifier's confidence level (default 0.9)
7575
--license-full eagerly look for licenses in source code headers and license files
76-
--list-all-pkgs enabling the option will output all packages regardless of vulnerability
76+
--list-all-pkgs output all packages in the JSON report regardless of vulnerability
7777
--misconfig-scanners strings comma-separated list of misconfig scanners to use for misconfiguration scanning (default [azure-arm,cloudformation,dockerfile,helm,kubernetes,terraform,terraformplan-json,terraformplan-snapshot])
7878
--module-dir string specify directory to the wasm modules that will be loaded (default "$HOME/.trivy/modules")
7979
--no-progress suppress progress bar

docs/docs/references/configuration/cli/trivy_kubernetes.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ trivy kubernetes [flags] [CONTEXT]
6969
--java-db-repository string OCI repository to retrieve trivy-java-db from (default "ghcr.io/aquasecurity/trivy-java-db:1")
7070
--k8s-version string specify k8s version to validate outdated api by it (example: 1.21.0)
7171
--kubeconfig string specify the kubeconfig file path to use
72-
--list-all-pkgs enabling the option will output all packages regardless of vulnerability
72+
--list-all-pkgs output all packages in the JSON report regardless of vulnerability
7373
--misconfig-scanners strings comma-separated list of misconfig scanners to use for misconfiguration scanning (default [azure-arm,cloudformation,dockerfile,helm,kubernetes,terraform,terraformplan-json,terraformplan-snapshot])
7474
--no-progress suppress progress bar
7575
--node-collector-imageref string indicate the image reference for the node-collector scan job (default "ghcr.io/aquasecurity/node-collector:0.2.1")

docs/docs/references/configuration/cli/trivy_repository.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ trivy repository [flags] (REPO_PATH | REPO_URL)
5555
--java-db-repository string OCI repository to retrieve trivy-java-db from (default "ghcr.io/aquasecurity/trivy-java-db:1")
5656
--license-confidence-level float specify license classifier's confidence level (default 0.9)
5757
--license-full eagerly look for licenses in source code headers and license files
58-
--list-all-pkgs enabling the option will output all packages regardless of vulnerability
58+
--list-all-pkgs output all packages in the JSON report regardless of vulnerability
5959
--misconfig-scanners strings comma-separated list of misconfig scanners to use for misconfiguration scanning (default [azure-arm,cloudformation,dockerfile,helm,kubernetes,terraform,terraformplan-json,terraformplan-snapshot])
6060
--module-dir string specify directory to the wasm modules that will be loaded (default "$HOME/.trivy/modules")
6161
--no-progress suppress progress bar

docs/docs/references/configuration/cli/trivy_rootfs.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ trivy rootfs [flags] ROOTDIR
5757
--java-db-repository string OCI repository to retrieve trivy-java-db from (default "ghcr.io/aquasecurity/trivy-java-db:1")
5858
--license-confidence-level float specify license classifier's confidence level (default 0.9)
5959
--license-full eagerly look for licenses in source code headers and license files
60-
--list-all-pkgs enabling the option will output all packages regardless of vulnerability
60+
--list-all-pkgs output all packages in the JSON report regardless of vulnerability
6161
--misconfig-scanners strings comma-separated list of misconfig scanners to use for misconfiguration scanning (default [azure-arm,cloudformation,dockerfile,helm,kubernetes,terraform,terraformplan-json,terraformplan-snapshot])
6262
--module-dir string specify directory to the wasm modules that will be loaded (default "$HOME/.trivy/modules")
6363
--no-progress suppress progress bar

docs/docs/references/configuration/cli/trivy_sbom.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ trivy sbom [flags] SBOM_PATH
3939
--ignored-licenses strings specify a list of license to ignore
4040
--ignorefile string specify .trivyignore file (default ".trivyignore")
4141
--java-db-repository string OCI repository to retrieve trivy-java-db from (default "ghcr.io/aquasecurity/trivy-java-db:1")
42-
--list-all-pkgs enabling the option will output all packages regardless of vulnerability
42+
--list-all-pkgs output all packages in the JSON report regardless of vulnerability
4343
--no-progress suppress progress bar
4444
--offline-scan do not issue API requests to identify dependencies
4545
-o, --output string output file name

docs/docs/references/configuration/cli/trivy_vm.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ trivy vm [flags] VM_IMAGE
4949
--ignorefile string specify .trivyignore file (default ".trivyignore")
5050
--include-non-failures include successes and exceptions, available with '--scanners misconfig'
5151
--java-db-repository string OCI repository to retrieve trivy-java-db from (default "ghcr.io/aquasecurity/trivy-java-db:1")
52-
--list-all-pkgs enabling the option will output all packages regardless of vulnerability
52+
--list-all-pkgs output all packages in the JSON report regardless of vulnerability
5353
--misconfig-scanners strings comma-separated list of misconfig scanners to use for misconfiguration scanning (default [azure-arm,cloudformation,dockerfile,helm,kubernetes,terraform,terraformplan-json,terraformplan-snapshot])
5454
--module-dir string specify directory to the wasm modules that will be loaded (default "$HOME/.trivy/modules")
5555
--no-progress suppress progress bar

integration/client_server_test.go

+8-5
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ type csArgs struct {
3939

4040
func TestClientServer(t *testing.T) {
4141
tests := []struct {
42-
name string
43-
args csArgs
44-
golden string
45-
wantErr string
42+
name string
43+
args csArgs
44+
golden string
45+
override func(t *testing.T, want, got *types.Report)
4646
}{
4747
{
4848
name: "alpine 3.9",
@@ -270,6 +270,9 @@ func TestClientServer(t *testing.T) {
270270
Target: "https://github.com/knqyf263/trivy-ci-test",
271271
},
272272
golden: "testdata/test-repo.json.golden",
273+
override: func(t *testing.T, want, got *types.Report) {
274+
want.ArtifactName = "https://github.com/knqyf263/trivy-ci-test"
275+
},
273276
},
274277
}
275278

@@ -284,7 +287,7 @@ func TestClientServer(t *testing.T) {
284287
}
285288

286289
runTest(t, osArgs, tt.golden, "", types.FormatJSON, runOptions{
287-
override: overrideUID,
290+
override: overrideFuncs(overrideUID, tt.override),
288291
})
289292
})
290293
}

integration/repo_test.go

+8
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,14 @@ func TestRepository(t *testing.T) {
234234
},
235235
golden: "testdata/composer.lock.json.golden",
236236
},
237+
{
238+
name: "multiple lockfiles",
239+
args: args{
240+
scanner: types.VulnerabilityScanner,
241+
input: "testdata/fixtures/repo/trivy-ci-test",
242+
},
243+
golden: "testdata/test-repo.json.golden",
244+
},
237245
{
238246
name: "dockerfile",
239247
args: args{

0 commit comments

Comments
 (0)