From f3920797f8bc078f22ec207bb7323887b020bb65 Mon Sep 17 00:00:00 2001 From: Mehrn0ush Date: Wed, 11 Nov 2026 16:39:09 +0400 Subject: [PATCH] feat(2.0): add instruments to behavior instances Signed-off-by: Mehrn0ush --- .../cyclonedx-behavior-2.0.schema.json | 9 ++ ...id-behavior-instruments-duplicate-2.0.json | 90 +++++++++++++++++++ ...invalid-behavior-instruments-type-2.0.json | 87 ++++++++++++++++++ .../2.0/valid-behavior-instruments-2.0.json | 90 +++++++++++++++++++ 4 files changed, 276 insertions(+) create mode 100644 tools/src/test/resources/2.0/invalid-behavior-instruments-duplicate-2.0.json create mode 100644 tools/src/test/resources/2.0/invalid-behavior-instruments-type-2.0.json create mode 100644 tools/src/test/resources/2.0/valid-behavior-instruments-2.0.json diff --git a/schema/2.0/modules/cyclonedx-behavior-2.0.schema.json b/schema/2.0/modules/cyclonedx-behavior-2.0.schema.json index 3c21aeba4..e7bc11cbf 100644 --- a/schema/2.0/modules/cyclonedx-behavior-2.0.schema.json +++ b/schema/2.0/modules/cyclonedx-behavior-2.0.schema.json @@ -69,6 +69,15 @@ "items": { "$ref": "cyclonedx-common-2.0.schema.json#/$defs/refLinkType" } + }, + "instruments": { + "type": "array", + "title": "Instruments", + "description": "References using bom-link or `refId` to objects by means of which this behavior is performed, such as the cryptographic key and algorithm used to create a signature. An instrument neither performs the behavior nor is affected by it.", + "uniqueItems": true, + "items": { + "$ref": "cyclonedx-common-2.0.schema.json#/$defs/refLinkType" + } } } }, diff --git a/tools/src/test/resources/2.0/invalid-behavior-instruments-duplicate-2.0.json b/tools/src/test/resources/2.0/invalid-behavior-instruments-duplicate-2.0.json new file mode 100644 index 000000000..08258cc9c --- /dev/null +++ b/tools/src/test/resources/2.0/invalid-behavior-instruments-duplicate-2.0.json @@ -0,0 +1,90 @@ +{ + "$comment": "A build service signs a firmware image. The behavior instance names who signs (actors), what is signed (targets), and the key and algorithm used to sign (instruments).", + "specFormat": "CycloneDX", + "specVersion": "2.0", + "serialNumber": "urn:uuid:c2000000-0000-4000-8000-0000000000b3", + "version": 1, + "definitions": { + "components": [ + { + "type": "cryptographic-asset", + "refId": "alg-ml-dsa-65", + "name": "ML-DSA-65", + "cryptoProperties": { + "assetType": "algorithm", + "algorithmProperties": { + "primitive": "signature", + "algorithmFamily": "ML-DSA", + "parameterSetIdentifier": "65", + "cryptoFunctions": [ + "sign", + "verify" + ] + } + } + }, + { + "type": "cryptographic-asset", + "refId": "key-release-signing", + "name": "Release signing private key", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "private-key", + "keyUsage": [ + "sign" + ], + "relatedCryptographicAssets": [ + { + "type": "algorithm", + "ref": "alg-ml-dsa-65" + } + ] + } + } + } + ] + }, + "blueprints": [ + { + "refId": "bp-signing", + "name": "Firmware release signing", + "modelTypes": [ + "behavioral" + ], + "assets": [ + { + "refId": "asset-build-service", + "type": "service", + "name": "Build service" + }, + { + "refId": "asset-firmware", + "type": "data", + "name": "Firmware image" + } + ], + "behaviors": { + "instances": [ + { + "refId": "bi-sign-firmware", + "behavior": "security:cryptography:signsCode", + "acknowledgment": [ + "declared" + ], + "actors": [ + "asset-build-service" + ], + "targets": [ + "asset-firmware" + ], + "instruments": [ + "key-release-signing", + "key-release-signing" + ] + } + ] + } + } + ] +} diff --git a/tools/src/test/resources/2.0/invalid-behavior-instruments-type-2.0.json b/tools/src/test/resources/2.0/invalid-behavior-instruments-type-2.0.json new file mode 100644 index 000000000..b764a2cf9 --- /dev/null +++ b/tools/src/test/resources/2.0/invalid-behavior-instruments-type-2.0.json @@ -0,0 +1,87 @@ +{ + "$comment": "A build service signs a firmware image. The behavior instance names who signs (actors), what is signed (targets), and the key and algorithm used to sign (instruments).", + "specFormat": "CycloneDX", + "specVersion": "2.0", + "serialNumber": "urn:uuid:c2000000-0000-4000-8000-0000000000b2", + "version": 1, + "definitions": { + "components": [ + { + "type": "cryptographic-asset", + "refId": "alg-ml-dsa-65", + "name": "ML-DSA-65", + "cryptoProperties": { + "assetType": "algorithm", + "algorithmProperties": { + "primitive": "signature", + "algorithmFamily": "ML-DSA", + "parameterSetIdentifier": "65", + "cryptoFunctions": [ + "sign", + "verify" + ] + } + } + }, + { + "type": "cryptographic-asset", + "refId": "key-release-signing", + "name": "Release signing private key", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "private-key", + "keyUsage": [ + "sign" + ], + "relatedCryptographicAssets": [ + { + "type": "algorithm", + "ref": "alg-ml-dsa-65" + } + ] + } + } + } + ] + }, + "blueprints": [ + { + "refId": "bp-signing", + "name": "Firmware release signing", + "modelTypes": [ + "behavioral" + ], + "assets": [ + { + "refId": "asset-build-service", + "type": "service", + "name": "Build service" + }, + { + "refId": "asset-firmware", + "type": "data", + "name": "Firmware image" + } + ], + "behaviors": { + "instances": [ + { + "refId": "bi-sign-firmware", + "behavior": "security:cryptography:signsCode", + "acknowledgment": [ + "declared" + ], + "actors": [ + "asset-build-service" + ], + "targets": [ + "asset-firmware" + ], + "instruments": "key-release-signing" + } + ] + } + } + ] +} diff --git a/tools/src/test/resources/2.0/valid-behavior-instruments-2.0.json b/tools/src/test/resources/2.0/valid-behavior-instruments-2.0.json new file mode 100644 index 000000000..3c091cedf --- /dev/null +++ b/tools/src/test/resources/2.0/valid-behavior-instruments-2.0.json @@ -0,0 +1,90 @@ +{ + "$comment": "A build service signs a firmware image. The behavior instance names who signs (actors), what is signed (targets), and the key and algorithm used to sign (instruments).", + "specFormat": "CycloneDX", + "specVersion": "2.0", + "serialNumber": "urn:uuid:c2000000-0000-4000-8000-0000000000b1", + "version": 1, + "definitions": { + "components": [ + { + "type": "cryptographic-asset", + "refId": "alg-ml-dsa-65", + "name": "ML-DSA-65", + "cryptoProperties": { + "assetType": "algorithm", + "algorithmProperties": { + "primitive": "signature", + "algorithmFamily": "ML-DSA", + "parameterSetIdentifier": "65", + "cryptoFunctions": [ + "sign", + "verify" + ] + } + } + }, + { + "type": "cryptographic-asset", + "refId": "key-release-signing", + "name": "Release signing private key", + "cryptoProperties": { + "assetType": "related-crypto-material", + "relatedCryptoMaterialProperties": { + "type": "private-key", + "keyUsage": [ + "sign" + ], + "relatedCryptographicAssets": [ + { + "type": "algorithm", + "ref": "alg-ml-dsa-65" + } + ] + } + } + } + ] + }, + "blueprints": [ + { + "refId": "bp-signing", + "name": "Firmware release signing", + "modelTypes": [ + "behavioral" + ], + "assets": [ + { + "refId": "asset-build-service", + "type": "service", + "name": "Build service" + }, + { + "refId": "asset-firmware", + "type": "data", + "name": "Firmware image" + } + ], + "behaviors": { + "instances": [ + { + "refId": "bi-sign-firmware", + "behavior": "security:cryptography:signsCode", + "acknowledgment": [ + "declared" + ], + "actors": [ + "asset-build-service" + ], + "targets": [ + "asset-firmware" + ], + "instruments": [ + "key-release-signing", + "alg-ml-dsa-65" + ] + } + ] + } + } + ] +}