Skip to content

Commit

Permalink
Filter the attr to avoid possible XSS vulnerability Fix #1132
Browse files Browse the repository at this point in the history
  • Loading branch information
AmauriC committed Jul 11, 2023
1 parent 2565f0e commit c4c2fcf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tarteaucitron.js
Original file line number Diff line number Diff line change
Expand Up @@ -2083,7 +2083,13 @@ var tarteaucitron = {
return elem.getAttribute('height') || elem.clientHeight;
},
"getElemAttr": function (elem, attr) {
return elem.getAttribute('data-' + attr) || elem.getAttribute(attr);
var attribute = elem.getAttribute('data-' + attr) || elem.getAttribute(attr);

if (typeof attribute === 'string') {
return tarteaucitron.fixSelfXSS(attribute);
}

return "";
},
"addClickEventToId": function (elemId, func) {
tarteaucitron.addClickEventToElement(document.getElementById(elemId), func);
Expand Down

0 comments on commit c4c2fcf

Please sign in to comment.