phith0n / xsshtml Goto Github PK
View Code? Open in Web Editor NEWphp富文本过滤类,XSS Filter
Home Page: http://phith0n.github.io/XssHtml
php富文本过滤类,XSS Filter
Home Page: http://phith0n.github.io/XssHtml
Written by Phithon <[email protected]> in 2014 and placed in the public domain. phithon <[email protected]> 编写于20140621 From: XDSEC <www.xdsec.org> & 离别歌 <www.leavesongs.com> Usage: <?php require('xsshtml.class.php'); $html = '<html code>'; $xss = new XssHtml($html); $html = $xss->getHtml(); ?> 需求: PHP Version > 5.0 浏览器版本:IE7+ 或其他浏览器,无法防御IE6及以下版本浏览器中的XSS 更多使用选项见 http://phith0n.github.io/XssHtml
比如 转义前 : '你好啊'
转以后: '
你好啊
'能不能不加p标签
如何修改代码呢
<img src=# onerror="alert(1)">
嘛……感谢作者带来的代码……
首先有两个建议:
然后如果可以的话,不如加入CSS属性白名单过滤功能吧,以避免页面排版混乱什么的……【我在开发中为了避免麻烦直接上了正则……(反正就两条)】
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.