Uploading a white SVG logo gets its styles removed and becomes black
viktorsmari reports an issue when uploading an SVG logo with styles, resulting in the logo becoming black instead of white. zogstrip explains that this is due to the automatic removal of <style> tags in SVGs for security reasons, suggesting the use of inline styles instead.
However, codinghorror questions the security risks associated with <style> tags, referencing security guidelines for SVG uploads that do not mention style tags as a concern. zogstrip acknowledges that while <style> tags can pose some security risks, such as loading external files, the current implementation only allows specific SVG elements.
Following the discussion, zogstrip updates the Discourse code to allow <style> elements in SVGs, resolving the issue.
It’s because we automatically remove <style> in SVGs for security reasons. Try inline styles instead.
Now that I think about it, it’s kinda pointless to block <style> tags but not inline styles…
Maybe we should allow them as this has generated more support question than actual security issues?