-
-
Notifications
You must be signed in to change notification settings - Fork 872
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0bf7d38
commit 334071a
Showing
2 changed files
with
149 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/json-schema-secure.json#", | ||
"title": "Meta-schema for the security assessment of JSON Schemas", | ||
"description": "If a JSON Schema fails validation against this meta-schema, it may be unsafe to validate untrusted data", | ||
"definitions": { | ||
"schemaArray": { | ||
"type": "array", | ||
"minItems": 1, | ||
"items": {"$ref": "#"} | ||
} | ||
}, | ||
"allOf": [ | ||
{ | ||
"description": "prevent slow validation of large property names", | ||
"if": { | ||
"required": ["patternProperties"] | ||
}, | ||
"then": { | ||
"required": ["propertyNames"], | ||
"properties": { | ||
"propertyNames": { | ||
"required": ["maxLength"] | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"description": "prevent slow validation of large non-scalar arrays", | ||
"if": { | ||
"required": ["uniqueItems"], | ||
"properties": { | ||
"uniqueItems": {"const": true}, | ||
"type": { | ||
"anyOf": [ | ||
{ | ||
"enum": ["object", "array"] | ||
}, | ||
{ | ||
"type": "array", | ||
"contains": {"enum": ["object", "array"]} | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"then": { | ||
"required": ["maxItems"] | ||
} | ||
}, | ||
{ | ||
"description": "prevent slow validation of large strings", | ||
"if": { | ||
"anyOf": [ | ||
{"required": ["pattern"]}, | ||
{"required": ["format"]} | ||
] | ||
}, | ||
"then": { | ||
"required": ["maxLength"] | ||
} | ||
} | ||
], | ||
"properties": { | ||
"additionalItems": {"$ref": "#"}, | ||
"additionalProperties": {"$ref": "#"}, | ||
"dependencies": { | ||
"additionalProperties": { | ||
"anyOf": [ | ||
{"type": "array"}, | ||
{"$ref": "#"} | ||
] | ||
} | ||
}, | ||
"items": { | ||
"anyOf": [ | ||
{"$ref": "#"}, | ||
{"$ref": "#/definitions/schemaArray"} | ||
] | ||
}, | ||
"definitions": { | ||
"additionalProperties": {"$ref": "#"} | ||
}, | ||
"patternProperties": { | ||
"additionalProperties": {"$ref": "#"} | ||
}, | ||
"properties": { | ||
"additionalProperties": {"$ref": "#"} | ||
}, | ||
"if": {"$ref": "#"}, | ||
"then": {"$ref": "#"}, | ||
"else": {"$ref": "#"}, | ||
"allOf": {"$ref": "#/definitions/schemaArray"}, | ||
"anyOf": {"$ref": "#/definitions/schemaArray"}, | ||
"oneOf": {"$ref": "#/definitions/schemaArray"}, | ||
"not": {"$ref": "#"}, | ||
"contains": {"$ref": "#"}, | ||
"propertyNames": {"$ref": "#"} | ||
} | ||
} |