Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
@cfworker/json-schema
Advanced tools
A JSON schema validator that will run on Cloudflare workers. Supports drafts 4, 7, and 2019-09.
A JSON schema validator that will run on Cloudflare workers. Supports drafts 4, 7, and 2019-09.
Why another JSON schema validator?
Cloudflare workers do not have APIs required by Ajv schema compilation (eval
or new Function(code)
).
If possible use Ajv in a build step to precompile your schema. Otherwise use this library.
Basic
import { Validator } from '@cfworker/json-schema';
const validator = new Validator({ type: 'number' });
const result = validator.validate(7);
Specify meta schema draft
const validator = new Validator({ type: 'number' }, '4'); // draft-4
Add schemas
const validator = new Validator({
$id: 'https://foo.bar/baz',
$ref: '/beep'
});
validator.addSchema({ $id: 'https://foo.bar/beep', type: 'boolean' });
Include all errors By default the validator will stop processing an object or array after the first error. Specifying shortCircuit to false will produce all errors.
const validator = new Validator(
{
type: 'object',
properties: {
name: { type: 'string' },
email: { type: 'string' },
number: { type: 'number' },
required: ['name', 'email', 'number']
}
},
'2019-09',
false
);
const result = validator.validate({
name: 'hello',
email: 5, //invalid type
number: 'Hello' //invalid type
});
FAQs
A JSON schema validator that will run on Cloudflare workers. Supports drafts 4, 7, 2019-09, and 2020-12.
We found that @cfworker/json-schema demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.