security - SVG source code via PHP form -
i use online photo editor on web store. user can edit photo using svg-edit , save changes. user results stored svg source code (...). have send svg source code through php form, save in database , show in administration panel.
i'm afraid of injections or attacks on web store. there possibility make secure?
i can't generate private hash svg source code, because it's client side , request can make via ajax.
@edit
example: user saves ... code , code being sent through post. in php script can access $svg = $_post['svg_source']; worring injection in post value. attacker may inject html, js, other, source code.
@edit:
and in db can store $_post value ... , view in pa. attacker can write ... code , executed in pa view svg image (based on svg code)
@edit:
i need solution check svg code valid , don't contain js, html code. or - need solution secure viewing svg code on website.
consider wrapping user input mysql_escape_string() before storing database. give mitigation far sql injection attacks.
as far html/javascript injection, need validate svg file against w3 standards. did quick search, , found this:
which leads these: http://us3.php.net/manual/en/domdocument.schemavalidate.php , http://us3.php.net/manual/en/domdocument.validate.php
i hope helpful.
edit :
as suggested in comments below, parse svg file whitelisting elements deem safe. looks there's posting covers this:
Comments
Post a Comment