Skip to content
Open
Changes from all commits
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
9 changes: 8 additions & 1 deletion packages/angular_devkit/core/src/utils/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,18 @@ export function deepCopy<T>(value: T): T {

const copy = Object.create(Object.getPrototypeOf(valueCasted));
valueCasted[copySymbol] = copy;

for (const key of Object.getOwnPropertyNames(valueCasted)) {
// 🛡️ SECURITY CHECK FIRST: Block prototype pollution keys
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
continue;
}

// Now it is safe to copy
copy[key] = deepCopy(valueCasted[key]);
}

delete valueCasted[copySymbol];

return copy;
} else {
return value;
Expand Down
Loading