Skip to content

Commit ee39f18

Browse files
authored
feat: add custom properties to external references (#610)
With this property external references can be annotated with additional metadata in a machine-readable format. As discussed in #608 this adds support for custom properties in external references. fixes #608
2 parents a9122e8 + ed9918d commit ee39f18

File tree

6 files changed

+89
-0
lines changed

6 files changed

+89
-0
lines changed

schema/bom-1.7.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@ message ExternalReference {
230230
optional string comment = 3;
231231
// Optional integrity hashes for the external resource content
232232
repeated Hash hashes = 4;
233+
// Specifies optional, custom, properties
234+
repeated Property properties = 5;
233235
}
234236

235237
enum ExternalReferenceType {

schema/bom-1.7.schema.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1883,6 +1883,12 @@
18831883
"items": {"$ref": "#/definitions/hash"},
18841884
"title": "Hashes",
18851885
"description": "The hashes of the external reference (if applicable)."
1886+
},
1887+
"properties": {
1888+
"type": "array",
1889+
"title": "Properties",
1890+
"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.",
1891+
"items": {"$ref": "#/definitions/property"}
18861892
}
18871893
}
18881894
},

schema/bom-1.7.xsd

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1682,6 +1682,16 @@ limitations under the License.
16821682
</xs:sequence>
16831683
</xs:complexType>
16841684
</xs:element>
1685+
<xs:element name="properties" type="bom:propertiesType" minOccurs="0" maxOccurs="1">
1686+
<xs:annotation>
1687+
<xs:documentation>Provides the ability to document properties in a name/value store.
1688+
This provides flexibility to include data not officially supported in the standard
1689+
without having to use additional namespaces or create extensions. Property names
1690+
of interest to the general public are encouraged to be registered in the
1691+
CycloneDX Property Taxonomy - https://github.com/CycloneDX/cyclonedx-property-taxonomy.
1692+
Formal registration is optional.</xs:documentation>
1693+
</xs:annotation>
1694+
</xs:element>
16851695
</xs:sequence>
16861696
<xs:attribute name="type" type="bom:externalReferenceType" use="required">
16871697
<xs:annotation>
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.7.schema.json",
3+
"bomFormat": "CycloneDX",
4+
"specVersion": "1.7",
5+
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
6+
"version": 1,
7+
"components": [
8+
{
9+
"type": "application",
10+
"name": "dummy",
11+
"description": "this component has an external reference with properties",
12+
"externalReferences": [
13+
{
14+
"type": "component-analysis-report",
15+
"url": "http://example.com/extref/component-analysis-report",
16+
"properties": [
17+
{
18+
"name": "author",
19+
"value": "John Doe"
20+
},
21+
{
22+
"name": "timestamp",
23+
"value": "2025-01-27T12:27:26Z"
24+
}
25+
]
26+
}
27+
]
28+
}
29+
]
30+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# proto-file: schema/bom-1.7.proto
2+
# proto-message: Bom
3+
4+
spec_version: "1.7"
5+
version: 1
6+
serial_number: "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79"
7+
components {
8+
type: CLASSIFICATION_APPLICATION
9+
name: "dummy"
10+
description: "this component has an external reference with properties"
11+
external_references {
12+
type: EXTERNAL_REFERENCE_TYPE_COMPONENT_ANALYSIS_REPORT
13+
url: "http://example.com/extref/component-analysis-report"
14+
properties {
15+
name: "author"
16+
value: "John Doe"
17+
}
18+
properties {
19+
name: "timestamp"
20+
value: "2025-01-27T12:27:26Z"
21+
}
22+
}
23+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0"?>
2+
<bom serialNumber="urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79" version="1" xmlns="http://cyclonedx.org/schema/bom/1.7">
3+
<components>
4+
<component type="application">
5+
<name>dummy</name>
6+
<description>this component has an external reference with properties</description>
7+
<externalReferences>
8+
<reference type="component-analysis-report">
9+
<url>http://example.com/extref/component-analysis-report</url>
10+
<properties>
11+
<property name="author">John Doe</property>
12+
<property name="timestamp">2025-01-27T12:27:26Z</property>
13+
</properties>
14+
</reference>
15+
</externalReferences>
16+
</component>
17+
</components>
18+
</bom>

0 commit comments

Comments
 (0)