Skip to content

Commit 799666e

Browse files
authored
fix: Fix slight inconsistency in for-human formats (#2581)
`--format <table, vertical, markdown>` now all have 1 newline between logs and summary, and 1 newline between summary and results. (This makes my brain happy ☺️) Fixes: #2580
1 parent 5af151e commit 799666e

7 files changed

Lines changed: 286 additions & 275 deletions

File tree

cmd/osv-scanner/scan/image/__snapshots__/command_test.snap

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Checking if docker image ("alpine:3.18.9") exists locally...
3030
Saving docker image ("alpine:3.18.9") to temporary file...
3131
Scanning image "alpine:3.18.9"
3232

33+
3334
Container Scanning Result (Alpine Linux v3.18) (Based on "alpine" image):
3435
Total 2 packages affected by 3 known vulnerabilities (0 Critical, 1 High, 2 Medium, 0 Low, 0 Unknown) from 1 ecosystem.
3536
3 vulnerabilities can be fixed.
@@ -112,6 +113,7 @@ No issues found
112113
[TestCommand_ExplicitExtractors_WithDefaults/add_extractors - 1]
113114
Scanning local image tarball "testdata/test-alpine-sbom.tar"
114115
116+
115117
Container Scanning Result (Alpine Linux v3.10) (Based on "alpine" image):
116118
Total 2 packages affected by 2 known vulnerabilities (2 Critical, 0 High, 0 Medium, 0 Low, 0 Unknown) from 2 ecosystems.
117119
1 vulnerability can be fixed.
@@ -146,6 +148,7 @@ You can also view the full vulnerability list in your terminal with: `osv-scanne
146148
[TestCommand_ExplicitExtractors_WithDefaults/extractors_cancelled_out - 1]
147149
Scanning local image tarball "testdata/test-alpine-sbom.tar"
148150
151+
149152
Container Scanning Result (Alpine Linux v3.10) (Based on "alpine" image):
150153
Total 1 package affected by 1 known vulnerability (1 Critical, 0 High, 0 Medium, 0 Low, 0 Unknown) from 1 ecosystem.
151154
1 vulnerability can be fixed.
@@ -172,6 +175,7 @@ You can also view the full vulnerability list in your terminal with: `osv-scanne
172175
[TestCommand_ExplicitExtractors_WithDefaults/extractors_cancelled_out#01 - 1]
173176
Scanning local image tarball "testdata/test-alpine-sbom.tar"
174177
178+
175179
Container Scanning Result (Alpine Linux v3.10) (Based on "alpine" image):
176180
Total 1 package affected by 1 known vulnerability (1 Critical, 0 High, 0 Medium, 0 Low, 0 Unknown) from 1 ecosystem.
177181
1 vulnerability can be fixed.
@@ -198,6 +202,7 @@ You can also view the full vulnerability list in your terminal with: `osv-scanne
198202
[TestCommand_ExplicitExtractors_WithDefaults/extractors_cancelled_out_with_presets - 1]
199203
Scanning local image tarball "testdata/test-alpine-sbom.tar"
200204
205+
201206
Container Scanning Result (Alpine Linux v3.10) (Based on "alpine" image):
202207
Total 1 package affected by 1 known vulnerability (1 Critical, 0 High, 0 Medium, 0 Low, 0 Unknown) from 1 ecosystem.
203208
1 vulnerability can be fixed.
@@ -223,10 +228,10 @@ You can also view the full vulnerability list in your terminal with: `osv-scanne
223228
224229
[TestCommand_ExplicitExtractors_WithoutDefaults/add_extractors - 1]
225230
Scanning local image tarball "testdata/test-alpine-sbom.tar"
231+
226232
Total 1 package affected by 1 known vulnerability (1 Critical, 0 High, 0 Medium, 0 Low, 0 Unknown) from 1 ecosystem.
227233
0 vulnerabilities can be fixed.
228234
229-
230235
+---------------------------------------+------+-----------+---------+-----------+---------------+---------------------------------------------------+
231236
| OSV URL | CVSS | ECOSYSTEM | PACKAGE | VERSION | FIXED VERSION | SOURCE |
232237
+---------------------------------------+------+-----------+---------+-----------+---------------+---------------------------------------------------+
@@ -275,6 +280,7 @@ HTML output available at: <tempdir>/report.html
275280
[TestCommand_OCIImage/Alpine_3.10_image_tar_with_3.18_version_file - 1]
276281
Scanning local image tarball "./testdata/test-alpine.tar"
277282
283+
278284
Container Scanning Result (Alpine Linux v3.18) (Based on "alpine" image):
279285
Total 5 packages affected by 65 known vulnerabilities (6 Critical, 33 High, 26 Medium, 0 Low, 0 Unknown) from 1 ecosystem.
280286
65 vulnerabilities can be fixed.
@@ -344,6 +350,7 @@ Package Ubuntu:20.04/util-linux/2.34-0.1ubuntu9.6 has been filtered out because:
344350
Package Ubuntu:20.04/zlib/1:1.2.11.dfsg-2ubuntu1.5 has been filtered out because: Just want to test only unimportant vulns
345351
Filtered 38 ignored package/s from the scan.
346352
353+
347354
Container Scanning Result (Ubuntu 20.04.6 LTS) (Based on "ubuntu" image):
348355
Total 0 packages affected by 0 known vulnerabilities (0 Critical, 0 High, 0 Medium, 0 Low, 0 Unknown) from 1 ecosystem.
349356
0 vulnerabilities can be fixed.
@@ -402,6 +409,7 @@ Package Ubuntu:20.04/util-linux/2.34-0.1ubuntu9.6 has been filtered out because:
402409
Package Ubuntu:20.04/zlib/1:1.2.11.dfsg-2ubuntu1.5 has been filtered out because: Just want to test only unimportant vulns
403410
Filtered 38 ignored package/s from the scan.
404411
412+
405413
Container Scanning Result (Ubuntu 20.04.6 LTS) (Based on "ubuntu" image):
406414
Total 0 packages affected by 0 known vulnerabilities (0 Critical, 0 High, 0 Medium, 0 Low, 0 Unknown) from 1 ecosystem.
407415
0 vulnerabilities can be fixed.
@@ -427,6 +435,7 @@ You can also view the full vulnerability list in your terminal with: `osv-scanne
427435
[TestCommand_OCIImage/Empty_Ubuntu_22.04_image_tar - 1]
428436
Scanning local image tarball "./testdata/test-ubuntu.tar"
429437
438+
430439
Container Scanning Result (Ubuntu 22.04.5 LTS) (Based on "ubuntu" image):
431440
Total 20 packages affected by 45 known vulnerabilities (3 Critical, 13 High, 24 Medium, 3 Low, 2 Unknown) from 1 ecosystem.
432441
24 vulnerabilities can be fixed.
@@ -473,6 +482,7 @@ You can also view the full vulnerability list in your terminal with: `osv-scanne
473482
[TestCommand_OCIImage/Empty_Ubuntu_22.04_image_tar_with_unimportant_vulns - 1]
474483
Scanning local image tarball "./testdata/test-ubuntu.tar"
475484
485+
476486
Container Scanning Result (Ubuntu 22.04.5 LTS) (Based on "ubuntu" image):
477487
Total 20 packages affected by 45 known vulnerabilities (3 Critical, 13 High, 24 Medium, 3 Low, 2 Unknown) from 1 ecosystem.
478488
24 vulnerabilities can be fixed.
@@ -538,6 +548,7 @@ failed to load image from tarball with path "../../testdata/locks-manyoci-image/
538548
[TestCommand_OCIImage/Scanning_Ubuntu_image_with_go_OS_packages_json - 1]
539549
Scanning local image tarball "./testdata/test-ubuntu-with-packages.tar"
540550
551+
541552
Container Scanning Result (Ubuntu 22.04.5 LTS) (Based on "ubuntu" image):
542553
Total 20 packages affected by 45 known vulnerabilities (3 Critical, 13 High, 24 Medium, 3 Low, 2 Unknown) from 1 ecosystem.
543554
24 vulnerabilities can be fixed.
@@ -584,6 +595,7 @@ You can also view the full vulnerability list in your terminal with: `osv-scanne
584595
[TestCommand_OCIImage/Scanning_java_image_with_some_packages - 1]
585596
Scanning local image tarball "./testdata/test-java-full.tar"
586597
598+
587599
Container Scanning Result (Alpine Linux v3.21) (Based on "eclipse-temurin" image):
588600
Total 24 packages affected by 61 known vulnerabilities (4 Critical, 24 High, 29 Medium, 3 Low, 1 Unknown) from 2 ecosystems.
589601
61 vulnerabilities can be fixed.
@@ -640,6 +652,7 @@ You can also view the full vulnerability list in your terminal with: `osv-scanne
640652
[TestCommand_OCIImage/Scanning_python_image_with_no_packages - 1]
641653
Scanning local image tarball "./testdata/test-python-empty.tar"
642654
655+
643656
Container Scanning Result (Debian GNU/Linux 10 (buster)) (Based on "python" image):
644657
Total 15 packages affected by 27 known vulnerabilities (0 Critical, 7 High, 4 Medium, 2 Low, 14 Unknown) from 2 ecosystems.
645658
27 vulnerabilities can be fixed.
@@ -711,6 +724,7 @@ You can also view the full vulnerability list in your terminal with: `osv-scanne
711724
[TestCommand_OCIImage/Scanning_python_image_with_some_packages - 1]
712725
Scanning local image tarball "./testdata/test-python-full.tar"
713726
727+
714728
Container Scanning Result (Debian GNU/Linux 10 (buster)) (Based on "python" image):
715729
Total 21 packages affected by 51 known vulnerabilities (1 Critical, 18 High, 15 Medium, 2 Low, 15 Unknown) from 2 ecosystems.
716730
51 vulnerabilities can be fixed.
@@ -824,6 +838,7 @@ You can also view the full vulnerability list in your terminal with: `osv-scanne
824838
[TestCommand_OCIImage/scanning_image_with_go_binary - 1]
825839
Scanning local image tarball "./testdata/test-package-tracing.tar"
826840
841+
827842
Container Scanning Result (Alpine Linux v3.20) (Based on "alpine" image):
828843
Total 9 packages affected by 195 known vulnerabilities (2 Critical, 6 High, 11 Medium, 2 Low, 174 Unknown) from 2 ecosystems.
829844
195 vulnerabilities can be fixed.
@@ -895,6 +910,7 @@ You can also view the full vulnerability list in your terminal with: `osv-scanne
895910
[TestCommand_OCIImage/scanning_insecure_alpine_image_with_detector_preset - 1]
896911
Scanning local image tarball "./testdata/test-alpine-etcshadow.tar"
897912
913+
898914
Container Scanning Result (Alpine Linux v3.10) (Based on "alpine" image):
899915
Total 1 package affected by 1 known vulnerability (1 Critical, 0 High, 0 Medium, 0 Low, 0 Unknown) from 1 ecosystem.
900916
1 vulnerability can be fixed.
@@ -921,6 +937,7 @@ You can also view the full vulnerability list in your terminal with: `osv-scanne
921937
[TestCommand_OCIImage/scanning_insecure_alpine_image_with_specific_detector_disabled - 1]
922938
Scanning local image tarball "./testdata/test-alpine-etcshadow.tar"
923939
940+
924941
Container Scanning Result (Alpine Linux v3.10) (Based on "alpine" image):
925942
Total 1 package affected by 1 known vulnerability (1 Critical, 0 High, 0 Medium, 0 Low, 0 Unknown) from 1 ecosystem.
926943
1 vulnerability can be fixed.
@@ -947,6 +964,7 @@ You can also view the full vulnerability list in your terminal with: `osv-scanne
947964
[TestCommand_OCIImage/scanning_insecure_alpine_image_with_specific_detector_enabled - 1]
948965
Scanning local image tarball "./testdata/test-alpine-etcshadow.tar"
949966
967+
950968
Container Scanning Result (Alpine Linux v3.10) (Based on "alpine" image):
951969
Total 1 package affected by 1 known vulnerability (1 Critical, 0 High, 0 Medium, 0 Low, 0 Unknown) from 1 ecosystem.
952970
1 vulnerability can be fixed.
@@ -973,6 +991,7 @@ You can also view the full vulnerability list in your terminal with: `osv-scanne
973991
[TestCommand_OCIImage/scanning_insecure_alpine_image_without_detectors - 1]
974992
Scanning local image tarball "./testdata/test-alpine-etcshadow.tar"
975993
994+
976995
Container Scanning Result (Alpine Linux v3.10) (Based on "alpine" image):
977996
Total 1 package affected by 1 known vulnerability (1 Critical, 0 High, 0 Medium, 0 Low, 0 Unknown) from 1 ecosystem.
978997
1 vulnerability can be fixed.
@@ -999,6 +1018,7 @@ You can also view the full vulnerability list in your terminal with: `osv-scanne
9991018
[TestCommand_OCIImage/scanning_node_modules_using_npm_with_no_packages - 1]
10001019
Scanning local image tarball "./testdata/test-node_modules-npm-empty.tar"
10011020
1021+
10021022
Container Scanning Result (Alpine Linux v3.19) (Based on "library/node" image):
10031023
Total 2 packages affected by 15 known vulnerabilities (1 Critical, 3 High, 9 Medium, 2 Low, 0 Unknown) from 1 ecosystem.
10041024
15 vulnerabilities can be fixed.
@@ -1026,6 +1046,7 @@ You can also view the full vulnerability list in your terminal with: `osv-scanne
10261046
[TestCommand_OCIImage/scanning_node_modules_using_npm_with_some_packages - 1]
10271047
Scanning local image tarball "./testdata/test-node_modules-npm-full.tar"
10281048
1049+
10291050
Container Scanning Result (Alpine Linux v3.19) (Based on "library/node" image):
10301051
Total 4 packages affected by 18 known vulnerabilities (3 Critical, 3 High, 10 Medium, 2 Low, 0 Unknown) from 2 ecosystems.
10311052
17 vulnerabilities can be fixed.
@@ -1062,6 +1083,7 @@ You can also view the full vulnerability list in your terminal with: `osv-scanne
10621083
[TestCommand_OCIImage/scanning_node_modules_using_pnpm_with_no_packages - 1]
10631084
Scanning local image tarball "./testdata/test-node_modules-pnpm-empty.tar"
10641085
1086+
10651087
Container Scanning Result (Alpine Linux v3.19) (Based on "library/node" image):
10661088
Total 2 packages affected by 15 known vulnerabilities (1 Critical, 3 High, 9 Medium, 2 Low, 0 Unknown) from 1 ecosystem.
10671089
15 vulnerabilities can be fixed.
@@ -1089,6 +1111,7 @@ You can also view the full vulnerability list in your terminal with: `osv-scanne
10891111
[TestCommand_OCIImage/scanning_node_modules_using_pnpm_with_some_packages - 1]
10901112
Scanning local image tarball "./testdata/test-node_modules-pnpm-full.tar"
10911113
1114+
10921115
Container Scanning Result (Alpine Linux v3.19) (Based on "library/node" image):
10931116
Total 2 packages affected by 15 known vulnerabilities (1 Critical, 3 High, 9 Medium, 2 Low, 0 Unknown) from 1 ecosystem.
10941117
15 vulnerabilities can be fixed.
@@ -1116,6 +1139,7 @@ You can also view the full vulnerability list in your terminal with: `osv-scanne
11161139
[TestCommand_OCIImage/scanning_node_modules_using_yarn_with_no_packages - 1]
11171140
Scanning local image tarball "./testdata/test-node_modules-yarn-empty.tar"
11181141
1142+
11191143
Container Scanning Result (Alpine Linux v3.19) (Based on "library/node" image):
11201144
Total 2 packages affected by 15 known vulnerabilities (1 Critical, 3 High, 9 Medium, 2 Low, 0 Unknown) from 1 ecosystem.
11211145
15 vulnerabilities can be fixed.
@@ -1143,6 +1167,7 @@ You can also view the full vulnerability list in your terminal with: `osv-scanne
11431167
[TestCommand_OCIImage/scanning_node_modules_using_yarn_with_some_packages - 1]
11441168
Scanning local image tarball "./testdata/test-node_modules-yarn-full.tar"
11451169
1170+
11461171
Container Scanning Result (Alpine Linux v3.19) (Based on "library/node" image):
11471172
Total 2 packages affected by 15 known vulnerabilities (1 Critical, 3 High, 9 Medium, 2 Low, 0 Unknown) from 1 ecosystem.
11481173
15 vulnerabilities can be fixed.

0 commit comments

Comments
 (0)