Skip to content

Conversation

scratching-claws
Copy link

Adds a rule to allow the SVG filter tag, when sanitizing SVGs, so that effects such as shadows and blur do not lead to SVGs which don't diplay on the project stage

Resolves

Fixes this issue: #269

Proposed Changes

Adds a rule to allow the SVG filter tag

Reason for Changes

Stops the SVG sanitizer from removing filter tags from SVGs, so that SVGs with shadows/blur display correctly on the stage

Adds a rule to allow the SVG filter tag, when sanitizing SVGs, so that
effects such as shadows and blur do not lead to SVGs which don't diplay
on the project stage
@scratching-claws scratching-claws requested a review from a team as a code owner August 24, 2025 20:03
@nimeratus
Copy link

Will this also allow things like <feGaussianBlur> that should be inside the <filter> element?

I've looked at DOMPurify's readme page and it says there is a toggle for SVG filters
https://github.com/cure53/DOMPurify?tab=readme-ov-file#control-our-allow-lists-and-block-lists

@scratching-claws
Copy link
Author

Will this also allow things like <feGaussianBlur> that should be inside the <filter> element?

I've looked at DOMPurify's readme page and it says there is a toggle for SVG filters https://github.com/cure53/DOMPurify?tab=readme-ov-file#control-our-allow-lists-and-block-lists

That is a very good point, and thank you for raising it. I have changed the pull request so that is now uses the SVG filters profile, instead of only allowing the additional tag

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.

2 participants