Strict HTML Validation and Filtering in PHP

前端 未结 4 799
刺人心
刺人心 2020-12-08 03:04

I\'m looking for best practices for performing strict (whitelist) validation/filtering of user-submitted HTML.

Main purpose is to filter out XSS and similar nasties

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-08 04:02

    User-submitted HTML isn't always valid, or indeed complete. Browsers will interpret a wide range of invalid HTML and you should make sure you can catch it.

    Also be aware of the valid-looking:

    
    

    and

    click
    

提交回复
热议问题