Does stored procedure help eliminates SQL injection / What are the benefits of stored procedured over normal SQL statement in apps?

后端 未结 5 1214
离开以前
离开以前 2021-02-03 10:34

I\'m pretty new to SQL world. Here are my questions:

  • What are the benefits of stored procedured over normal SQL statement in applications?
  • Does stored pro
5条回答
  •  北海茫月
    2021-02-03 11:21

    One way in which stored procedures (ones which do not use dynamic SQL) can make the whole application more secure is that you can now set the permissions at the stored procedure level and not at the table level. If you do all of your data access this way (and forbid dynamic sql!) this means users can not under any circumstances do amnything to the database that is not in a stored proc. Developers always want to say that their application code can protect against outside threats, but they seem to forget that inside threats are often far more serious and by allowing permissions at the table level, they are at the mercy of any user who can find a way to directly query the database outside the application (another reason why in large shops only two or three people at most have production rights to anything in the datbase, it limits who can steal information).

    Any financial system that uses anything except stored procs for instance is completely open to internal fraud which is a violation of internal controls that should prevent fraud and would not pass a good audit.

提交回复
热议问题