所见即所得文本区域组件安全性

发布于 2024-07-12 07:03:46 字数 129 浏览 12 评论 0原文

实际上,我的问题更多地与通过 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

太傻旳人生 2024-07-19 07:03:46

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.

骄傲 2024-07-19 07:03:46

不要忘记删除 on* 属性,例如


这可能会引起一些麻烦。

Don't forget to scrub out the on* attributes like <p onclick="alert('hi!');">.
This can cause some trouble.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文