Skip to content

Commit 6c5f31a

Browse files
authored
Better prototype pollution fix
1 parent 0d4e819 commit 6c5f31a

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

dom-element.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +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-
}
131+
// Safely access and delete the attribute
135132
var attributes = this._attributes[namespace];
136-
if (attributes) {
137-
delete attributes[name]
133+
if (attributes && Object.prototype.hasOwnProperty.call(attributes, name)) {
134+
delete attributes[name];
138135
}
139136
}
140137

0 commit comments

Comments
 (0)