Socket
Socket
Sign inDemoInstall

@glazed/devtools

Package Overview
Dependencies
83
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.5 to 0.1.6

3

dist/validation.d.ts
import type { JSONSchemaType } from 'ajv';
/**
* Seems the secure schema is not strict, this causes warnings to be logged
* Compile the schema from ajv/lib/refs/json-schema-secure.json, copied to avoid JSON import.
* Seems the secure schema is not strict, this causes warnings to be logged.
*

@@ -5,0 +6,0 @@ * @internal */

{
"name": "@glazed/devtools",
"version": "0.1.5",
"version": "0.1.6",
"author": "3Box Labs",

@@ -5,0 +5,0 @@ "license": "(Apache-2.0 OR MIT)",

import Ajv from 'ajv'
import type { JSONSchemaType } from 'ajv'
import addFormats from 'ajv-formats'
import SecureSchema from 'ajv/lib/refs/json-schema-secure.json'
/**
* Seems the secure schema is not strict, this causes warnings to be logged
* Compile the schema from ajv/lib/refs/json-schema-secure.json, copied to avoid JSON import.
* Seems the secure schema is not strict, this causes warnings to be logged.
*
* @internal */
export const validateSchemaSecure = new Ajv({ strict: false }).compile(SecureSchema)
export const validateSchemaSecure = new Ajv({ strict: false }).compile({
$schema: 'http://json-schema.org/draft-07/schema#',
$id: 'https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/json-schema-secure.json#',
title: 'Meta-schema for the security assessment of JSON Schemas',
description:
'If a JSON AnySchema fails validation against this meta-schema, it may be unsafe to validate untrusted data',
definitions: {
schemaArray: {
type: 'array',
minItems: 1,
items: { $ref: '#' },
},
},
dependencies: {
patternProperties: {
description: 'prevent slow validation of large property names',
required: ['propertyNames'],
properties: {
propertyNames: {
required: ['maxLength'],
},
},
},
uniqueItems: {
description: 'prevent slow validation of large non-scalar arrays',
if: {
properties: {
uniqueItems: { const: true },
items: {
properties: {
type: {
anyOf: [
{
enum: ['object', 'array'],
},
{
type: 'array',
contains: { enum: ['object', 'array'] },
},
],
},
},
},
},
},
then: {
required: ['maxItems'],
},
},
pattern: {
description: 'prevent slow pattern matching of large strings',
required: ['maxLength'],
},
format: {
description: 'prevent slow format validation of large strings',
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: '#' },
},
})

@@ -12,0 +100,0 @@ export function isSecureSchema<T = Record<string, any>>(schema: JSONSchemaType<T>): boolean {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc