json-schema-secure.json 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. {
  2. "$schema": "http://json-schema.org/draft-07/schema#",
  3. "$id": "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/json-schema-secure.json#",
  4. "title": "Meta-schema for the security assessment of JSON Schemas",
  5. "description": "If a JSON AnySchema fails validation against this meta-schema, it may be unsafe to validate untrusted data",
  6. "definitions": {
  7. "schemaArray": {
  8. "type": "array",
  9. "minItems": 1,
  10. "items": {"$ref": "#"}
  11. }
  12. },
  13. "dependencies": {
  14. "patternProperties": {
  15. "description": "prevent slow validation of large property names",
  16. "required": ["propertyNames"],
  17. "properties": {
  18. "propertyNames": {
  19. "required": ["maxLength"]
  20. }
  21. }
  22. },
  23. "uniqueItems": {
  24. "description": "prevent slow validation of large non-scalar arrays",
  25. "if": {
  26. "properties": {
  27. "uniqueItems": {"const": true},
  28. "items": {
  29. "properties": {
  30. "type": {
  31. "anyOf": [
  32. {
  33. "enum": ["object", "array"]
  34. },
  35. {
  36. "type": "array",
  37. "contains": {"enum": ["object", "array"]}
  38. }
  39. ]
  40. }
  41. }
  42. }
  43. }
  44. },
  45. "then": {
  46. "required": ["maxItems"]
  47. }
  48. },
  49. "pattern": {
  50. "description": "prevent slow pattern matching of large strings",
  51. "required": ["maxLength"]
  52. },
  53. "format": {
  54. "description": "prevent slow format validation of large strings",
  55. "required": ["maxLength"]
  56. }
  57. },
  58. "properties": {
  59. "additionalItems": {"$ref": "#"},
  60. "additionalProperties": {"$ref": "#"},
  61. "dependencies": {
  62. "additionalProperties": {
  63. "anyOf": [{"type": "array"}, {"$ref": "#"}]
  64. }
  65. },
  66. "items": {
  67. "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}]
  68. },
  69. "definitions": {
  70. "additionalProperties": {"$ref": "#"}
  71. },
  72. "patternProperties": {
  73. "additionalProperties": {"$ref": "#"}
  74. },
  75. "properties": {
  76. "additionalProperties": {"$ref": "#"}
  77. },
  78. "if": {"$ref": "#"},
  79. "then": {"$ref": "#"},
  80. "else": {"$ref": "#"},
  81. "allOf": {"$ref": "#/definitions/schemaArray"},
  82. "anyOf": {"$ref": "#/definitions/schemaArray"},
  83. "oneOf": {"$ref": "#/definitions/schemaArray"},
  84. "not": {"$ref": "#"},
  85. "contains": {"$ref": "#"},
  86. "propertyNames": {"$ref": "#"}
  87. }
  88. }