From 70bc8390b7946cce0e8e2118eb68d999a5f69624 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Thu, 10 Sep 2026 13:39:54 +0200 Subject: [PATCH 01/11] tests: lint external schemas Signed-off-by: Jan Kowalleck --- .config/spdx.cdxlintrc.json | 20 ++++++ .github/workflows/lint_external_schemas.yml | 75 +++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 .config/spdx.cdxlintrc.json create mode 100644 .github/workflows/lint_external_schemas.yml diff --git a/.config/spdx.cdxlintrc.json b/.config/spdx.cdxlintrc.json new file mode 100644 index 00000000..f50e2647 --- /dev/null +++ b/.config/spdx.cdxlintrc.json @@ -0,0 +1,20 @@ +{ + "checks": { + "schema-id-filepath": { + "pattern": "^http://cyclonedx\\.org(/schema/.+\\.schema\\.json)$" + }, + "schema-id-pattern": { + "pattern": "^http://cyclonedx\\.org/schema/.*\\.schema\\.json$" + }, + "schema-draft": { + "requiredSchema": "http://json-schema.org/draft-07/schema#" + } + }, + "excludeChecks": [ + "enum-value-formatting", + "meta-enum-full-stop", + "description-oxford-english", + "property-name-american-english", + "schema-comment" + ] +} diff --git a/.github/workflows/lint_external_schemas.yml b/.github/workflows/lint_external_schemas.yml new file mode 100644 index 00000000..0e510760 --- /dev/null +++ b/.github/workflows/lint_external_schemas.yml @@ -0,0 +1,75 @@ +name: CT ExternalSchemas Lint + +on: + push: + branches: ['master', 'main'] + pull_request: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token +permissions: {} + +env: + NODE_VERSION: '24.x' + +jobs: + lint-externals: + timeout-minutes: 10 + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + schema: # path relative to `schema` dir, without suffix `.schema.json` + - 'behavior-taxonomy' + - 'cryptography-defs' + - 'jsf-0.82' + - 'spdx' + name: lint ${{ matrix.schema }} + env: + SCHEMA_FILE: schema/${{ matrix.schema }}.schema.json + CONFIG_FILE: .config/${{ matrix.schema }}.cdxlintrc.json + REPORT_FILE: tools/src/main/js/linter/reports/${{ matrix.schema }}.json + steps: + - name: Checkout repository + # see https://github.com/actions/checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - name: Setup Node.js + # see https://github.com/actions/setup-node + uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + with: + node-version: ${{ env.NODE_VERSION }} + package-manager-cache: false + - name: Install linter + working-directory: tools/src/main/js/linter + run: npm install + - name: Lint schemas + run: | + set -eu + mkdir -p "$(dirname "$REPORT_FILE")" + # only run checks not carried over from source files + node tools/src/main/js/linter/cli.js \ + --format json \ + --config "$CONFIG_FILE" \ + "$SCHEMA_FILE" \ + > "$REPORT_FILE" + - name: Make report relative + if: ${{ !cancelled() }} + run: sed -i "s|${GITHUB_WORKSPACE}/||g" "$REPORT_FILE" + - name: Print report + if: '!cancelled()' + run: cat "$REPORT_FILE" + - name: Artifact report + if: ${{ !cancelled() }} + # https://github.com/actions/upload-artifact + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: report_${{ matrix.schema_version }}-bundled + path: ${{ env.REPORT_FILE }} + if-no-files-found: error + retention-days: 1 From e2753f9371ba5e488bf6d28bcc221c75c691309f Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Thu, 10 Sep 2026 14:46:55 +0200 Subject: [PATCH 02/11] wip Signed-off-by: Jan Kowalleck --- .config/spdx.cdxlintrc.json | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.config/spdx.cdxlintrc.json b/.config/spdx.cdxlintrc.json index f50e2647..409eeb32 100644 --- a/.config/spdx.cdxlintrc.json +++ b/.config/spdx.cdxlintrc.json @@ -1,20 +1,26 @@ { "checks": { "schema-id-filepath": { - "pattern": "^http://cyclonedx\\.org(/schema/.+\\.schema\\.json)$" + "pattern": "^http://cyclonedx\\.org(/schema/[^/]+\\.schema\\.json)$" }, "schema-id-pattern": { - "pattern": "^http://cyclonedx\\.org/schema/.*\\.schema\\.json$" + "pattern": "^http://cyclonedx\\.org/schema/[^/]+\\.schema\\.json$" }, "schema-draft": { "requiredSchema": "http://json-schema.org/draft-07/schema#" + }, + "schema-comment": { + "requiredComment": "/^v\\d.*/i" } }, "excludeChecks": [ + "cdx2-reftype-usage", + "description-oxford-english", "enum-value-formatting", + "enum-value-no-other", "meta-enum-full-stop", - "description-oxford-english", - "property-name-american-english", - "schema-comment" + "model-structure", + "model-property-order", + "property-name-american-english" ] } From 34841253efcbf83772f130135e2ee53a8e91396c Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Thu, 10 Sep 2026 15:37:47 +0200 Subject: [PATCH 03/11] wip Signed-off-by: Jan Kowalleck --- .config/spdx.cdxlintrc.json | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.config/spdx.cdxlintrc.json b/.config/spdx.cdxlintrc.json index 409eeb32..ebc02546 100644 --- a/.config/spdx.cdxlintrc.json +++ b/.config/spdx.cdxlintrc.json @@ -1,16 +1,19 @@ { "checks": { - "schema-id-filepath": { - "pattern": "^http://cyclonedx\\.org(/schema/[^/]+\\.schema\\.json)$" + "formatting-indent": { + "spaces": 2 }, - "schema-id-pattern": { - "pattern": "^http://cyclonedx\\.org/schema/[^/]+\\.schema\\.json$" + "schema-comment": { + "requiredCommentPattern": "^v\\d+\\.\\d+\\-" }, "schema-draft": { "requiredSchema": "http://json-schema.org/draft-07/schema#" }, - "schema-comment": { - "requiredComment": "/^v\\d.*/i" + "schema-id-filepath": { + "pattern": "^http://cyclonedx\\.org(/schema/[^/]+\\.schema\\.json)$" + }, + "schema-id-pattern": { + "pattern": "^http://cyclonedx\\.org/schema/[^/]+\\.schema\\.json$" } }, "excludeChecks": [ From 135ef5b27cedb37874d83494d0d0b883dd6d4438 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Thu, 10 Sep 2026 15:38:23 +0200 Subject: [PATCH 04/11] wip Signed-off-by: Jan Kowalleck --- .config/spdx.cdxlintrc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/spdx.cdxlintrc.json b/.config/spdx.cdxlintrc.json index ebc02546..f17f6697 100644 --- a/.config/spdx.cdxlintrc.json +++ b/.config/spdx.cdxlintrc.json @@ -4,7 +4,7 @@ "spaces": 2 }, "schema-comment": { - "requiredCommentPattern": "^v\\d+\\.\\d+\\-" + "requiredCommentPattern": "^v\\d+\\.\\d+\\-.+$" }, "schema-draft": { "requiredSchema": "http://json-schema.org/draft-07/schema#" From 0dd62e8787cb5df2c256209585afbc976e820064 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Thu, 10 Sep 2026 15:39:30 +0200 Subject: [PATCH 05/11] wip Signed-off-by: Jan Kowalleck --- .config/spdx.cdxlintrc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/spdx.cdxlintrc.json b/.config/spdx.cdxlintrc.json index f17f6697..3228854b 100644 --- a/.config/spdx.cdxlintrc.json +++ b/.config/spdx.cdxlintrc.json @@ -4,7 +4,7 @@ "spaces": 2 }, "schema-comment": { - "requiredCommentPattern": "^v\\d+\\.\\d+\\-.+$" + "requiredCommentPattern": "^v(\\d+\\.\\d+)\\-(.+)$" }, "schema-draft": { "requiredSchema": "http://json-schema.org/draft-07/schema#" From c2d0b78f8a389c54237b1eddba6a83010c4b953f Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Thu, 10 Sep 2026 15:58:05 +0200 Subject: [PATCH 06/11] wip Signed-off-by: Jan Kowalleck --- .config/jsf-0.82.cdxlintrc.json | 32 ++++++++++++++++++++++++++++++++ .config/spdx.cdxlintrc.json | 3 +++ schema/jsf-0.82.schema.json | 4 +++- 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 .config/jsf-0.82.cdxlintrc.json diff --git a/.config/jsf-0.82.cdxlintrc.json b/.config/jsf-0.82.cdxlintrc.json new file mode 100644 index 00000000..5c95ed75 --- /dev/null +++ b/.config/jsf-0.82.cdxlintrc.json @@ -0,0 +1,32 @@ +{ + "NOTE": "This ia a cdxlinter config for file `../schema/jsf-0.82.schema.json`", + "checks": { + "formatting-indent": { + "spaces": 2 + }, + "property-name-american-english": { + "customTerms": ["crv", "kty"] + }, + "schema-comment": { + "requiredCommentPattern": "JSON Signature Format schema is published under the terms of the Apache License 2\\.0\\." + }, + "schema-draft": { + "requiredSchema": "http://json-schema.org/draft-07/schema#" + }, + "schema-id-filepath": { + "pattern": "^http://cyclonedx\\.org(/schema/[^/]+\\.schema\\.json)$" + }, + "schema-id-pattern": { + "pattern": "^http://cyclonedx\\.org/schema/[^/]+\\.schema\\.json$" + } + }, + "excludeChecks": [ + "cdx2-reftype-usage", + "description-oxford-english", + "duplicate-content", + "enum-value-no-other", + "model-structure", + "model-property-order", + "no-must-word" + ] +} diff --git a/.config/spdx.cdxlintrc.json b/.config/spdx.cdxlintrc.json index 3228854b..2341a363 100644 --- a/.config/spdx.cdxlintrc.json +++ b/.config/spdx.cdxlintrc.json @@ -1,4 +1,5 @@ { + "NOTE": "This ia a cdxlinter config for file `../schema/spdx.schema.json`", "checks": { "formatting-indent": { "spaces": 2 @@ -19,11 +20,13 @@ "excludeChecks": [ "cdx2-reftype-usage", "description-oxford-english", + "duplicate-content", "enum-value-formatting", "enum-value-no-other", "meta-enum-full-stop", "model-structure", "model-property-order", + "no-must-word", "property-name-american-english" ] } diff --git a/schema/jsf-0.82.schema.json b/schema/jsf-0.82.schema.json index f46bfb1e..3d866479 100644 --- a/schema/jsf-0.82.schema.json +++ b/schema/jsf-0.82.schema.json @@ -6,10 +6,10 @@ "$comment" : "JSON Signature Format schema is published under the terms of the Apache License 2.0. JSF was developed by Anders Rundgren (anders.rundgren.net@gmail.com) as a part of the OpenKeyStore project. This schema supports the entirely of the JSF standard excluding 'extensions'.", "definitions": { "signature": { - "type": "object", "title": "Signature", "oneOf": [ { + "type": "object", "additionalProperties": false, "properties": { "signers": { @@ -21,6 +21,7 @@ } }, { + "type": "object", "additionalProperties": false, "properties": { "chain": { @@ -124,6 +125,7 @@ "publicKey": { "title": "Public key", "description": "Optional. Public key object.", + "$comment": "This is a mixin - additional properties may be allowed, see the constraints on `kty`.", "type": "object", "required": [ "kty" From f1acce1d2d9d92b2e7981be467e3a9be3aef439f Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Thu, 10 Sep 2026 16:16:33 +0200 Subject: [PATCH 07/11] wip Signed-off-by: Jan Kowalleck --- .config/cryptography-defs.cdxlintrc.json | 32 ++++++++++++++++++++++++ .config/jsf-0.82.cdxlintrc.json | 1 - 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 .config/cryptography-defs.cdxlintrc.json diff --git a/.config/cryptography-defs.cdxlintrc.json b/.config/cryptography-defs.cdxlintrc.json new file mode 100644 index 00000000..91106a83 --- /dev/null +++ b/.config/cryptography-defs.cdxlintrc.json @@ -0,0 +1,32 @@ +{ + "NOTE": "This ia a cdxlinter config for file `../schema/cryptography-defs.schema.json`", + "checks": { + "formatting-indent": { + "spaces": 2 + }, + "property-name-american-english": { + "customTerms": ["enum"] + }, + "schema-comment": { + "requiredCommentPattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$" + }, + "schema-draft": { + "requiredSchema": "http://json-schema.org/draft-07/schema#" + }, + "schema-id-filepath": { + "pattern": "^http://cyclonedx\\.org(/schema/[^/]+\\.schema\\.json)$" + }, + "schema-id-pattern": { + "pattern": "^http://cyclonedx\\.org/schema/[^/]+\\.schema\\.json$" + } + }, + "excludeChecks": [ + "cdx2-reftype-usage", + "description-oxford-english", + "duplicate-content", + "enum-value-formatting", + "enum-value-no-other", + "model-structure", + "model-property-order" + ] +} diff --git a/.config/jsf-0.82.cdxlintrc.json b/.config/jsf-0.82.cdxlintrc.json index 5c95ed75..7863224c 100644 --- a/.config/jsf-0.82.cdxlintrc.json +++ b/.config/jsf-0.82.cdxlintrc.json @@ -24,7 +24,6 @@ "cdx2-reftype-usage", "description-oxford-english", "duplicate-content", - "enum-value-no-other", "model-structure", "model-property-order", "no-must-word" From 32ed4aad12ef34ba7c661afd61172e97e913c8d9 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Thu, 10 Sep 2026 16:17:43 +0200 Subject: [PATCH 08/11] wip Signed-off-by: Jan Kowalleck --- .../{lint_external_schemas.yml => lint_non-core_schemas.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{lint_external_schemas.yml => lint_non-core_schemas.yml} (98%) diff --git a/.github/workflows/lint_external_schemas.yml b/.github/workflows/lint_non-core_schemas.yml similarity index 98% rename from .github/workflows/lint_external_schemas.yml rename to .github/workflows/lint_non-core_schemas.yml index 0e510760..95d22466 100644 --- a/.github/workflows/lint_external_schemas.yml +++ b/.github/workflows/lint_non-core_schemas.yml @@ -1,4 +1,4 @@ -name: CT ExternalSchemas Lint +name: CT Non-Core Schemas Lint on: push: From 736922f2f32f1e4a2074c799cf364e90d4f00bae Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Thu, 10 Sep 2026 16:23:32 +0200 Subject: [PATCH 09/11] wip Signed-off-by: Jan Kowalleck --- .config/behavior-taxonomy.cdxlintrc.json | 25 ++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .config/behavior-taxonomy.cdxlintrc.json diff --git a/.config/behavior-taxonomy.cdxlintrc.json b/.config/behavior-taxonomy.cdxlintrc.json new file mode 100644 index 00000000..a05566a7 --- /dev/null +++ b/.config/behavior-taxonomy.cdxlintrc.json @@ -0,0 +1,25 @@ +{ + "NOTE": "This ia a cdxlinter config for file `../schema/behavior-taxonomy.schema.json`", + "checks": { + "formatting-indent": { + "spaces": 2 + }, + "schema-draft": { + "requiredSchema": "https://json-schema.org/draft/2020-12/schema" + }, + "schema-id-filepath": { + "pattern": "^https://cyclonedx\\.org(/schema/[^/]+\\.schema\\.json)$" + }, + "schema-id-pattern": { + "pattern": "^https://cyclonedx\\.org/schema/[^/]+\\.schema\\.json$" + } + }, + "excludeChecks": [ + "cdx2-reftype-usage", + "description-oxford-english", + "enum-value-formatting", + "model-structure", + "model-property-order", + "property-name-american-english" + ] +} From 4752e32077f59f4be2e507e543b8039a17b299cc Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Thu, 10 Sep 2026 16:30:22 +0200 Subject: [PATCH 10/11] fix Signed-off-by: Jan Kowalleck --- .github/workflows/lint_non-core_schemas.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint_non-core_schemas.yml b/.github/workflows/lint_non-core_schemas.yml index 95d22466..e9e5693f 100644 --- a/.github/workflows/lint_non-core_schemas.yml +++ b/.github/workflows/lint_non-core_schemas.yml @@ -47,7 +47,7 @@ jobs: package-manager-cache: false - name: Install linter working-directory: tools/src/main/js/linter - run: npm install + run: npm ci - name: Lint schemas run: | set -eu @@ -69,7 +69,7 @@ jobs: # https://github.com/actions/upload-artifact uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: - name: report_${{ matrix.schema_version }}-bundled + name: report_${{ matrix.schema }} path: ${{ env.REPORT_FILE }} if-no-files-found: error retention-days: 1 From 48a0c3b24256bca354828af639bb6cebe368ce20 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Thu, 10 Sep 2026 16:34:03 +0200 Subject: [PATCH 11/11] fix Signed-off-by: Jan Kowalleck --- .config/behavior-taxonomy.cdxlintrc.json | 2 +- .config/cryptography-defs.cdxlintrc.json | 2 +- .config/jsf-0.82.cdxlintrc.json | 2 +- .config/spdx.cdxlintrc.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.config/behavior-taxonomy.cdxlintrc.json b/.config/behavior-taxonomy.cdxlintrc.json index a05566a7..067ccaec 100644 --- a/.config/behavior-taxonomy.cdxlintrc.json +++ b/.config/behavior-taxonomy.cdxlintrc.json @@ -1,5 +1,5 @@ { - "NOTE": "This ia a cdxlinter config for file `../schema/behavior-taxonomy.schema.json`", + "$comment": "This ia a cdxlinter config for file `../schema/behavior-taxonomy.schema.json`", "checks": { "formatting-indent": { "spaces": 2 diff --git a/.config/cryptography-defs.cdxlintrc.json b/.config/cryptography-defs.cdxlintrc.json index 91106a83..db44b6fe 100644 --- a/.config/cryptography-defs.cdxlintrc.json +++ b/.config/cryptography-defs.cdxlintrc.json @@ -1,5 +1,5 @@ { - "NOTE": "This ia a cdxlinter config for file `../schema/cryptography-defs.schema.json`", + "$comment": "This ia a cdxlinter config for file `../schema/cryptography-defs.schema.json`", "checks": { "formatting-indent": { "spaces": 2 diff --git a/.config/jsf-0.82.cdxlintrc.json b/.config/jsf-0.82.cdxlintrc.json index 7863224c..f1a2b954 100644 --- a/.config/jsf-0.82.cdxlintrc.json +++ b/.config/jsf-0.82.cdxlintrc.json @@ -1,5 +1,5 @@ { - "NOTE": "This ia a cdxlinter config for file `../schema/jsf-0.82.schema.json`", + "$comment": "This ia a cdxlinter config for file `../schema/jsf-0.82.schema.json`", "checks": { "formatting-indent": { "spaces": 2 diff --git a/.config/spdx.cdxlintrc.json b/.config/spdx.cdxlintrc.json index 2341a363..a3a75df4 100644 --- a/.config/spdx.cdxlintrc.json +++ b/.config/spdx.cdxlintrc.json @@ -1,5 +1,5 @@ { - "NOTE": "This ia a cdxlinter config for file `../schema/spdx.schema.json`", + "$comment": "This ia a cdxlinter config for file `../schema/spdx.schema.json`", "checks": { "formatting-indent": { "spaces": 2