我知道spring和hibernate受到SQL注入的保护。
提前谢谢..。
发布于 2016-10-14 05:08:08
如果正确使用API,Hibernate确实提供了来自SQL注入的安全性。
来自:注入
--关于SQL注入的一点注记 由于这是一个热门话题,我现在将讨论,但稍后将详细讨论。
始终使用PreparedStatement来防止SQL,它是JDBC的一部分,Hibernate本身也使用这个看见。
例如:
String query1 = "select * from MyBean where id = "+ id;//Not secure
String query2 = "select * from MyBean where id = :id";//Secure
关于这个主题的一篇有用的文章:http://software-security.sans.org/developer-how-to/fix-sql-injection-in-java-hibernate
https://stackoverflow.com/questions/40035076
复制相似问题