Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a
sanitizeparam to thesvgtag battle potential XSS issues.It uses https://github.com/darylldoyle/svg-sanitizer which is a PHP implementation of the popular DOMPurify library. https://github.com/cure53/DOMPurifyNote: This package was swapped out in #8428.
The svg tag will now let you add
sanitize="true"and will trigger the sanitization.{{ svg src="..." sanitize="true" }}You may specify additional attributes or tags to be allowed through the sanitizer:
{{ svg src="..." sanitize="true" allow_attrs="onclick|onload" allow_tags="mesh|foreignObject" }}We are leaving it as opt-in otherwise it would be a breaking change. In Statamic 5 we will make it sanitize by default.