har*_*rry 14 sql hibernate sql-injection
请问Hibernate
防范SQL injection attack
?如果我正在使用hibernate那么我是否完全免受SQL注入攻击?我听说使用用户输入Hibernate
执行dynamic SQL statement
构建可以允许攻击者修改语句的含义或执行任意操作SQL commands
.
Man*_*uPK 15
Hibernate是否可以防范SQL注入攻击?
不,它不保护错误编写的,所以在编写查询时需要小心.始终使用预准备语句样式,例如考虑以下HQL查询,
String query1 = "select * from MyBean where id = "+ id;
String query2 = "select * from MyBean where id = :id";
Run Code Online (Sandbox Code Playgroud)
query1**仍然容易受到**SQL注入的影响,而query2则不然.
因此,简而言之,hibernate为您提供了许多方法来保护自己免受SQL注入攻击.
归档时间: |
|
查看次数: |
6480 次 |
最近记录: |