mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
JS: Proto pollution: Add is-plain-object sanitizer
This commit is contained in:
@@ -462,3 +462,14 @@ function copyUsingUnderscoreOrLodash(dst, src) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
let isPlainObject = require('is-plain-object');
|
||||
function copyPlainObject(dst, src) {
|
||||
for (let key in src) {
|
||||
if (dst[key] && isPlainObject(src)) {
|
||||
copyPlainObject(dst[key], src[key]);
|
||||
} else {
|
||||
dst[key] = src[key]; // OK
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user