所见即所得文本区域组件安全性
实际上,我的问题更多地与通过 WYSIWYG 表单组件接受的服务器端 html 清理有关。 现在我倾向于使用 htmlpurifier.org 的库。 我在其他地方使用 php strip_tags() 函数。 有人有建议/偏好/推荐吗?
Really my question has more to do with the server-side scrubbing of html that's accepted via the WYSIWYG form component. Right now I'm leaning toward using htmlpurifier.org's library. I'm using php strip_tags() function elsewhere. Anyone have an advice/preferences/recommendations?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
strip_tags
非常容易受到攻击 - 你还不如什么也不做。 HtmlPurifier 可能与 html 清理一样好。 如果您真的很重视安全性,您可能应该完全禁止 html 输入,但我意识到这并不总是一个选择。strip_tags
is very vulnerable - you might as well do nothing. HtmlPurifier is probably as good as it gets with html-cleansing. If you are really serious about security, you should probably disallow html input entirely, but I realise that's not always an option.不要忘记删除
on*
属性,例如。
这可能会引起一些麻烦。
Don't forget to scrub out the
on*
attributes like<p onclick="alert('hi!');">
.This can cause some trouble.