Skip to content

Commit db06aba

Browse files
Added vulnerability composition support to allow for specifying the completeness and aggregate of vulnerabilities defined in a BOM. Updated test cases.
Signed-off-by: Steve Springett <[email protected]>
1 parent 4acfa29 commit db06aba

File tree

6 files changed

+74
-4
lines changed

6 files changed

+74
-4
lines changed

schema/bom-1.5.proto

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ message Bom {
2929
repeated ExternalReference external_references = 7;
3030
// Provides the ability to document dependency relationships.
3131
repeated Dependency dependencies = 8;
32-
// Provides the ability to document aggregate completeness
32+
// Compositions describe constituent parts (including components, services, and dependency relationships) and their completeness. The completeness of vulnerabilities expressed in a BOM may also be described.
3333
repeated Composition compositions = 9;
3434
// Vulnerabilities identified in components or services.
3535
repeated Vulnerability vulnerabilities = 10;
@@ -574,8 +574,10 @@ message Composition {
574574
repeated string assemblies = 2;
575575
// The dependencies the aggregate completeness applies to
576576
repeated string dependencies = 3;
577+
// The bom-ref identifiers of the vulnerabilities being described.
578+
repeated string vulnerabilities = 4;
577579
// An optional identifier which can be used to reference the composition elsewhere in the BOM. Every bom-ref MUST be unique within the BOM.
578-
optional string bom_ref = 4;
580+
optional string bom_ref = 5;
579581
}
580582

581583
message EvidenceCopyright {

schema/bom-1.5.schema.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
"items": {"$ref": "#/definitions/compositions"},
8888
"uniqueItems": true,
8989
"title": "Compositions",
90-
"description": "Compositions describe constituent parts (including components, services, and dependency relationships) and their completeness."
90+
"description": "Compositions describe constituent parts (including components, services, and dependency relationships) and their completeness. The completeness of vulnerabilities expressed in a BOM may also be described."
9191
},
9292
"vulnerabilities": {
9393
"type": "array",
@@ -1539,6 +1539,15 @@
15391539
"title": "BOM references",
15401540
"description": "The bom-ref identifiers of the components or services being described. Dependencies refer to a relationship whereby an independent constituent part requires another independent constituent part. References do not cascade to transitive dependencies. References are explicit for the specified dependency only."
15411541
},
1542+
"vulnerabilities": {
1543+
"type": "array",
1544+
"uniqueItems": true,
1545+
"items": {
1546+
"type": "string"
1547+
},
1548+
"title": "BOM references",
1549+
"description": "The bom-ref identifiers of the vulnerabilities being described."
1550+
},
15421551
"signature": {
15431552
"$ref": "#/definitions/signature",
15441553
"title": "Signature",

schema/bom-1.5.xsd

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2141,6 +2141,25 @@ limitations under the License.
21412141
</xs:sequence>
21422142
</xs:complexType>
21432143
</xs:element>
2144+
<xs:element name="vulnerabilities" minOccurs="0" maxOccurs="1">
2145+
<xs:annotation>
2146+
<xs:documentation>
2147+
The bom-ref identifiers of the vulnerabilities being described.
2148+
</xs:documentation>
2149+
</xs:annotation>
2150+
<xs:complexType>
2151+
<xs:sequence minOccurs="0" maxOccurs="unbounded">
2152+
<xs:element name="vulnerability" type="bom:bomReferenceType"/>
2153+
<xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded">
2154+
<xs:annotation>
2155+
<xs:documentation>
2156+
Allows any undeclared elements as long as the elements are placed in a different namespace.
2157+
</xs:documentation>
2158+
</xs:annotation>
2159+
</xs:any>
2160+
</xs:sequence>
2161+
</xs:complexType>
2162+
</xs:element>
21442163
</xs:sequence>
21452164
<xs:attribute name="bom-ref" type="bom:refType">
21462165
<xs:annotation>
@@ -3213,7 +3232,7 @@ limitations under the License.
32133232
</xs:element>
32143233
<xs:element name="compositions" type="bom:compositionsType" minOccurs="0" maxOccurs="1">
32153234
<xs:annotation>
3216-
<xs:documentation>Compositions describe constituent parts (including components, services, and dependency relationships) and their completeness.</xs:documentation>
3235+
<xs:documentation>Compositions describe constituent parts (including components, services, and dependency relationships) and their completeness. The completeness of vulnerabilities expressed in a BOM may also be described.</xs:documentation>
32173236
</xs:annotation>
32183237
</xs:element>
32193238
<xs:element name="properties" type="bom:propertiesType" minOccurs="0" maxOccurs="1">

tools/src/test/resources/1.5/valid-compositions-1.5.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@
4444
]
4545
}
4646
],
47+
"vulnerabilities": [
48+
{
49+
"bom-ref": "vulnerability-1",
50+
"id": "ACME-12345",
51+
"source": {
52+
"name": "Acme Inc"
53+
}
54+
}
55+
],
4756
"compositions": [
4857
{
4958
"bom-ref": "composition-1",
@@ -60,6 +69,12 @@
6069
"assemblies": [
6170
"pkg:maven/acme/[email protected]"
6271
]
72+
},
73+
{
74+
"aggregate": "incomplete_first_party_only",
75+
"vulnerabilities": [
76+
"vulnerability-1"
77+
]
6378
}
6479
]
6580
}

tools/src/test/resources/1.5/valid-compositions-1.5.textproto

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,14 @@ compositions {
4848
aggregate: AGGREGATE_UNKNOWN
4949
assemblies: "pkg:maven/acme/[email protected]"
5050
}
51+
compositions {
52+
aggregate: AGGREGATE_INCOMPLETE_FIRST_PARTY_ONLY,
53+
vulnerabilities: "vulnerability-1"
54+
}
55+
vulnerabilities {
56+
bom_ref: "vulnerability-1"
57+
id: "ACME-12345"
58+
source: {
59+
name: "Acme Inc"
60+
}
61+
}

tools/src/test/resources/1.5/valid-compositions-1.5.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,19 @@
4747
<assembly ref="pkg:maven/acme/[email protected]"/>
4848
</assemblies>
4949
</composition>
50+
<composition>
51+
<aggregate>incomplete_first_party_only</aggregate>
52+
<assemblies>
53+
<assembly ref="vulnerability-1"/>
54+
</assemblies>
55+
</composition>
5056
</compositions>
57+
<vulnerabilities>
58+
<vulnerability bom-ref="vulnerability-1">
59+
<id>ACME-12345</id>
60+
<source>
61+
<name>Acme Inc</name>
62+
</source>
63+
</vulnerability>
64+
</vulnerabilities>
5165
</bom>

0 commit comments

Comments
 (0)