How to prevent Sql-Injection on User-Generated Sql Queries

前端 未结 15 1989
伪装坚强ぢ
伪装坚强ぢ 2021-02-10 11:55

I have a project (private, ASP.net website, password protected with https) where one of the requirements is that the user be able to enter Sql queries that will directly query t

15条回答
  •  余生分开走
    2021-02-10 12:30

    Event seemingly secure technology like Dynamic LINQ, is not safe from code injection issues and you are talking about providing low-level access.

    No matter how hard you sanitize queries and tune permissions, it probably will still be possible to freeze your DB by sending over some CPU-intensive query.

    So one of the "protection options" is to show up a message box telling that all queries accessing restricted objects or causing bad side-effects will be logged against user's account and reported to the admins immediately.

    Another option - just try to look for a better alternative (i.e. if you really need to process & update data, why not expose API to do this safely?)

提交回复
热议问题