Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch fixes prototype pollution issue #17 #19

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
actually modify the key value
Tom Harrison committed Jan 14, 2022
commit af6fadd1b79c3d0f9a4c4eb46849c3869d3ba7e2
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -62,7 +62,9 @@ exports.parse = function(str){
var key = decode(parts[0]);
var m;
// Sanitize keys to uppercase to mitigate client-side prototype pollution
key && ["__proto__", "constructor", "prototype"].includes(key.toLowerCase()) ? key.toUpperCase() : key
if (key && ["__proto__", "constructor", "prototype"].includes(key.toLowerCase())) {
key = key.toUpperCase()
}

if (m = pattern.exec(key)) {
obj[m[1]] = obj[m[1]] || [];