Stored Procedures vs No Stored Procedures - Security Viewpoint

后端 未结 9 627
时光取名叫无心
时光取名叫无心 2020-12-29 11:26

For a web application database, from a security standpoint only, what are arguments counter to the point for an sp only solution where the app db account ha

9条回答
  •  情歌与酒
    2020-12-29 11:51

    Well, I guess you really captured the core of the problem yourself: if you don't use stored procedures for all CRUD operations, you have to grant at least a app-specific db user account at least SELECT rights on all tables.

    If you want to allow the db account to do even more work, that account might also need other permission, like being able to UPDATE and possibly DELETE on certain tables.

    I don't see how a non-stored proc approach would have any security benefits - it does open up the gate just a bit more, the question really is: can you afford to? Can you secure that app-specific DB account enough so it won't compromise your system's overall security?

    One possible compromise might be to use views or table access to allow SELECT, but handle everything else (UPDATEs, DELETEs, INSERTs) using stored procs - half secure, half convenient...

    As it often is - this is a classic trade-off between convenience (non-sp approach; using an ORM possibly) and security (all SProc approach; probably more cumbersome, but a bit safer).

    Marc

提交回复
热议问题