Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
goodeggs-json-schema-validator
Advanced tools
npm install goodeggs-json-schema-validator
Adds support for these formats:
Simply include the format in your schema:
{"type": "string", "format": "date"}
(Loosely modeled on express-joi-validator.)
When validation fails, uses Boom to wrap errors. Recommended to use Crashpad for passing those errors to the client.
All methods return middleware that can be use()
d or included in a route chain.
validateRequest(field, schema, options)
validates schema against property on request objectvalidateResponse(field, schema, options)
validates schema against property on response objectThe schema
param should be a JSON Schema,
including properties
, required
, etc. Its type
defaults to object
.
Validate URL params:
var expressValidator = require('goodeggs-json-schema-validator/lib/express');
var crashpad = require('crashpad')
app.use(crashpad()); // for responding with structured errors
app.get('/products/:slug',
expressValidator.validateRequest('params', {
type: 'object'
properties: {
'slug': {
type: 'string'
pattern: '^[a-z-]+$'
}
}
}),
function (req, res) {
// ...
}
);
If a request is made to /products/INVALID_123
,
it will fail with statusCode 400
and a body containing message
with a description of the error.
Please follow our Code of Conduct when contributing to this project.
$ git clone https://github.com/goodeggs/goodeggs-json-schema-validator && cd goodeggs-json-schema-validator
$ npm install
$ npm test
FAQs
Good Eggs JSON Schema Validator
The npm package goodeggs-json-schema-validator receives a total of 18 weekly downloads. As such, goodeggs-json-schema-validator popularity was classified as not popular.
We found that goodeggs-json-schema-validator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers 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
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.