
Research
/Security News
9 Malicious NuGet Packages Deliver Time-Delayed Destructive Payloads
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.
@rplan/express-rschema-validation-middleware
Advanced tools
@rplan/express-schema-validation-middleware ===========================================
This module provides a express middleware to validate REST request bodies and parameters against swagger openapi specifications.
Further on it provides functionality to validate REST response bodies against swagger openapi specifications, typically used in rest api tests.
The following example shows how to automatically validate your
request body against the schema specified in docs/private.yaml
import {
OpenApiValidator,
} from '@rplan/express-schema-validation-middleware'
export async function createRestRoute() {
const openApiValidator = await OpenApiValidator('docs/private.yaml')
const validateJSONBody = openApiValidator
.getBodyValidationMiddleware(['/my-route', 'post'])
const router = new Router()
router.post(
'/my-route',
validateJSONBody,
(req, res) => {
const { myValidateProperties } = req.body
// ...
},
)
return router
}
async function getResponseValidator(httpStatusCode) {
const openApiValidator = await OpenApiValidator('docs/private.yaml')
const responseValidator = openApiValidator
.getResponseValidationEndPoint(['/my-route', 'post'])
.validator(httpStatusCode)
return responseValidator
}
// ...
it('should validate response', async () => {
const { body } = await request(testHost)
.post('/my-route')
.send({ someData: 'values' })
.expect(HttpStatusCodes.CREATED)
const validator = await getResponseValidator(HttpStatusCodes.CREATED)
expect(validator.validate({ body }), validator.errors).to.equal(true)
})
The query and params validation middleware returned by
getParamsValidationMiddleware and getQueryValidationMiddleware
seems to not validate types correctly, but just checking for correct
and required property names.
That seems to be a bug in the api-schema-builder npm module.
See skipped tests at ./test/validate-json-schema-middleware.test.js
In opposite to that, the request and response body validators
returned by getBodyValidationMiddleware and getResponseValidationEndPoint
perform a fully functional validation.
FAQs
@rplan/express-schema-validation-middleware ===========================================
The npm package @rplan/express-rschema-validation-middleware receives a total of 0 weekly downloads. As such, @rplan/express-rschema-validation-middleware popularity was classified as not popular.
We found that @rplan/express-rschema-validation-middleware demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 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 researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.