-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
esm: protect ESM loader from prototype pollution
Fixes: #45035 PR-URL: #45044 Reviewed-By: Jacob Smith <[email protected]> Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: James M Snell <[email protected]>
- Loading branch information
Showing
8 changed files
with
67 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use strict'; | ||
|
||
const { mustNotCall, mustCall } = require('../common'); | ||
|
||
Object.defineProperties(Array.prototype, { | ||
// %Promise.all% and %Promise.allSettled% are depending on the value of | ||
// `%Array.prototype%.then`. | ||
then: {}, | ||
}); | ||
Object.defineProperties(Object.prototype, { | ||
then: { | ||
set: mustNotCall('set %Object.prototype%.then'), | ||
get: mustNotCall('get %Object.prototype%.then'), | ||
}, | ||
}); | ||
|
||
import('data:text/javascript,').then(mustCall()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { mustNotCall, mustCall } from '../common/index.mjs'; | ||
|
||
Object.defineProperties(Array.prototype, { | ||
// %Promise.all% and %Promise.allSettled% are depending on the value of | ||
// `%Array.prototype%.then`. | ||
then: {}, | ||
}); | ||
Object.defineProperties(Object.prototype, { | ||
then: { | ||
set: mustNotCall('set %Object.prototype%.then'), | ||
get: mustNotCall('get %Object.prototype%.then'), | ||
}, | ||
}); | ||
|
||
import('data:text/javascript,').then(mustCall()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters