Sanitize HTML before storing in the DB or before rendering? (AntiXSS library in ASP.NET)

后端 未结 4 1329
广开言路
广开言路 2020-12-29 11:59

I have an editor that lets users add HTML that is stored in the database and rendered on a web page. Since this is untrusted input, I plan to use Microsoft.Security.Ap

4条回答
  •  暖寄归人
    2020-12-29 12:21

    Have a listen to the OWASP podcast 67 with Jeff Williams on XSS. He talks about not sanitising or encoding before storage. The primary reason is that if (when) libraries evolve in response to new vulnerabilities your data is going to be stuck back in the old version. Of course this doesn’t stop you from running any input against a whitelist at the entry point and rejecting anything outside acceptable range.

提交回复
热议问题