@@ -80,7 +80,7 @@ def test_simple_bom_v1_3_with_vulnerabilities(self):
80
80
severity = VulnerabilitySeverity .CRITICAL , method = VulnerabilitySourceType .CVSS_V3 ,
81
81
vector = 'AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H' ),
82
82
VulnerabilityRating (severity = VulnerabilitySeverity .LOW , method = VulnerabilitySourceType .OWASP ,
83
- vector = 'OWASP/K9:M1:O0:Z2/D1:X1:W1:L3/C2:I1:A1:T1/F1:R1:S2:P3/50' ,)
83
+ vector = 'OWASP/K9:M1:O0:Z2/D1:X1:W1:L3/C2:I1:A1:T1/F1:R1:S2:P3/50' , )
84
84
],
85
85
cwes = [123 , 456 ], description = 'A description here' , recommendations = ['Upgrade' ],
86
86
advisories = [
@@ -96,3 +96,30 @@ def test_simple_bom_v1_3_with_vulnerabilities(self):
96
96
namespace = outputter .get_target_namespace ())
97
97
98
98
expected_xml .close ()
99
+
100
+ def test_simple_bom_v1_0_with_vulnerabilities (self ):
101
+ bom = Bom ()
102
+ c = Component (name = 'setuptools' , version = '50.3.2' , qualifiers = 'extension=tar.gz' )
103
+ c .add_vulnerability (Vulnerability (
104
+ id = 'CVE-2018-7489' , source_name = 'NVD' , source_url = 'https://nvd.nist.gov/vuln/detail/CVE-2018-7489' ,
105
+ ratings = [
106
+ VulnerabilityRating (score_base = 9.8 , score_impact = 5.9 , score_exploitability = 3.0 ,
107
+ severity = VulnerabilitySeverity .CRITICAL , method = VulnerabilitySourceType .CVSS_V3 ,
108
+ vector = 'AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H' ),
109
+ VulnerabilityRating (severity = VulnerabilitySeverity .LOW , method = VulnerabilitySourceType .OWASP ,
110
+ vector = 'OWASP/K9:M1:O0:Z2/D1:X1:W1:L3/C2:I1:A1:T1/F1:R1:S2:P3/50' , )
111
+ ],
112
+ cwes = [123 , 456 ], description = 'A description here' , recommendations = ['Upgrade' ],
113
+ advisories = [
114
+ 'http://www.securityfocus.com/bid/103203' ,
115
+ 'http://www.securitytracker.com/id/1040693'
116
+ ]
117
+ ))
118
+ bom .add_component (c )
119
+ outputter : Xml = get_instance (bom = bom , schema_version = SchemaVersion .V1_0 )
120
+ self .assertIsInstance (outputter , XmlV1Dot0 )
121
+ with open (join (dirname (__file__ ), 'fixtures/bom_v1.0_setuptools.xml' )) as expected_xml :
122
+ self .assertEqualXmlBom (a = outputter .output_as_string (), b = expected_xml .read (),
123
+ namespace = outputter .get_target_namespace ())
124
+
125
+ expected_xml .close ()
0 commit comments