Skip to content

Commit 3240de6

Browse files
authored
Merge pull request #15 from CycloneDX/fix-vuln
Fix column names for vulnerability command
2 parents 4b15622 + 7e74ee2 commit 3240de6

File tree

4 files changed

+39
-13
lines changed

4 files changed

+39
-13
lines changed

README.md

+3-6
Original file line numberDiff line numberDiff line change
@@ -790,10 +790,7 @@ This command will extract basic vulnerability report data from an SBOM that has
790790

791791
#### Where flag filtering
792792

793-
In addition a `where` filter flag can be supplied to only include results where values match supplied regex. Supported keys for the `where` filter include the following column names in the report (i.e., `id`, `bom-ref`, `created`
794-
`published`, `updated`, `rejected` and `description`).
795-
796-
**Note**: filtering using `source.name` and `source.url` are coming soon
793+
In addition a `where` filter flag can be supplied to only include results where values match supplied regex. Supported keys for the `where` filter include the following column names in the report (i.e., `id`, `bom-ref`, `source-name`, `source-url`, `created`, `published`, `updated`, `rejected` and `description`).
797794

798795
#### Format flag
799796

@@ -814,7 +811,7 @@ Currently, all `vulnerability list` command results are sorted by vulnerability
814811
```
815812

816813
```bash
817-
id bom-ref source.url source.name created published updated rejected description
814+
id bom-ref source-name source-url created published updated rejected description
818815
-- ------- ---------- ----------- ------- --------- ------- -------- -----------
819816
CVE-2020-25649 NVD https://nvd.nist.gov/vuln/detail/CVE-2020-25649 2020-12-03T00:00:00.000Z 2020-12-03T00:00:00.000Z 2023-02-02T00:00:00.000Z com.fasterxml.jackson.core:jackson-databind is a library which contains the general-purpose data-binding functionality and tree-model for Jackson Data Processor. Affected versions of this package are vulnerable to XML External Entity (XXE) Injection.
820817
CVE-2022-42003 NVD https://nvd.nist.gov/vuln/detail/CVE-2022-42003 2022-10-02T00:00:00.000Z 2022-10-02T00:00:00.000Z 2022-10-02T00:00:00.000Z In FasterXML jackson-databind before 2.14.0-rc1, resource exhaustion can occur because of a lack of a check in primitive value deserializers to avoid deep wrapper array nesting, when the UNWRAP_SINGLE_VALUE_ARRAYS feature is enabled.
@@ -828,7 +825,7 @@ CVE-2022-42004 NVD https://nvd.nist.gov/vuln/detail/CVE-2022-4
828825
```
829826

830827
```bash
831-
id bom-ref source.url source.name created published updated rejected description
828+
id bom-ref source-name source-url created published updated rejected description
832829
-- ------- ---------- ----------- ------- --------- ------- -------- -----------
833830
CVE-2020-25649 NVD https://nvd.nist.gov/vuln/detail/CVE-2020-25649 2020-12-03T00:00:00.000Z 2020-12-03T00:00:00.000Z 2023-02-02T00:00:00.000Z com.fasterxml.jackson.core:jackson-databind is a library which contains the general-purpose data-binding functionality and tree-model for Jackson Data Processor. Affected versions of this package are vulnerable to XML External Entity (XXE) Injection.
834831
```

cmd/vulnerability.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ const (
5656
var VULNERABILITY_LIST_TITLES = []string{
5757
VULN_FILTER_KEY_ID,
5858
VULN_FILTER_KEY_BOM_REF,
59-
VULN_FILTER_KEY_SOURCE_URL,
6059
VULN_FILTER_KEY_SOURCE_NAME,
60+
VULN_FILTER_KEY_SOURCE_URL,
6161
VULN_FILTER_KEY_CREATED,
6262
VULN_FILTER_KEY_PUBLISHED,
6363
VULN_FILTER_KEY_UPDATED,

cmd/vulnerability_test.go

+32
Original file line numberDiff line numberDiff line change
@@ -326,3 +326,35 @@ func TestVulnListTextCdx14WhereClauseDescContains(t *testing.T) {
326326

327327
innerTestVulnList(t, testInfo)
328328
}
329+
330+
func TestVulnListTextCdx14WhereClauseSourceNameNVD(t *testing.T) {
331+
TEST_INPUT_WHERE_CLAUSE := "source-name=NVD"
332+
TEST_OUTPUT_CONTAINS := "NVD"
333+
TEST_OUTPUT_LINES := 5
334+
335+
testInfo := NewVulnTestInfo(
336+
TEST_VULN_CDX_1_3_EXAMPLE_1_BOM_VEX,
337+
FORMAT_TEXT,
338+
TEST_INPUT_WHERE_CLAUSE,
339+
TEST_OUTPUT_CONTAINS,
340+
TEST_OUTPUT_LINES,
341+
nil)
342+
343+
innerTestVulnList(t, testInfo)
344+
}
345+
346+
func TestVulnListTextCdx14WhereClauseSourceUrlCVE2022(t *testing.T) {
347+
TEST_INPUT_WHERE_CLAUSE := "source-url=CVE-2022"
348+
TEST_OUTPUT_CONTAINS := "CVE-2022"
349+
TEST_OUTPUT_LINES := 4
350+
351+
testInfo := NewVulnTestInfo(
352+
TEST_VULN_CDX_1_3_EXAMPLE_1_BOM_VEX,
353+
FORMAT_TEXT,
354+
TEST_INPUT_WHERE_CLAUSE,
355+
TEST_OUTPUT_CONTAINS,
356+
TEST_OUTPUT_LINES,
357+
nil)
358+
359+
innerTestVulnList(t, testInfo)
360+
}

docs/demo.md

+3-6
Original file line numberDiff line numberDiff line change
@@ -624,10 +624,7 @@ This command will extract basic vulnerability report data from an SBOM that has
624624
625625
#### Where flag filtering
626626
627-
In addition a `where` filter flag can be supplied to only include results where values match supplied regex. Supported keys for the `where` filter include the following column names in the report (i.e., `id`, `bom-ref`, `created`
628-
`published`, `updated`, `rejected` and `description`).
629-
630-
**Note**: filtering using `source.name` and `source.url` are coming soon
627+
In addition a `where` filter flag can be supplied to only include results where values match supplied regex. Supported keys for the `where` filter include the following column names in the report (i.e., `id`, `bom-ref`, `source-name`, `source-url`, `created`, `published`, `updated`, `rejected` and `description`).
631628
632629
#### Format flag
633630
@@ -648,7 +645,7 @@ Currently, all `vulnerability list` command results are sorted by vulnerability
648645
```
649646
650647
```bash
651-
id bom-ref source.url source.name created published updated rejected description
648+
id bom-ref source-name source-url created published updated rejected description
652649
-- ------- ---------- ----------- ------- --------- ------- -------- -----------
653650
CVE-2020-25649 NVD https://nvd.nist.gov/vuln/detail/CVE-2020-25649 2020-12-03T00:00:00.000Z 2020-12-03T00:00:00.000Z 2023-02-02T00:00:00.000Z com.fasterxml.jackson.core:jackson-databind is a library which contains the general-purpose data-binding functionality and tree-model for Jackson Data Processor. Affected versions of this package are vulnerable to XML External Entity (XXE) Injection.
654651
CVE-2022-42003 NVD https://nvd.nist.gov/vuln/detail/CVE-2022-42003 2022-10-02T00:00:00.000Z 2022-10-02T00:00:00.000Z 2022-10-02T00:00:00.000Z In FasterXML jackson-databind before 2.14.0-rc1, resource exhaustion can occur because of a lack of a check in primitive value deserializers to avoid deep wrapper array nesting, when the UNWRAP_SINGLE_VALUE_ARRAYS feature is enabled.
@@ -662,7 +659,7 @@ CVE-2022-42004 NVD https://nvd.nist.gov/vuln/detail/CVE-2022-4
662659
```
663660
664661
```bash
665-
id bom-ref source.url source.name created published updated rejected description
662+
id bom-ref source-name source-url created published updated rejected description
666663
-- ------- ---------- ----------- ------- --------- ------- -------- -----------
667664
CVE-2020-25649 NVD https://nvd.nist.gov/vuln/detail/CVE-2020-25649 2020-12-03T00:00:00.000Z 2020-12-03T00:00:00.000Z 2023-02-02T00:00:00.000Z com.fasterxml.jackson.core:jackson-databind is a library which contains the general-purpose data-binding functionality and tree-model for Jackson Data Processor. Affected versions of this package are vulnerable to XML External Entity (XXE) Injection.
668665
```

0 commit comments

Comments
 (0)