Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SQL Server Security: Pros and Cons of Application Roles


SQL Server Security: Pros and Cons of Application Roles

Author
Message
K. Brian Kelley
K. Brian Kelley
Keeper of the Duck
Keeper of the Duck (8.3K reputation)

Group: Moderators
Points: 8284 Visits: 1917
Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/bkelley/sqlserversecurityprosandconsofapplicationroles.asp

K. Brian Kelley
@‌kbriankelley
sjtaylor
sjtaylor
SSC-Addicted
SSC-Addicted (473 reputation)SSC-Addicted (473 reputation)SSC-Addicted (473 reputation)SSC-Addicted (473 reputation)SSC-Addicted (473 reputation)SSC-Addicted (473 reputation)SSC-Addicted (473 reputation)SSC-Addicted (473 reputation)

Group: General Forum Members
Points: 473 Visits: 3
Fair coverage of the issues. We're in the process of creating a new system running on SQL Server and ARs are the only way I could see to sensibly enforce security. We've hit the issue of cross-database access, but in a way it was good as the developer was calling xp_cmdshell which was going to introduce more problems than it solved.

SJT


SJT
K. Brian Kelley
K. Brian Kelley
Keeper of the Duck
Keeper of the Duck (8.3K reputation)

Group: Moderators
Points: 8284 Visits: 1917
The issue with cross-database access also applies to cross-database ownership chaining with respect to valid users. If a login doesn't have a valid user in a second database (and guest isn't enabled), they'll still be blocked. So it shows up again and again in the SQL Server security model.xp_cmdshell? *shudder* There is a reason it's not given out by default.

K. Brian Kelley
@‌kbriankelley
Philip Kelley
Philip Kelley
Right there with Babe
Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)Right there with Babe (771 reputation)

Group: General Forum Members
Points: 771 Visits: 232
We hit another “gotcha” with connection pooling with a web application a long time back.

The ASPs called a DLL that uses SQL authentication (I know, I know) to access the database. We implement all database access through stored procedures, but there was this one routine where the developer decided to build and submit a SELECT statement within a stored procedure. Rather than harass him to do it differently I set up an application role with access rights to support the query, and the application acitvated the role if and as necessary.

This, however, messed up other ASP pages, as the application role didn’t have execute stored procedure rights (as I am always harsh over database access privileges), but it took a while to figure out. Say we had 20 connections open in the pool to support the web site; at any point in time, 0 to 20 of them could be working under the context of this application role, and this status is “undetectable” by the pool manager. It’d assign a connection based on server, login, database (and/or whatever else), but was completely unaware of application role status, resulting in a connection being assigned with inappropriate rights.

In the end I dumped the application role and harassed the developer to change his code. If there were a way to “undo” or roll back the application role setting, this would not have been a problem.

Philip



K. Brian Kelley
K. Brian Kelley
Keeper of the Duck
Keeper of the Duck (8.3K reputation)

Group: Moderators
Points: 8284 Visits: 1917
quote:
In the end I dumped the application role and harassed the developer to change his code. If there were a way to “undo” or roll back the application role setting, this would not have been a problem.

I agree wholeheartedly. While a simple stored procedure can reset client settings, nothing exists to reset an app role back to the base user. Not sure why as it would make resource pooling more friendly.



K. Brian Kelley
@‌kbriankelley
Steve Jones
Steve Jones
SSC-Forever
SSC-Forever (48K reputation)SSC-Forever (48K reputation)SSC-Forever (48K reputation)SSC-Forever (48K reputation)SSC-Forever (48K reputation)SSC-Forever (48K reputation)SSC-Forever (48K reputation)SSC-Forever (48K reputation)

Group: Administrators
Points: 48612 Visits: 18993
Nicely written Brian and shares many of my same views. I've tended to handle inappropriate access (like not using the applicaiton) administratively. A chewing out, a writeup, or a termination if people see the need to use Access or some other tool to change data.

However, I'm curious about a couple things. What if you used a "shared login" for all users that had minimal right before invoking the app role? Would that eliminate one of the cons?

Also, for pooling issues, an app could potentially just hold a connection open. For quite a few client/server apps, this might make sense. Alternatively, you could set a semaphore of some sort in the app when the role is invoked and not reissue "sp_setapprole" if the semaphore is set. A simple check could determine "which role" you had.

Lastly, not sure the server roles item applies for this. The apps where we want to prevent access wouldn't usually have server roles for someone. There are exceptions, but not sure they're enough to mark this as a "con", more as an FYI.

Again, great article.

Steve Jones
sjones@sqlservercentral.com
http://www.sqlservercentral.com/columnists/sjones
www.dkranch.net

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
cppwiz
cppwiz
SSC Veteran
SSC Veteran (264 reputation)SSC Veteran (264 reputation)SSC Veteran (264 reputation)SSC Veteran (264 reputation)SSC Veteran (264 reputation)SSC Veteran (264 reputation)SSC Veteran (264 reputation)SSC Veteran (264 reputation)

Group: General Forum Members
Points: 264 Visits: 470
quote:
I'll try and be fair and balanced in this article, but I've provided this disclaimer in case I'm not.



I think Fox News will be starting another lawsuit because you used the phrase "fair and balanced." First Al Franken, now Brian Kelley...



K. Brian Kelley
K. Brian Kelley
Keeper of the Duck
Keeper of the Duck (8.3K reputation)

Group: Moderators
Points: 8284 Visits: 1917

Funny you mentioned that. I read the judge's comments and I don't think my article could in any way be construed with O'Reilly so I think I'm safe. If not, us DBAs aren't exactly full of money so it's like trying to squeeze blood out of a turnip.



K. Brian Kelley
@‌kbriankelley
ALZDBA
ALZDBA
SSCrazy Eights
SSCrazy Eights (9.9K reputation)SSCrazy Eights (9.9K reputation)SSCrazy Eights (9.9K reputation)SSCrazy Eights (9.9K reputation)SSCrazy Eights (9.9K reputation)SSCrazy Eights (9.9K reputation)SSCrazy Eights (9.9K reputation)SSCrazy Eights (9.9K reputation)

Group: General Forum Members
Points: 9907 Visits: 8866
With Standard VB6 it needs a normal login-procedure and the a switch to the
application-role executing the sp_setapprole.

Is there a .Net-framework-based integration for SQLServer application roles?
If not : are application roles obsolete ?

Johan


Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere w00t

- How to post Performance Problems
- How to post data/code to get the best help


- How to prevent a sore throat after hours of presenting ppt ?


press F1 for solution, press shift+F1 for urgent solution :-D


Need a bit of Powershell? How about this

Who am I ? Sometimes this is me Alien but most of the time this is me Hehe
homebrew01
homebrew01
Hall of Fame
Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)

Group: General Forum Members
Points: 3905 Visits: 9091

We're thinking of using application roles, but I don't quite get how to give it permissions. We currently have a sql login that's being used & abused. It has dbo access, and I want to use an app role that also has dbo access so that it can create work tables via an application. I can see how to grant access to specific tables and SPs, but I don't want to have to manually manage specific objects.

What am I missing ?





Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search