You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

@hapi/bourne

Package Overview
Dependencies
0
Maintainers
6
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hapi/bourne

JSON parse with prototype poisoning protection


Version published
Maintainers
6
Created

Package description

What is @hapi/bourne?

@hapi/bourne is a JSON parser that is designed to be secure by preventing prototype pollution attacks. It is a part of the hapi ecosystem and focuses on safely parsing JSON strings.

What are @hapi/bourne's main functionalities?

Safe JSON Parsing

This feature allows you to safely parse JSON strings into JavaScript objects, ensuring that the parsed object does not contain any prototype pollution.

const Bourne = require('@hapi/bourne');
const jsonString = '{"key":"value"}';
const parsedObject = Bourne.parse(jsonString);
console.log(parsedObject); // { key: 'value' }

Handling Malicious JSON

This feature demonstrates how @hapi/bourne handles potentially malicious JSON strings that attempt to pollute the prototype. The parser ensures that such attempts are neutralized.

const Bourne = require('@hapi/bourne');
const maliciousJsonString = '{"__proto__":{"polluted":"yes"}}';
const parsedObject = Bourne.parse(maliciousJsonString);
console.log(parsedObject.polluted); // undefined

Other packages similar to @hapi/bourne

Readme

Source

@hapi/bourne

JSON.parse() drop-in replacement with prototype poisoning protection.

bourne is part of the hapi ecosystem and was designed to work seamlessly with the hapi web framework and its other components (but works great on its own or with other frameworks). If you are using a different web framework and find this module useful, check out hapi – they work even better together.

Visit the hapi.dev Developer Portal for tutorials, documentation, and support

Useful resources

Keywords

FAQs

Package last updated on 03 May 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc