Skip to content

Commit

Permalink
fix: prototype pollution vulnerability in extend (CVE-2024-45435)
Browse files Browse the repository at this point in the history
  • Loading branch information
andersk committed Oct 2, 2024
1 parent 1067900 commit 17cffef
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/utils/extend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ export function extend(target: any = {}, ...sources: any[]) {
for (let i = 0; i < sources.length; i++) {
const source = sources[i];
for (const prop in source) {
if (
prop in target &&
!Object.prototype.hasOwnProperty.call(target, prop)
) {
continue; // prevent prototype pollution
}
const sourceProp = source[prop];
if (
typeof sourceProp === 'object' &&
Expand Down

0 comments on commit 17cffef

Please sign in to comment.