为了账号安全,请及时绑定邮箱和手机立即绑定

Laravel5.8中如何防止Summernote中的跨站脚本

Laravel5.8中如何防止Summernote中的跨站脚本

PHP
心有法竹 2021-12-03 16:26:35
我已经使用该strip_tags方法为其他输入法编写了脚本,但它不适用于Summernote。我可以使用script_tags或任何其他方法来防止跨站点脚本吗?我已经尝试过使用该strip_tags方法,但没有奏效。$a['description'] = strip_tags($data['description']); //In the Controller<textarea id='summernote' name="description">//In the form我希望将代码保存在数据库中,而不只使用脚本标签。
查看完整描述

2 回答

?
蝴蝶刀刀

TA贡献1801条经验 获得超8个赞

注意:即使没有脚本标记,您仍然可以引入跨站点脚本漏洞。例如,将其从 html 页面复制并粘贴到 summernote 中。将鼠标悬停在按钮上将使用户导航到指定的页面,没有脚本标记。


<button style="h1" onmouseover='window.location = "http://www.google.com";'>

    Totally not malicious. Nothing bad will happen if you just mouseover this text.

</button>


查看完整回答
反对 回复 2021-12-03
?
DIEA

TA贡献1820条经验 获得超2个赞

像这样使用“e”函数:

$a['description'] = e($data['description']);


查看完整回答
反对 回复 2021-12-03
  • 2 回答
  • 0 关注
  • 226 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信