Skip to content

Commit ecd4f22

Browse files
committed
chore: harden schema validators
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
1 parent b29918c commit ecd4f22

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

tools/src/test/js/json-schema-functional-tests.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ const ajv = new Ajv({
5656
strict: false,
5757
validateFormats: true,
5858
addUsedSchema: false,
59+
loadSchema: (uri) => { throw new Error(`Remote schemas are disabled: ${uri}`) },
5960
schemas: {
6061
'http://cyclonedx.org/schema/spdx.schema.json': spdxSchema,
6162
'http://cyclonedx.org/schema/jsf-0.82.schema.json': jsfSchema,

tools/src/test/js/json-schema-lint-tests.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ function getAjv(strict) {
5252
addUsedSchema: false,
5353
allowUnionTypes: false,
5454
keywords: ["meta:enum"],
55+
loadSchema: (uri) => { throw new Error(`Remote schemas are disabled: ${uri}`) },
5556
schemas: {
5657
'http://cyclonedx.org/schema/spdx.schema.json': spdxSchema,
5758
'http://cyclonedx.org/schema/jsf-0.82.schema.json': jsfSchema,

0 commit comments

Comments
 (0)