We're planning on allowing users to upload SVG files and icons. The problem is that SVG files can contain JavaScript, and are thus very vulnerable for injection attacks.
<svg
xmlns="http://www.w3.org/2000/svg"
width="780" height="550"
onload="(function(){ alert('doing something nasty') })()">
would execute this code when the svg file is used.
I found this nice library to manage SVG files. This helps in being able to remove attributes like onEVENT='someJs()' ; but that's still not going to help me sleep at night.
So how could one completely sweep an SVG file of JS code in a clever way?