Skip to content

Commit ff1d9d8

Browse files
authored
fix: deny modifying the object prototype
1 parent 837a3cc commit ff1d9d8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/shared/object.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function deepAssign<T, S>(target: T, source: S): T & S;
1414
export function deepAssign<S>(target: {}, source: S): S;
1515
export function deepAssign(target: any, ...sources: any[]): any {
1616
sources.forEach((source) => {
17-
Object.getOwnPropertyNames(source).forEach((key) => assign(key, target, source));
17+
Object.getOwnPropertyNames(source).forEach((key) => !["__proto__", "constructor", "prototype"].includes(key) && assign(key, target, source));
1818
/* istanbul ignore next */
1919
if (Object.getOwnPropertySymbols) {
2020
Object.getOwnPropertySymbols(source).forEach((key) => assign(key, target, source));

0 commit comments

Comments
 (0)