views:

36

answers:

3

I'm working with a database (let's call it DB_data) that contains all of the tables for a series of applications. In an attempt to minimize downtime during upgrades, a facade database (let's call it DB_facade) has been created which has a view for each of the tables in DB_data. It also contains all of the functions and stored procedures, which work against these views.

In trying to lock down security in DB_data we've done a DENY on all of the tables for all of the users in DB_data. All of these users have also been created in DB_facade with permissions to the views.

The problem here, is that because of cross-database ownership chaining the DENYs in DB_data are overriding the GRANTs in DB_facade.

I'd like to avoid turning on ownership chaining for both of these databases because of the potential security issues (although in my original tests, that did seem to correct the access problem). Also, we're trying to minimize impact to the applications, so requiring all access to be through stored procedures and using certificates (for example) wouldn't work.

Does anyone have any other suggestions on how to handle this?

Thanks!

+1  A: 

Do you have this problem if you exclude the DENY on the tables in DB_data? If you don't explicitly GRANT permissions on these tables, you may be able to get the security you need and get the access rights through the views.

bobs
As long as I don't deny access to the tables it works ok, but we're trying to prevent any direct access to the tables through DB_data.
Tom H.
Because there is no GRANT to the tables the users can't access the tables. But you are right that this is not the best solution. I may have another idea. I'll try another answer.
bobs
A: 

from what i've seen and done, sql server doesn't let you have any permissions unless explicitly told so. You should be able to grant select (or use the role datareader) in DB_Data to the users, and as long as it's the same account and it's mapped to both databases (you'll have to grant select and exec on db_facade) that should work just fine.

DForck42
If it were within a single database then denying access to the tables wouldn't prevent access through the views which are on those tables. Across databases though, even if the users are tied to the same account SQL Server will prevent access to the tables, even through the views for which the user has permissions.
Tom H.
i wish i had a good lab setup i could use to test this.
DForck42
A: 

You can create a view in the DB_data database for each view in the DB_facade database. The new views would have rights to select from the tables. GRANT SELECT on the views in DB_data. Change the views on DB_facade to SELECT from the views on DB_data. And, the tables would have DENY set.

I recognize one disadvantage to this; the users can still interact with the DB_data database. They wouldn't be able to access the tables, but they could access the new views.

bobs