Skip to content

Instantly share code, notes, and snippets.

@DaniAkash
Created May 10, 2019 03:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DaniAkash/b3d7159fddcff0a9ee035bd10e34b277 to your computer and use it in GitHub Desktop.
Save DaniAkash/b3d7159fddcff0a9ee035bd10e34b277 to your computer and use it in GitHub Desktop.
a javascript object merge operation vulnerable to prototype pollution
var merge = function(target, source) {
for(var attr in source) {
if(typeof(target[attr]) === "object" && typeof(source[attr]) === "object") {
merge(target[attr], source[attr]);
} else {
target[attr] = source[attr];
}
}
return target;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment