Skip to content

Commit

Permalink
fix(prototype): prevent prototype pollution
Browse files Browse the repository at this point in the history
  • Loading branch information
jonluca committed Mar 5, 2024
1 parent b93e3a2 commit 8cad7f7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ export type ParserOptions = DeepPartial<$RefParserOptions>;
*/
function merge(target: any, source: any) {
if (isMergeable(source)) {
const keys = Object.keys(source);
// prevent prototype pollution
const keys = Object.keys(source).filter((key) => !["__proto__", "constructor", "prototype"].includes(key));
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
const sourceSetting = source[key];
Expand Down

0 comments on commit 8cad7f7

Please sign in to comment.