Skip to content

Commit ebd7a2f

Browse files
committed
Fixes #1854, prototype pollution
1 parent 898ff9e commit ebd7a2f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

require.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ var requirejs, require, define;
3333
contexts = {},
3434
cfg = {},
3535
globalDefQueue = [],
36-
useInteractive = false;
36+
useInteractive = false,
37+
disallowedProps = ['__proto__', 'constructor'];
3738

3839
//Could match something like ')//comment', do not lose the prefix to comment.
3940
function commentReplace(match, singlePrefix) {
@@ -94,7 +95,7 @@ var requirejs, require, define;
9495
function eachProp(obj, func) {
9596
var prop;
9697
for (prop in obj) {
97-
if (hasProp(obj, prop)) {
98+
if (hasProp(obj, prop) && disallowedProps.indexOf(prop) == -1) {
9899
if (func(obj[prop], prop)) {
99100
break;
100101
}

0 commit comments

Comments
 (0)