Skip to content

Commit 4188c02

Browse files
committed
Fix prototype pollution vulerability
1 parent f3e8232 commit 4188c02

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,10 @@ const applySegment = (value, segment, cursor = "") => {
314314
throw TypeError(`Value at '${cursor}' is a ${typeof value} and does not have property '${segment}'`);
315315
} else {
316316
const computedSegment = computeSegment(value, segment);
317-
// value could also be an array, but this appeases the type system
318-
return /** @type API.JsonObject */ (value)[computedSegment];
317+
if (Object.hasOwn(value, computedSegment)) {
318+
// value could also be an array, but this appeases the type system
319+
return /** @type API.JsonObject */ (value)[computedSegment];
320+
}
319321
}
320322
};
321323

0 commit comments

Comments
 (0)