Usm*_*kil 10 java spring sql-injection spring-annotations
对于Spring,传递给@Query注释的字符串的参数是否被视为纯数据,例如,如果您使用的是PreparedStatement类或任何旨在阻止SQL注入的方法?
final String MY_QUERY = "SELECT * FROM some_table WHERE some_column = ?1";
@Query(value=MY_QUERY, nativeQuery = true)
List<SomeEntity> findResults(String potentiallyMaliciousUserInput);
Run Code Online (Sandbox Code Playgroud)
结论:上面的代码是否容易受到SQL注入的影响?
看起来 Spring Data@Query
只是 JPA 的包装
请参阅这个答案:Are SQL Injection Attacks possible in JPA?
归档时间: |
|
查看次数: |
13004 次 |
最近记录: |