You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+30-3Lines changed: 30 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@
8
8
9
9
Consider this:
10
10
11
-
```
11
+
```js
12
12
>consta='{"__proto__":{ "b":5}}';
13
13
'{"__proto__":{ "b":5}}'
14
14
@@ -29,9 +29,29 @@ The problem is that `JSON.parse()` retains the `__proto__` property as a plain o
29
29
itself, this is not a security issue. However, as soon as that object is assigned to another or
30
30
iterated on and values copied, the `__proto__` property leaks and becomes the object's prototype.
31
31
32
+
## Install
33
+
```
34
+
npm install secure-json-parse
35
+
```
36
+
37
+
## Usage
38
+
39
+
Pass the option object as a second (or third) parameter for configuring the action to take in case of a bad JSON, if nothing is configured, the default is to throw a `SyntaxError`.<br/>
40
+
You can choose which action to perform in case `__proto__` is present, and in case `constructor` is present.
0 commit comments