Skip to content

Commit d27a5c3

Browse files
committed
draft: JSON - extraneous comp and version range
related to CycloneDX#321 CycloneDX#321 Signed-off-by: Jan Kowalleck <[email protected]>
1 parent 63e48c4 commit d27a5c3

7 files changed

+110
-1
lines changed

schema/bom-1.6.schema.json

+22-1
Original file line numberDiff line numberDiff line change
@@ -892,6 +892,10 @@
892892
"title": "Component Version",
893893
"description": "The component version. The version should ideally comply with semantic versioning but is not enforced."
894894
},
895+
"versionRange": {
896+
"$ref": "#/definitions/versionRange",
897+
"title": "Component Version Range"
898+
},
895899
"description": {
896900
"type": "string",
897901
"title": "Component Description",
@@ -913,6 +917,12 @@
913917
"description": "Specifies the scope of the component. If scope is not specified, 'required' scope SHOULD be assumed by the consumer of the BOM.",
914918
"default": "required"
915919
},
920+
"isExtraneous": {
921+
"type": "boolean",
922+
"title": "Component Is Extraneous",
923+
"description": "Whether this component is extraneous.\nAn extraneous component is not part of an assembly, but are (expected to be) provided by the environment, regardless of the component's `scope`.",
924+
"default": false
925+
},
916926
"hashes": {
917927
"type": "array",
918928
"title": "Component Hashes",
@@ -1037,7 +1047,18 @@
10371047
"title": "Signature",
10381048
"description": "Enveloped signature in [JSON Signature Format (JSF)](https://cyberphone.github.io/doc/security/jsf.html)."
10391049
}
1040-
}
1050+
},
1051+
"allOf": [
1052+
{
1053+
"$comment": "property `version` and `versionRange` MUST NOT exist at the same time.",
1054+
"not": { "required": ["version", "versionRange"] }
1055+
},
1056+
{
1057+
"$comment": "`version-range` MUST only be present, if `isExtraneous` is `true`",
1058+
"if": { "properties": { "isExtraneous": { "const": false } } },
1059+
"then": { "not": { "required": ["versionRange"] } }
1060+
}
1061+
]
10411062
},
10421063
"swid": {
10431064
"type": "object",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"bomFormat": "CycloneDX",
3+
"specVersion": "1.6",
4+
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
5+
"version": 1,
6+
"components": [
7+
{
8+
"type": "library",
9+
"name": "InvalidVersions",
10+
"description": "may have `version` or `versionRange`, not both. This one does - it is invalid",
11+
"version": "9.0.14",
12+
"versionRange": ">=9.0.0|<10.0.0"
13+
}
14+
]
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"bomFormat": "CycloneDX",
3+
"specVersion": "1.6",
4+
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
5+
"version": 1,
6+
"components": [
7+
{
8+
"type": "library",
9+
"name": "InvalidVersions",
10+
"description": "versionRange may only exist on extraneous components, set `isExtraneous` explicit",
11+
"isExtraneous": false,
12+
"versionRange": ">=9.0.0|<10.0.0"
13+
}
14+
]
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"bomFormat": "CycloneDX",
3+
"specVersion": "1.6",
4+
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
5+
"version": 1,
6+
"components": [
7+
{
8+
"type": "library",
9+
"name": "InvalidVersions",
10+
"description": "versionRange may only exist on extraneous components, set `isExtraneous` implicit by default value",
11+
"versionRange": ">=9.0.0|<10.0.0"
12+
}
13+
]
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"bomFormat": "CycloneDX",
3+
"specVersion": "1.6",
4+
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
5+
"version": 1,
6+
"components": [
7+
{
8+
"type": "library",
9+
"name": "Foo",
10+
"description": "extraneous without any version constraints",
11+
"isExtraneous": true
12+
}
13+
]
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"bomFormat": "CycloneDX",
3+
"specVersion": "1.6",
4+
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
5+
"version": 1,
6+
"components": [
7+
{
8+
"type": "library",
9+
"name": "Foo",
10+
"description": "extraneous with version constraint",
11+
"isExtraneous": true,
12+
"version": "9.1.24"
13+
}
14+
]
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"bomFormat": "CycloneDX",
3+
"specVersion": "1.6",
4+
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
5+
"version": 1,
6+
"components": [
7+
{
8+
"type": "library",
9+
"name": "Foo",
10+
"description": "extraneous with version range constraints",
11+
"isExtraneous": true,
12+
"versionRange": ">=9.0.0|<10.0.0"
13+
}
14+
]
15+
}

0 commit comments

Comments
 (0)