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.
import { Validator } from '@cfworker/json-schema';
const validator = new Validator({ type: 'number' });
const result = validator.validate(7);
const validator = new Validator({ type: 'number' }, '4'); // draft-4
const validator = new Validator({
$id: 'https://foo.bar/baz',
$ref: '/beep'
});
validator.addSchema({ $id: 'https://foo.bar/beep', type: 'boolean' });
By default the validator stops processing after the first error. Set the shortCircuit
parameter to false
to emit all errors.
const shortCircuit = false;
const draft = '2019-09';
const schema = {
type: 'object',
required: ['name', 'email', 'number', 'bool'],
properties: {
name: { type: 'string' },
email: { type: 'string', format: 'email' },
number: { type: 'number' },
bool: { type: 'boolean' }
}
};
const validator = new Validator(schema, draft, shortCircuit);
const result = validator.validate({
name: 'hello',
email: 5, // invalid type
number: 'Hello' // invalid type
bool: 'false' // invalid type
});
FAQs
A JSON schema validator that will run on Cloudflare workers. Supports drafts 4, 7, 2019-09, and 2020-12.
The npm package @cfworker/json-schema receives a total of 73,606 weekly downloads. As such, @cfworker/json-schema popularity was classified as popular.
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.