Skip to content

Commit 0d4e819

Browse files
authored
Fix prototype pollution in removeAttributeNS
1 parent bf7b691 commit 0d4e819

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

dom-element.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ DOMElement.prototype.getAttributeNS =
128128

129129
DOMElement.prototype.removeAttributeNS =
130130
function _Element_removeAttributeNS(namespace, name) {
131+
var forbiddenKeys = ['__proto__', 'constructor', 'prototype'];
132+
if (forbiddenKeys.includes(name)) {
133+
return; // Ignore dangerous keys
134+
}
131135
var attributes = this._attributes[namespace];
132136
if (attributes) {
133137
delete attributes[name]

0 commit comments

Comments
 (0)