Skip to content

Commit f822afc

Browse files
authored
refactor: metadata distribution to be an object (#653)
Refactored `metadata.distribution` to be more verbose in its name, and made it more versatile by converting it to an "object" with "TLP" as a property. caused by #603 (comment)
2 parents 680b4fc + 70c472f commit f822afc

File tree

6 files changed

+44
-12
lines changed

6 files changed

+44
-12
lines changed

schema/bom-1.7.proto

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,11 @@ enum LicensingTypeEnum {
564564
}
565565

566566
message Metadata {
567+
message DistributionConstraints {
568+
// The Traffic Light Protocol (TLP) classification that controls the sharing and distribution of the data that the BOM describes.
569+
optional TlpClassification tlp = 1;
570+
}
571+
567572
// The date and time (timestamp) when the document was created.
568573
optional google.protobuf.Timestamp timestamp = 1;
569574
// The tool(s) used in the creation of the BOM.
@@ -585,8 +590,8 @@ message Metadata {
585590
repeated Lifecycles lifecycles = 9;
586591
// The organization that created the BOM. Manufacturer is common in BOMs created through automated processes. BOMs created through manual means may have '.authors' instead.
587592
optional OrganizationalEntity manufacturer = 10;
588-
// The Traffic Light Protocol (TLP) classification that controls the sharing and distribution of the data that the BOM describes.
589-
optional TlpClassification distribution = 11;
593+
// Conditions and constraints governing the sharing and distribution of the data or components described by this BOM.
594+
optional DistributionConstraints distributionConstraints = 11;
590595
}
591596

592597
message Lifecycles {

schema/bom-1.7.schema.json

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -730,10 +730,17 @@
730730
"description": "Provides the ability to document properties in a name-value store. This provides flexibility to include data not officially supported in the standard without having to use additional namespaces or create extensions. Unlike key-value stores, properties support duplicate names, each potentially having different values. Property names of interest to the general public are encouraged to be registered in the [CycloneDX Property Taxonomy](https://github.com/CycloneDX/cyclonedx-property-taxonomy). Formal registration is optional.",
731731
"items": {"$ref": "#/definitions/property"}
732732
},
733-
"distribution": {
734-
"title": "Distribution",
735-
"description": "The Traffic Light Protocol (TLP) classification that controls the sharing and distribution of the data that the BOM describes.",
736-
"$ref": "#/definitions/tlpClassification"
733+
"distributionConstraints": {
734+
"title": "Distribution Constraints",
735+
"description": "Conditions and constraints governing the sharing and distribution of the data or components described by this BOM.",
736+
"type": "object",
737+
"properties": {
738+
"tlp": {
739+
"$ref": "#/definitions/tlpClassification",
740+
"description": "The Traffic Light Protocol (TLP) classification that controls the sharing and distribution of the data that the BOM describes."
741+
}
742+
},
743+
"additionalProperties": false
737744
}
738745
}
739746
},

schema/bom-1.7.xsd

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,25 @@ limitations under the License.
256256
Formal registration is optional.</xs:documentation>
257257
</xs:annotation>
258258
</xs:element>
259-
<xs:element name="distribution" type="bom:tlpClassificationType" default="CLEAR" minOccurs="0" maxOccurs="1">
259+
<xs:element name="distributionConstraints" minOccurs="0" maxOccurs="1">
260260
<xs:annotation>
261-
<xs:documentation>The Traffic Light Protocol (TLP) classification that controls the sharing and distribution
262-
of the data that the BOM describes.</xs:documentation>
261+
<xs:documentation>
262+
Conditions and constraints governing the sharing and distribution of the data or components
263+
described by this BOM.
264+
</xs:documentation>
263265
</xs:annotation>
266+
<xs:complexType>
267+
<xs:sequence>
268+
<xs:element name="tlp" type="bom:tlpClassificationType" default="CLEAR" minOccurs="0" maxOccurs="1">
269+
<xs:annotation>
270+
<xs:documentation>
271+
The Traffic Light Protocol (TLP) classification that controls the sharing and
272+
distribution of the data that the BOM describes.
273+
</xs:documentation>
274+
</xs:annotation>
275+
</xs:element>
276+
</xs:sequence>
277+
</xs:complexType>
264278
</xs:element>
265279
<xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded">
266280
<xs:annotation>

tools/src/test/resources/1.7/valid-metadata-distribution-1.7.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
66
"version": 1,
77
"metadata": {
8-
"distribution": "RED"
8+
"distributionConstraints": {
9+
"tlp": "RED"
10+
}
911
},
1012
"components": []
1113
}

tools/src/test/resources/1.7/valid-metadata-distribution-1.7.textproto

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@ spec_version: "1.7"
55
version: 1
66
serial_number: "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79"
77
metadata {
8-
distribution: TLP_CLASSIFICATION_RED
8+
distributionConstraints {
9+
tlp: TLP_CLASSIFICATION_RED
10+
}
911
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<?xml version="1.0"?>
22
<bom serialNumber="urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79" version="1" xmlns="http://cyclonedx.org/schema/bom/1.7">
33
<metadata>
4-
<distribution>RED</distribution>
4+
<distributionConstraints>
5+
<tlp>RED</tlp>
6+
</distributionConstraints>
57
</metadata>
68
<components />
79
</bom>

0 commit comments

Comments
 (0)