diff --git a/schema/2.0/model/cyclonedx-common-2.0.schema.json b/schema/2.0/model/cyclonedx-common-2.0.schema.json index 690a8410..09b4da1e 100644 --- a/schema/2.0/model/cyclonedx-common-2.0.schema.json +++ b/schema/2.0/model/cyclonedx-common-2.0.schema.json @@ -949,7 +949,7 @@ "description": "Defines a syntax for representing two character language code (ISO-639) followed by an optional two character country code. The language code must be lower case. If the country code is specified, the country code must be upper case. The language code and country code must be separated by a minus sign. Examples: en, en-US, fr, fr-CA" }, "signatures": { - "$ref": "cyclonedx-jss_X590_2023_10-2.0.schema.json#/$defs/signatures", + "$ref": "cyclonedx-jss_x590_2023_10-2.0.schema.json#/$defs/signatures", "title": "Signatures", "description": "Enveloped signatures in [JSON Signature Scheme (JSS/ITU-T X.590)](https://www.itu.int/epublications/publication/itu-t-x-590-2023-10-json-signature-scheme-jss)." } diff --git a/schema/2.0/model/cyclonedx-jss_X590_2023_10-2.0.schema.json b/schema/2.0/model/cyclonedx-jss_x590_2023_10-2.0.schema.json similarity index 99% rename from schema/2.0/model/cyclonedx-jss_X590_2023_10-2.0.schema.json rename to schema/2.0/model/cyclonedx-jss_x590_2023_10-2.0.schema.json index 6b90fc0e..c8b8064e 100644 --- a/schema/2.0/model/cyclonedx-jss_X590_2023_10-2.0.schema.json +++ b/schema/2.0/model/cyclonedx-jss_x590_2023_10-2.0.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://cyclonedx.org/schema/2.0/model/cyclonedx-jss_X590_2023_10-2.0.schema.json", + "$id": "https://cyclonedx.org/schema/2.0/model/cyclonedx-jss_x590_2023_10-2.0.schema.json", "type": "null", "title": "CycloneDX Model for JSON Signature Scheme (JSS)", "$comment" : "OWASP CycloneDX is an Ecma International standard (ECMA-424) developed in collaboration between the OWASP Foundation and Ecma Technical Committee 54 (TC54). The standard is published under a royalty-free patent policy. This JSON schema is the reference implementation and is licensed under the Apache License 2.0.", diff --git a/tools/src/main/js/linter/checks/schema-id-pattern.check.js b/tools/src/main/js/linter/checks/schema-id-pattern.check.js index 17926937..f99b7535 100644 --- a/tools/src/main/js/linter/checks/schema-id-pattern.check.js +++ b/tools/src/main/js/linter/checks/schema-id-pattern.check.js @@ -1,9 +1,9 @@ /** * CycloneDX Schema Linter - Schema ID Pattern Check - * + * * Validates that the $id property of each modular schema matches * the expected CycloneDX pattern. - * + * * @license Apache-2.0 */ @@ -11,12 +11,12 @@ import { LintCheck, registerCheck, Severity } from '../index.js'; /** * Default pattern for CycloneDX schema IDs - * + * * Valid patterns: * https://cyclonedx.org/schema/bom-1.7.schema.json * https://cyclonedx.org/schema/2.0/cyclonedx-2.0.schema.json * https://cyclonedx.org/schema/2.0/model/cyclonedx-cryptography-2.0.schema.json - * + * * Pattern breakdown: * - Base URL: https://cyclonedx.org/schema/ * - Optional version path: e.g., 2.0/, 1.7/, 3.0/ @@ -24,7 +24,7 @@ import { LintCheck, registerCheck, Severity } from '../index.js'; * - Schema name: e.g., bom-1.7, cyclonedx-2.0, cyclonedx-cryptography-2.0 * - Extension: .schema.json */ -const DEFAULT_PATTERN = '^https://cyclonedx\\.org/schema/(\\d+\\.\\d+/)?([a-z][a-z0-9-]*/)?[a-z][a-z0-9.-]*\\.schema\\.json$'; +const DEFAULT_PATTERN = '^https://cyclonedx\\.org/schema/(\\d+\\.\\d+/)?([a-z][a-z0-9-]*/)?[a-z][a-z0-9_.-]*\\.schema\\.json$'; /** * Check that validates schema $id follows expected pattern @@ -42,7 +42,7 @@ class SchemaIdPatternCheck extends LintCheck { async run(schema, rawContent, config = {}) { const issues = []; const pattern = new RegExp(config.pattern || DEFAULT_PATTERN); - + // Check root $id if (!schema.$id) { issues.push(this.createIssue( @@ -54,13 +54,13 @@ class SchemaIdPatternCheck extends LintCheck { issues.push(this.createIssue( `Schema $id does not match expected pattern. Got: "${schema.$id}"`, '$.$id', - { + { actual: schema.$id, expectedPattern: pattern.toString() } )); } - + // Check for valid $id format (must be a valid URI) if (schema.$id) { try { @@ -73,7 +73,7 @@ class SchemaIdPatternCheck extends LintCheck { )); } } - + // Optionally check for $id in definitions (for modular schemas) if (config.checkDefinitions !== false && schema.definitions) { for (const [defName, def] of Object.entries(schema.definitions)) { @@ -89,7 +89,7 @@ class SchemaIdPatternCheck extends LintCheck { } } } - + // Check $defs (JSON Schema draft-2019-09+) if (config.checkDefinitions !== false && schema.$defs) { for (const [defName, def] of Object.entries(schema.$defs)) { @@ -105,7 +105,7 @@ class SchemaIdPatternCheck extends LintCheck { } } } - + return issues; } }