gpt4 book ai didi

javascript - 跨站脚本: Is restricting the use of < and > tags an effective way to reduce Cross Site Scripting?

转载 作者:行者123 更新时间:2023-11-28 18:28:41 25 4
gpt4 key购买 nike

如果我想防止 XSS,在所有文本输入表单中限制特殊字符(例如 < 和 >)的输入是否是防止 XSS 的最佳方法?

我的意思是,这会阻止输入 html 标签,例如 <script> , <img>等,有效拦截XSS。

你同意吗?

最佳答案

没有。防止这种情况的最佳方法是确保您输出到页面上的所有信息都经过适当编码。

<小时/>

一些可能的例子说明为什么尖括号(和其他特殊字符阻塞)是不够的:

https://security.stackexchange.com/questions/36629/cross-site-scripting-without-special-chars

关于javascript - 跨站脚本: Is restricting the use of < and > tags an effective way to reduce Cross Site Scripting?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38572209/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com