How to use the @hapi/bourne.scan function in @hapi/bourne

To help you get started, we’ve selected a few @hapi/bourne examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Asymmetrik / node-fhir-server-core / src / server / utils / prototype-injection-handler.utils.js View on Github external
module.exports = prototypeInjectionHandler = (req, res, next) => {
	try {
		if (req.body && typeof req.body === 'object') {
			Bourne.scan(req.body);
		}
		next();
	} catch (error) {
		let OperationOutcome = require(resolveSchema('3_0_1', 'operationoutcome'));
		let err = new OperationOutcome({
			statusCode: 400,
			issue: [
				{
					severity: 'error',
					code: 'invalid',
					details: {
						text: error.message,
					},
				},
			],
		});

@hapi/bourne

JSON parse with prototype poisoning protection

BSD-3-Clause
Latest version published 3 years ago

Package Health Score

77 / 100
Full package analysis

Popular @hapi/bourne functions