Skip to content

Commit

Permalink
Merge pull request #635 from highcharts/stable
Browse files Browse the repository at this point in the history
Fix: remove all xlink:href attributes in incoming SVG
  • Loading branch information
cvasseng authored Feb 19, 2025
2 parents 48d3794 + c7349b2 commit a723e4d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/sanitize.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ import DOMPurify from 'dompurify';
export function sanitize(input) {
const window = new JSDOM('').window;
const purify = DOMPurify(window);
return purify.sanitize(input, { ADD_TAGS: ['foreignObject'] });
return purify.sanitize(input, {
ADD_TAGS: ['foreignObject'],
// Dissalow all xlinks in incoming SVG
FORBID_ATTR: ['xlink:href']
});
}

export default sanitize;

0 comments on commit a723e4d

Please sign in to comment.