如何处理checkmarx扫描的SQL_Injection和Second_Order_SQL_Injection漏洞?

How to handle SQL_Injection and Second_Order_SQL_Injection vulnerabilities scanned by checkmarx?

提问人:Steven Zhou 提问时间:10/10/2022 最后编辑:Your Common SenseSteven Zhou 更新时间:10/12/2022 访问量:308

问:

SQL_Injection和Second_Order_SQL_Injection漏洞出现在使用spring data jpa框架的项目源代码中,使用checkmarx扫描

我该如何处理它们?你有什么建议吗,谢谢

  1. 在“password”中检测到注入漏洞
public interface AccRepository extends BaseRepository<Acc, String> {
    @Query(value = "SELECT * FROM acc WHERE username = ?1 and password = ?2",nativeQuery = true)
    Acc selectAcc(String username, String password);
}
Java Spring Security SQL注入 Checkmarx

评论

0赞 Your Common Sense 10/10/2022
此代码已受保护。要么是那个“checkmarx”的东西给你误报,要么是另一个易受攻击的代码。后者必须以与编写此代码相同的方式重写,使用参数
0赞 Your Common Sense 10/10/2022
这回答了你的问题吗?避免在 Spring JPA 中注入 SQL

答: 暂无答案