Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 19 additions & 29 deletions schema/2.0/model/cyclonedx-formulation-2.0.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -686,21 +686,8 @@
},
"environmentVars": {
"title": "Environment variables",
"description": "Inputs that have the form of parameters with names and values.",
"type": "array",
"uniqueItems": true,
"items": {
"oneOf": [
{
"$ref": "cyclonedx-common-2.0.schema.json#/$defs/property"
},
{
"type": "string",
"title": "String-Based Environment Variables",
"description": "In addition to the more common key–value pair format, some environment variables may consist of a single string without an explicit value assignment. These string-based environment variables typically act as flags or signals to software, indicating that a feature should be enabled, a mode should be activated, or a specific condition is present. Their presence alone conveys meaning."
}
]
}
"description": "Inputs that have the form of environment variables.",
"$ref": "#/$defs/environmentVars"
},
"data": {
"title": "Data",
Expand Down Expand Up @@ -772,20 +759,7 @@
"environmentVars": {
"title": "Environment variables",
"description": "Outputs that have the form of environment variables.",
"type": "array",
"items": {
"oneOf": [
{
"$ref": "cyclonedx-common-2.0.schema.json#/$defs/property"
},
{
"type": "string",
"title": "String-Based Environment Variables",
"description": "In addition to the more common key–value pair format, some environment variables may consist of a single string without an explicit value assignment. These string-based environment variables typically act as flags or signals to software, indicating that a feature should be enabled, a mode should be activated, or a specific condition is present. Their presence alone conveys meaning."
}
]
},
"uniqueItems": true
"$ref": "#/$defs/environmentVars"
},
"properties": {
"$ref": "cyclonedx-common-2.0.schema.json#/$defs/properties"
Expand Down Expand Up @@ -895,6 +869,22 @@
"type": "string"
}
}
},
"environmentVars": {
"title": "Environment variables",
"description": "A map of environment variable names to values.\n\nKeys are environment variable names and are intentionally unconstrained by this schema (including names that may be empty or start with non-alphabetic characters).\n\nValues must be either a `string` or `null`:\n- `null` means the variable is absent/unset.\n- `\"\"` (empty string) is a valid, explicit value and does not mean absent.",
"$comment": "While some systems may have restrictions on env var names, others may have not. See this test: `env '=empty-name' '0trust=starts-with-number' python -c 'import os;print(repr(os.environ))'`",
"type": "object",
"additionalProperties": {
"description": "Values must be either a `string` or `null`:\n- `null` means the variable is absent/unset.\n- `\"\"` (empty string) is a valid, explicit value and does not mean absent.",
"type": ["string", "null"]
},
"examples": [
{ "LC_ALL": null, "LANG": "en_US.UTF-8" },
{ "MY_FLAG": "1" },
{ "0TRUST": "true" },
{ "": "" }
]
}
}
}
276 changes: 276 additions & 0 deletions tools/src/test/resources/2.0/invalid-formulation-envVars-2.0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,276 @@
{
"$schema": "https://cyclonedx.org/schema/2.0/cyclonedx-2.0.schema.json",
"specFormat": "CycloneDX",
"specVersion": "2.0",
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
"version": 1,
"components": [
{
"type": "library",
"parties": [
{
"roles": [ { "role": "publisher" } ],
"organization": { "name": "Acme Inc" }
}
],
"group": "org.example",
"name": "mylibrary",
"version": "1.0.0"
}
],
"formulation": [
{
"bom-ref": "formula-1",
"components": [
{
"bom-ref": "component-1",
"type": "platform",
"name": "Pipeline controller image",
"version": "v0.47.0"
}
],
"workflows": [
{
"inputs": [
{
"environmentVars": {
"LC": { "ALL": null },
"AMOUNT": 2,
"0TRUST": true
}
},
{
"environmentVars": "LANG='en_US.UTF-8' 0TRUST='true' MY_FLAG=''"
},
{
"environmentVars": "$env:LANG=\"en_US.UTF-8\"; Set-Item Env:0TRUST \"true\"; $env:MY_FLAG=\"\""
},
{
"environmentVars": "set \"LANG=en_US.UTF-8\" && set \"0TRUST=true\" && set \"MY_FLAG=\""
}
],
"bom-ref": "workflow-1",
"uid": "8edb2b08-e2c7-11ed-b5ea-0242ac120002",
"name": "My workflow",
"description": "Workflow description here",
"resourceReferences": [
{
"ref": "component-a"
}
],
"tasks": [
{
"bom-ref": "task-1",
"uid": "task-uid-1",
"name": "fetch-repository",
"description": "Description here",
"resourceReferences": [
{
"ref": "component-a"
}
],
"taskTypes": [
"clone",
"build"
],
"trigger": {
"bom-ref": "trigger-1",
"uid": "trigger-1",
"type": "api"
},
"steps": [
{
"name": "My step"
}
],
"inputs": [
{
"resource": {
"ref": "component-a"
}
}
],
"outputs": [
{
"resource": {
"ref": "component-b"
}
}
],
"timeStart": "2023-01-01T00:00:00+00:00",
"timeEnd": "2023-01-01T00:00:00+00:00",
"workspaces": [
{
"bom-ref": "workspace-1",
"uid": "workspace-uid-1",
"name": "workspace"
}
],
"runtimeTopology": [
{
"ref": "task-1",
"dependsOn": ["task-2"]
}
]
}
],
"taskDependencies": [
{
"ref": "task-1",
"dependsOn": ["task-2"]
}
],
"taskTypes": [
"clone",
"build"
],
"trigger": {
"bom-ref": "trigger-2",
"uid": "trigger-uid-2",
"name": "My trigger",
"description": "Description here",
"resourceReferences": [
{
"ref": "component-a"
}
],
"type": "api",
"event": {
"uid": "event-1",
"description": "Description here",
"timeReceived": "2023-01-01T00:00:00+00:00",
"data": {
"mediaType": "text/plain",
"content": "Foo/Bar"
},
"source": {
"ref": "component-g"
},
"target": {
"ref": "component-h"
},
"properties": [
{
"name": "Foo",
"value": "Bar"
}
]
},
"conditions": [
{
"description": "Description here",
"expression": "1 == 1",
"properties": [
{
"name": "Foo",
"value": "Bar"
}
]
}
],
"timeActivated": "2023-01-01T00:00:00+00:00",
"inputs": [
{
"resource": {
"ref": "component-10"
},
"source": {
"ref": "component-11"
},
"target": {
"ref": "component-12"
}
}
],
"outputs": [
{
"resource": {
"ref": "component-14"
},
"type": "artifact",
"source": {
"ref": "component-15"
},
"target": {
"ref": "component-16"
}
}
],
"properties": [
{
"name": "Foo",
"value": "Bar"
}
]
},
"steps": [
{
"name": "My step",
"description": "Description here",
"commands": [
{
"executed": "ls -las",
"properties": [
{
"name": "Foo",
"value": "Bar"
}
]
}
],
"properties": [
{
"name": "Foo",
"value": "Bar"
}
]
}
],
"timeStart": "2023-01-01T00:00:00+00:00",
"timeEnd": "2023-01-01T00:00:10+00:00",
"workspaces": [
{
"bom-ref": "workspace-2",
"uid": "workspace-1",
"name": "My workspace",
"aliases": ["default-workspace"],
"description": "Description here",
"resourceReferences": [
{
"ref": "component-t"
}
],
"accessMode": "read-write",
"mountPath": "/tmp/workspace",
"managedDataType": "ConfigMap",
"volumeRequest": "requestedVolumeClaim",
"volume": {
"uid": "volume-1",
"name": "My volume",
"mode": "filesystem",
"path": "/",
"sizeAllocated": "10GB",
"persistent": true,
"remote": false
}
}
],
"runtimeTopology": [
{
"ref": "component-s",
"dependsOn": [
"component-r"
]
}
],
"properties": [
{
"name": "Foo",
"value": "Bar"
}
]
}
]
}
]
}
Loading
Loading