java - java.sql.SQLException:sql注入违规,评论不允许:选择
问题描述
正如标题所说,我使用SQL选择但报告错误。下面Mapper中的SQL
<select id="selectBillDetailByBizIdAndClearType" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from dwd_clearing_bill_detail
where biz_detail_id in
<foreach collection="bizDetailIdList" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
and clear_type in
<foreach collection="clearTypeList" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</select>
解决方案
这是一个例外,表明以这种方式构建 SQL 语句是不安全的。有人可以注入恶意 SQL 代码、检索敏感数据或修改/删除您的数据。请参阅https://cheatsheetseries.owasp.org/cheatsheets/SQL_Injection_Prevention_Cheat_Sheet.html
推荐阅读
- bash - 如何通过在 ubuntu 中包含“cd”命令来运行 shell 脚本?
- python - pandas csv_read 浮点数逗号
- r - 如何从字符串中提取数字?
- babel-loader - 找不到入口模块
- c# - Xamarin/C#/GPS:奇怪的距离测量
- javascript - 我的代码做错了什么?它显示一个意外的令牌错误
- javascript - context.drawImage() 不工作 - 没有错误信息
- python - 如何在 Python 中编写紧凑但复杂的代码和易于理解但较长的代码之间进行选择?
- python - AttributeError: 'Label' object has no attribute 'get'
- python - 为什么 BeautifulSoup4 缺少第一个文件 URL?