Does using preparedStatement mean there will not be any SQL Injection?

前端 未结 5 1663
广开言路
广开言路 2021-02-20 10:58

I have read that to prevent SQL Injection one must use PreparedStatement.
Does that mean if i am using perparedStatement then no one can perform SQL Injection in any of my p

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-20 11:06

    prepared statements do not cover non-data parts of the query - identifiers and operators.
    thus, if some of them are variable and being added to the query directly, injection is possible.

    thanks to limited number of possible options, all variable identifiers should be chosen from pre-written variants based on user input. same for operators.
    No user input should be added to the query directly.

提交回复
热议问题