Skip to content

Commit

Permalink
fix: Avoid prototype polution when creating a new context
Browse files Browse the repository at this point in the history
  • Loading branch information
prantlf committed Feb 11, 2022
1 parent 9ddebe6 commit 3e9eb74
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions require.js
Original file line number Diff line number Diff line change
Expand Up @@ -1262,6 +1262,8 @@ var requirejs, require, define;
context.defQueueMap = {};
}

var denyProps = ["__proto__", "constructor", "prototype"];

context = {
config: config,
contextName: contextName,
Expand Down Expand Up @@ -1306,6 +1308,7 @@ var requirejs, require, define;
};

eachProp(cfg, function (value, prop) {
if (denyProps.indexOf(prop) >= 0) return;
if (objs[prop]) {
if (!config[prop]) {
config[prop] = {};
Expand Down

0 comments on commit 3e9eb74

Please sign in to comment.