diff --git a/schema/bom-1.6.schema.json b/schema/bom-1.6.schema.json index 695b1d2d..3765d4da 100644 --- a/schema/bom-1.6.schema.json +++ b/schema/bom-1.6.schema.json @@ -2218,6 +2218,9 @@ "type": "object", "title": "Lightweight name-value pair", "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.", + "required": [ + "name" + ], "properties": { "name": { "type": "string", @@ -2229,7 +2232,8 @@ "title": "Value", "description": "The value of the property." } - } + }, + "additionalProperties": false }, "localeType": { "type": "string", diff --git a/tools/src/test/resources/1.6/invalid-properties-1.6.json b/tools/src/test/resources/1.6/invalid-properties-1.6.json new file mode 100644 index 00000000..06985035 --- /dev/null +++ b/tools/src/test/resources/1.6/invalid-properties-1.6.json @@ -0,0 +1,68 @@ +{ + "bomFormat": "CycloneDX", + "specVersion": "1.6", + "serialNumber": "urn:uuid:bcb403ae-91fa-436e-bc93-84d1078cdeed", + "version": 1, + "metadata": { + "properties": [ + { + "value": "missing a name" + }, + { + "unexpected-property": "foo" + }, + {} + ] + }, + "components": [ + { + "type": "library", + "name": "acme-library", + "version": "1.0.0", + "licenses": [ + { + "license": { + "id": "Apache-2.0", + "properties": [ + { + "value": "missing a name" + }, + { + "unexpected-property": "foo" + }, + {} + ] + } + } + ], + "properties": [ + { + "value": "missing a name" + }, + { + "unexpected-property": "foo" + }, + {} + ] + } + ], + "services": [ + { + "bom-ref": "b2a46a4b-8367-4bae-9820-95557cfe03a8", + "group": "org.partner", + "name": "Stock ticker service", + "endpoints": [ + "https://partner.org/api/v1/stock" + ], + "properties": [ + { + "value": "missing a name" + }, + { + "unexpected-property": "foo" + }, + {} + ] + } + ] +} diff --git a/tools/src/test/resources/1.6/invalid-properties-1.6.textproto b/tools/src/test/resources/1.6/invalid-properties-1.6.textproto new file mode 100644 index 00000000..9afebf51 --- /dev/null +++ b/tools/src/test/resources/1.6/invalid-properties-1.6.textproto @@ -0,0 +1,45 @@ +spec_version: "1.6" +version: 1 +serial_number: "urn:uuid:bcb403ae-91fa-436e-bc93-84d1078cdeed" +metadata { + properties { + value: "missing a name" + } + properties { + # no name and no value + } +} +components { + type: CLASSIFICATION_LIBRARY + name: "acme-library" + version: "1.0.0" + licenses { + license { + id: "Apache-2.0" + properties { + value: "missing a name" + } + properties { + # no name and no value + } + } + } + properties { + value: "missing a name" + } + properties { + # no name and no value + } +} +services { + bom_ref: "b2a46a4b-8367-4bae-9820-95557cfe03a8" + group: "org.partner" + name: "Stock ticker service" + endpoints: "https://partner.org/api/v1/stock" + properties { + value: "missing a name" + } + properties { + # no name and no value + } +} diff --git a/tools/src/test/resources/1.6/invalid-properties-1.6.xml b/tools/src/test/resources/1.6/invalid-properties-1.6.xml new file mode 100644 index 00000000..9c54127f --- /dev/null +++ b/tools/src/test/resources/1.6/invalid-properties-1.6.xml @@ -0,0 +1,41 @@ + + + + + missing a name + + + + + + acme-library + 1.0.0 + + + Apache-2.0 + + missing a name + + + + + + missing a name + + + + + + + org.partner + Stock ticker service + + https://partner.org/api/v1/stock + + + missing a name + + + + + diff --git a/tools/src/test/resources/1.6/valid-properties-1.6.json b/tools/src/test/resources/1.6/valid-properties-1.6.json index 237f7fe2..68c47f86 100644 --- a/tools/src/test/resources/1.6/valid-properties-1.6.json +++ b/tools/src/test/resources/1.6/valid-properties-1.6.json @@ -9,10 +9,6 @@ "name": "Foo", "value": "Bar" }, - { - "name": "Foo", - "value": "You" - }, { "name": "Foo", "value": "Two" @@ -20,6 +16,9 @@ { "name": "Bar", "value": "Foo" + }, + { + "name": "value-is-optional" } ] }, @@ -37,10 +36,6 @@ "name": "Foo", "value": "Bar" }, - { - "name": "Foo", - "value": "You" - }, { "name": "Foo", "value": "Two" @@ -48,6 +43,9 @@ { "name": "Bar", "value": "Foo" + }, + { + "name": "value-is-optional" } ] } @@ -57,6 +55,17 @@ { "name": "Foo", "value": "Bar" + }, + { + "name": "Foo", + "value": "Two" + }, + { + "name": "Bar", + "value": "Foo" + }, + { + "name": "value-is-optional" } ] } @@ -73,6 +82,17 @@ { "name": "Foo", "value": "Bar" + }, + { + "name": "Foo", + "value": "Two" + }, + { + "name": "Bar", + "value": "Foo" + }, + { + "name": "value-is-optional" } ] } diff --git a/tools/src/test/resources/1.6/valid-properties-1.6.textproto b/tools/src/test/resources/1.6/valid-properties-1.6.textproto index 43779985..3f1c2ac6 100644 --- a/tools/src/test/resources/1.6/valid-properties-1.6.textproto +++ b/tools/src/test/resources/1.6/valid-properties-1.6.textproto @@ -6,10 +6,6 @@ metadata { name: "Foo" value: "Bar" } - properties { - name: "Foo" - value: "You" - } properties { name: "Foo" value: "Two" @@ -18,6 +14,9 @@ metadata { name: "Bar" value: "Foo" } + properties { + name: "value-is-optional" + } } components { type: CLASSIFICATION_LIBRARY @@ -30,10 +29,6 @@ components { name: "Foo" value: "Bar" } - properties { - name: "Foo" - value: "You" - } properties { name: "Foo" value: "Two" @@ -42,12 +37,26 @@ components { name: "Bar" value: "Foo" } + properties { + name: "value-is-optional" + } } } properties { name: "Foo" value: "Bar" } + properties { + name: "Foo" + value: "Two" + } + properties { + name: "Bar" + value: "Foo" + } + properties { + name: "value-is-optional" + } } services { bom_ref: "b2a46a4b-8367-4bae-9820-95557cfe03a8" @@ -58,4 +67,15 @@ services { name: "Foo" value: "Bar" } + properties { + name: "Foo" + value: "Two" + } + properties { + name: "Bar" + value: "Foo" + } + properties { + name: "value-is-optional" + } } diff --git a/tools/src/test/resources/1.6/valid-properties-1.6.xml b/tools/src/test/resources/1.6/valid-properties-1.6.xml index 32cd224c..ac03d4b8 100644 --- a/tools/src/test/resources/1.6/valid-properties-1.6.xml +++ b/tools/src/test/resources/1.6/valid-properties-1.6.xml @@ -3,9 +3,9 @@ Bar - You Two Foo + @@ -17,15 +17,17 @@ Apache-2.0 Bar - You Two Foo + Bar + Two Foo + @@ -38,7 +40,9 @@ Bar + Two Foo +