Skip to content

Commit 8cad7f7

Browse files
committed
fix(prototype): prevent prototype pollution
1 parent b93e3a2 commit 8cad7f7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/options.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ export type ParserOptions = DeepPartial<$RefParserOptions>;
182182
*/
183183
function merge(target: any, source: any) {
184184
if (isMergeable(source)) {
185-
const keys = Object.keys(source);
185+
// prevent prototype pollution
186+
const keys = Object.keys(source).filter((key) => !["__proto__", "constructor", "prototype"].includes(key));
186187
for (let i = 0; i < keys.length; i++) {
187188
const key = keys[i];
188189
const sourceSetting = source[key];

0 commit comments

Comments
 (0)