Add extra safety checks for proto pollution (#20396)

Co-authored-by: Gal Zahavi <38544478+galz10@users.noreply.github.com>
This commit is contained in:
Jacob Richman
2026-03-03 16:21:09 -08:00
committed by GitHub
parent 28af4e127f
commit af424aefa9
2 changed files with 18 additions and 4 deletions

View File

@@ -30,7 +30,7 @@ function mergeRecursively(
for (const key of Object.keys(source)) {
// JSON.parse can create objects with __proto__ as an own property.
// We must skip it to prevent prototype pollution.
if (key === '__proto__') {
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
continue;
}
const srcValue = source[key];