Skip to content

Commit 5fcca83

Browse files
committed
lib: make primordials.PromisePrototypeCatch safe
`catch` method on %Promise.prototype% looks up the `then` property of the instance, making it at risk of prototype pollution.
1 parent 7c8a608 commit 5fcca83

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/internal/per_context/primordials.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,9 @@ function copyPrototype(src, dest, prefix) {
244244
copyPrototype(original.prototype, primordials, `${name}Prototype`);
245245
});
246246

247+
primordials.PromisePrototypeCatch = (thisPromise, onRejected) =>
248+
primordials.PromisePrototypeThen(thisPromise, undefined, onRejected);
249+
247250
/* eslint-enable node-core/prefer-primordials */
248251

249252
const {

0 commit comments

Comments
 (0)