Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Please Advice for Authenticating Users

Author  Topic 

ann06
Posting Yak Master

171 Posts

Posted - 2010-04-25 : 03:21:02
I have inherited a web application that is developed using asp.net, it uses windows authentication in IIS and also in sqlserver.
the problem is the application works by providing the domain users explicit read and write attribute in the sql server security to gain access for reading or writing data.

i.e this the user to possibly make sql server registration and would gain access to the sql server so he can browse my tables and also may mess up with the data


isn't this a bad application design? what is the better way of achieving the same requirements without compromising my system for a possible sabotage?


thanks for sharing your ideas

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-04-25 : 11:43:55
The best solution is for the users to only be granted EXEC on stored procedures. Then they can't browse anything, they can only execute the stored procedure.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

DBA in the making
Aged Yak Warrior

638 Posts

Posted - 2010-04-25 : 12:58:39
quote:
Originally posted by tkizer

The best solution is for the users to only be granted EXEC on stored procedures. Then they can't browse anything, they can only execute the stored procedure.



Or, use impersonation (under ASP.NET, not SQL Server) to impersonate a user that has access to the database. The web-user connects to the website, the website impersonates the database users in behalf of the web-user, and connects to the database.

The more users that have direct access to the database, the more security holes you leave open.

------------------------------------------------------------------------------------
Any and all code contained within this post comes with a 100% money back guarantee.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-04-25 : 14:58:58
Well I was only referring to the account that has access to the database.

What we do here is application security where users are just a row in a table. The users have no access to the database directly, only through the application. The one account that does have access to the database only has EXEC on stored procedures where no dynamic SQL is used. Dynamic SQL opens up direct table access, so that's a big no no.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

jeffw8713
Aged Yak Warrior

819 Posts

Posted - 2010-04-25 : 16:09:22
quote:
Originally posted by tkizer

Well I was only referring to the account that has access to the database.

What we do here is application security where users are just a row in a table. The users have no access to the database directly, only through the application. The one account that does have access to the database only has EXEC on stored procedures where no dynamic SQL is used. Dynamic SQL opens up direct table access, so that's a big no no.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog



You can get around that requirement by using EXECUTE AS. You can also give this application login access to select from the tables - as long as the login does not have direct access to insert/update/delete.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-04-25 : 17:05:26
It's not really a requirement of ours, but rather a best practice. We also won't use dynamic SQL for performance reasons.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

ann06
Posting Yak Master

171 Posts

Posted - 2010-04-26 : 02:19:43
thanks all of you much appreciated
Go to Top of Page
   

- Advertisement -