Skip to content

Commit b057b1b

Browse files
Merge pull request #33 from ready-research/ready-research-Prototype-Pollution
Security Fix for Prototype Pollution
2 parents 010f017 + 383b72d commit b057b1b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ const isUnsafeKey = key => {
1818
};
1919

2020
const validateKey = key => {
21+
if (typeof key !== 'string' && typeof key !== 'number') {
22+
key = String(key)
23+
}
2124
if (isUnsafeKey(key)) {
2225
throw new Error(`Cannot set unsafe key: "${key}"`);
2326
}

0 commit comments

Comments
 (0)