Thank you for your extension and you interest in this module!
I haven't committed for a while because I'm just experimenting with trying to implement svg-edit as a widget. But I'm almost there.
It will take mo another week I reckon.
if ($instance['widget']['type'] == 'svg_code_widget') {
While it does solve your validation problem by not validating at all it introduces a security risk.
The real solution would is to find out why the validation fails and changing the broken validation code.
The validation code isn't broken. It's just doing strict XML validation, which is very hard to pass. The Noun Project code fails because the attributes aren't properly namespaced. I don't think we can rely on XML validation for security. A script tag is valid SVG, so XML validation would still allow XSS attacks. We probably need to use filter_xss() for security. But that will need a long list of valid SVG tags, minus script.
Comments
Comment #1
sreynen commentedComment #2
sreynen commentedCommitted. I had to make some changes to the validation to get this to work, since the SVG from Noun Project doesn't pass strict validation.
This could use some interface improvement, but it works.
Comment #3
josegaert commentedDear sreyen,
Thank you for your extension and you interest in this module!
I haven't committed for a while because I'm just experimenting with trying to implement svg-edit as a widget. But I'm almost there.
It will take mo another week I reckon.
Comment #4
josegaert commentedYou put this into svg_field_validate:
While it does solve your validation problem by not validating at all it introduces a security risk.
The real solution would is to find out why the validation fails and changing the broken validation code.
Comment #5
sreynen commentedThe validation code isn't broken. It's just doing strict XML validation, which is very hard to pass. The Noun Project code fails because the attributes aren't properly namespaced. I don't think we can rely on XML validation for security. A script tag is valid SVG, so XML validation would still allow XSS attacks. We probably need to use filter_xss() for security. But that will need a long list of valid SVG tags, minus script.