Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/supercharge/json
Secure drop-in replacement for the `JSON` global with prototype pollution protection
https://github.com/supercharge/json
json nodejs protection prototype-pollution utility
Last synced: about 2 months ago
JSON representation
Secure drop-in replacement for the `JSON` global with prototype pollution protection
- Host: GitHub
- URL: https://github.com/supercharge/json
- Owner: supercharge
- License: mit
- Created: 2021-08-24T05:55:12.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-06-07T07:51:00.000Z (over 2 years ago)
- Last Synced: 2024-09-30T09:48:20.798Z (3 months ago)
- Topics: json, nodejs, protection, prototype-pollution, utility
- Language: JavaScript
- Homepage:
- Size: 19.5 KB
- Stars: 4
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
JSON
Secure drop-in replacement for the global `JSON` object with prototype pollution protection
Follow @marcuspoehls and @superchargejs for updates!
---
## Introduction
The `@supercharge/json` package is a drop-in replacement for the global `JSON` object. It protects JSON parsing against protoype pollution attacks.## Installation
```
npm i @supercharge/json
```## Usage
Using `@supercharge/json` is pretty straightforward. Use it the same way as you would use the `JSON` object:```js
const JSON = require('@supercharge/json')const user = JSON.parse('{"name":"Supercharge"}')
// { name: 'Supercharge' }const user = JSON.parse('{"name":"Supercharge", "__proto__": { "x": 1 }, "constructor": {"prototype": {"bar": "baz"} } }')
// { name: 'Supercharge' }const json = JSON.stringify({ name: 'Supercharge' })
// '{"name":"Supercharge"}'
```## Contributing
Do you miss a function? We very much appreciate your contribution! Please send in a pull request ๐1. Create a fork
2. Create your feature branch: `git checkout -b my-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request ๐## License
MIT ยฉ [Supercharge](https://superchargejs.com)---
> [superchargejs.com](https://superchargejs.com) ย ยทย
> GitHub [@supercharge](https://github.com/supercharge) ย ยทย
> Twitter [@superchargejs](https://twitter.com/superchargejs)