Skip to content

Conversation

@jameswassink
Copy link
Contributor

This should prevent the prototype pollution vulnerability raised in #54

dom-element.js Outdated
DOMElement.prototype.removeAttributeNS =
function _Element_removeAttributeNS(namespace, name) {
var forbiddenKeys = ['__proto__', 'constructor', 'prototype'];
if (forbiddenKeys.includes(name)) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would name being any of these keys lead to a prototype pollution?

name is only used in delete attributes[name] below.
I don't think you can pollute the prototype using delete and you can't delete the prototype or constructor either.

dom-element.js Outdated
Comment on lines 135 to 137
var attributes = this._attributes[namespace];
if (attributes) {
delete attributes[name]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Safely access and delete the attribute
const attributes = this._attributes?.[namespace];
if (attributes && Object.prototype.hasOwnProperty.call(attributes, name)) {
    delete attributes[name];
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, this makes more sense. I've updated the code.

@nekyouto
Copy link

Will there be a new release in npm to rectify this issue? I'm getting this being flagged out when I conduct a OWASP scan.

Looking forward to your inputs.

@danrossi
Copy link

Is it possible to merge this and make a release. As it's failing audits for many packages including video.js

@patmmccann
Copy link

@danrossi the library maintainer indicated it will not be released #54 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants