Skip to content

Commit 3e9eb74

Browse files
committed
fix: Avoid prototype polution when creating a new context
1 parent 9ddebe6 commit 3e9eb74

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

require.js

+3
Original file line numberDiff line numberDiff line change
@@ -1262,6 +1262,8 @@ var requirejs, require, define;
12621262
context.defQueueMap = {};
12631263
}
12641264

1265+
var denyProps = ["__proto__", "constructor", "prototype"];
1266+
12651267
context = {
12661268
config: config,
12671269
contextName: contextName,
@@ -1306,6 +1308,7 @@ var requirejs, require, define;
13061308
};
13071309

13081310
eachProp(cfg, function (value, prop) {
1311+
if (denyProps.indexOf(prop) >= 0) return;
13091312
if (objs[prop]) {
13101313
if (!config[prop]) {
13111314
config[prop] = {};

0 commit comments

Comments
 (0)