Skip to content

Commit 8858683

Browse files
fix(ProtoBuf,XML): component data repeatable (#530)
fixes <#518> --------- Signed-off-by: Jan Kowalleck <[email protected]> Signed-off-by: Jan Kowalleck <[email protected]> Co-authored-by: andreas-hilti <[email protected]>
1 parent ec3e9a2 commit 8858683

File tree

8 files changed

+95
-2
lines changed

8 files changed

+95
-2
lines changed

schema/bom-1.6.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ message Component {
140140
// A model card describes the intended uses of a machine learning model, potential limitations, biases, ethical considerations, training parameters, datasets used to train the model, performance metrics, and other relevant data useful for ML transparency.
141141
optional ModelCard modelCard = 25;
142142
// This object SHOULD be specified for any component of type `data` and must not be specified for other component types.
143-
optional ComponentData data = 26;
143+
repeated ComponentData data = 26;
144144
// Cryptographic assets have properties that uniquely define them and that make them actionable for further reasoning. As an example, it makes a difference if one knows the algorithm family (e.g. AES) or the specific variant or instantiation (e.g. AES-128-GCM). This is because the security level and the algorithm primitive (authenticated encryption) is only defined by the definition of the algorithm variant. The presence of a weak cryptographic algorithm like SHA1 vs. HMAC-SHA1 also makes a difference.
145145
optional CryptoProperties cryptoProperties = 27;
146146
// The organization that created the component. Manufacturer is common in components created through automated processes. Components created through manual means may have `.authors` instead.

schema/bom-1.6.xsd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ limitations under the License.
698698
type `machine-learning-model` and must not be specified for other component types.</xs:documentation>
699699
</xs:annotation>
700700
</xs:element>
701-
<xs:element name="data" type="bom:componentDataType" minOccurs="0" maxOccurs="1">
701+
<xs:element name="data" type="bom:componentDataType" minOccurs="0" maxOccurs="unbounded">
702702
<xs:annotation>
703703
<xs:documentation>This object SHOULD be specified for any component of type `data` and must not be
704704
specified for other component types.</xs:documentation>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"$schema": "http://cyclonedx.org/schema/bom-1.6.schema.json",
3+
"bomFormat": "CycloneDX",
4+
"specVersion": "1.6",
5+
"serialNumber": "urn:uuid:1b1bff0e-fdb9-4088-8b9a-1a9f2d9006da",
6+
"version": 1,
7+
"components": [
8+
{
9+
"type": "data",
10+
"name": "my-configs",
11+
"version": "1337",
12+
"data": [
13+
{
14+
"type": "configuration",
15+
"name": "app.ini",
16+
"contents": {
17+
"url": "https://example.com/cfg/1337/app.ini"
18+
}
19+
},
20+
{
21+
"type": "other",
22+
"name": ".env",
23+
"contents": {
24+
"url": "https://example.com/cfg/1337/env"
25+
}
26+
}
27+
]
28+
}
29+
]
30+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# proto-file: schema/bom-1.6.proto
2+
# proto-message: Bom
3+
4+
spec_version: "1.6"
5+
version: 1
6+
serial_number: "urn:uuid:1b1bff0e-fdb9-4088-8b9a-1a9f2d9006da"
7+
components {
8+
type: CLASSIFICATION_DATA
9+
name: "my-configs"
10+
version: "1337"
11+
data {
12+
type: COMPONENT_DATA_TYPE_CONFIGURATION
13+
name: "app.data"
14+
contents {
15+
url: "https://example.com/cfg/1337/app.ini"
16+
}
17+
}
18+
data {
19+
type: COMPONENT_DATA_TYPE_OTHER
20+
name: ".env"
21+
contents {
22+
url: "https://example.com/cfg/1337/env"
23+
}
24+
}
25+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0"?>
2+
<bom serialNumber="urn:uuid:1b1bff0e-fdb9-4088-8b9a-1a9f2d9006da" version="1"
3+
xmlns="http://cyclonedx.org/schema/bom/1.6">
4+
<components>
5+
<component type="data">
6+
<name>my-configs</name>
7+
<version>1337</version>
8+
<data>
9+
<type>configuration</type>
10+
<name>app.ini</name>
11+
<contents>
12+
<url>https://example.com/cfg/1337/app.ini</url>
13+
</contents>
14+
</data>
15+
<data>
16+
<type>other</type>
17+
<name>.env</name>
18+
<contents>
19+
<url>https://example.com/cfg/1337/env</url>
20+
</contents>
21+
</data>
22+
</component>
23+
</components>
24+
</bom>

tools/src/test/resources/1.6/valid-component-types-1.6.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@
4444
"type": "file",
4545
"name": "file-a",
4646
"version": "1.0"
47+
},
48+
{
49+
"type": "data",
50+
"name": "data-a",
51+
"version": "1.0"
4752
}
4853
]
4954
}

tools/src/test/resources/1.6/valid-component-types-1.6.textproto

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,8 @@ components {
4444
name: "file-a"
4545
version: "1.0"
4646
}
47+
components {
48+
type: CLASSIFICATION_DATA
49+
name: "data-a"
50+
version: "1.0"
51+
}

tools/src/test/resources/1.6/valid-component-types-1.6.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,9 @@
3333
<name>file-a</name>
3434
<version>1.0</version>
3535
</component>
36+
<component type="data">
37+
<name>data-a</name>
38+
<version>1.0</version>
39+
</component>
3640
</components>
3741
</bom>

0 commit comments

Comments
 (0)