Skip to content

Commit 8e6bdbd

Browse files
author
Sergei Tomin
committed
Fix Prototype Pollution vulnerability (CVE-2023-26102) by applying changes from timdown#482
1 parent 8aea7eb commit 8e6bdbd

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
### This fork includes PR with a vulnerability fix (https://github.com/timdown/rangy/pull/482)
2+
13
Rangy
24
=====
35

lib/rangy-core.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,9 @@
158158
util.extend = extend = function(obj, props, deep) {
159159
var o, p;
160160
for (var i in props) {
161+
if (i === "__proto__" || i === "constructor" || i === "prototype") {
162+
continue;
163+
}
161164
if (props.hasOwnProperty(i)) {
162165
o = obj[i];
163166
p = props[i];
@@ -3862,7 +3865,7 @@
38623865
win = null;
38633866
});
38643867
});
3865-
3868+
38663869

38673870
/*----------------------------------------------------------------------------------------------------------------*/
38683871

@@ -3893,4 +3896,4 @@
38933896
}
38943897

38953898
return api;
3896-
}, this);
3899+
}, this);

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "rangy",
33
"description": "A cross-browser DOM range and selection library",
4-
"version": "1.3.1",
4+
"version": "1.3.2",
55
"author": {
66
"name": "Tim Down",
77
"email": "tim@timdown.co.uk",
@@ -33,4 +33,4 @@
3333
"jshint": "^2.13.5",
3434
"archiver": "^5.3.1"
3535
}
36-
}
36+
}

src/core/core.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@
159159
util.extend = extend = function(obj, props, deep) {
160160
var o, p;
161161
for (var i in props) {
162+
if (i === "__proto__" || i === "constructor" || i === "prototype") {
163+
continue;
164+
}
162165
if (props.hasOwnProperty(i)) {
163166
o = obj[i];
164167
p = props[i];
@@ -511,4 +514,4 @@
511514
}
512515

513516
return api;
514-
}, this);
517+
}, this);

0 commit comments

Comments
 (0)