|
-
Aug 9th, 2006, 08:58 AM
#1
Thread Starter
Frenzied Member
SQL server running stored proc as different user
Sorry I couldn't come up with a title that encapsulates my question so....
I don't think this is possible but figured it was worth a try:
Is it possible for a user to run a stored procedure that drops a table when they themselves don't have permission to drop that table?
Cheers.
-
Aug 9th, 2006, 12:12 PM
#2
Hyperactive Member
Re: SQL server running stored proc as different user
it will run if you have permission onthe stored procedure but it will prompt an error
-
Aug 14th, 2006, 03:52 PM
#3
Re: SQL server running stored proc as different user
 Originally Posted by mikee_phil
it will run if you have permission onthe stored procedure but it will prompt an error
Are you really sure about that?
-
Aug 14th, 2006, 04:00 PM
#4
Re: SQL server running stored proc as different user
 Originally Posted by Fishcake
Sorry I couldn't come up with a title that encapsulates my question so....
I don't think this is possible but figured it was worth a try:
Is it possible for a user to run a stored procedure that drops a table when they themselves don't have permission to drop that table?
Cheers.
When executing a stored procedure on SQL Server 2000 you execute it with the permissions of the owner. If the owner has permissions to delete the table then there should be no problem for you to execute the procedure that deletes that table even though you don't have explicit permissions to delete it.
On SQL Server 2005 it is different. You can define whos permsissions should be used when executing a stored procedure.
-
Aug 14th, 2006, 04:03 PM
#5
Re: SQL server running stored proc as different user
So, since all our SPROCS are owned by DBO - they have full rights to do whatever they want - right?
We only ever give EXEC permission to users for our SPROCS...
-
Aug 14th, 2006, 04:08 PM
#6
Re: SQL server running stored proc as different user
 Originally Posted by szlamany
So, since all our SPROCS are owned by DBO - they have full rights to do whatever they want - right?
We only ever give EXEC permission to users for our SPROCS...
Yes. User permissions are overridden by stored procedures, even explicit DENYs, but only within the database where the sproc exists. If the sproc accesses data from another database,n then the user will need explicit permissions to these data.
-
Aug 14th, 2006, 05:39 PM
#7
Re: SQL server running stored proc as different user
So, since all our SPROCS are owned by DBO - they have full rights to do whatever they want - right?
No, not whatever they want (they being the stored procedure). You cannot execute statements, on behalf of users, that create database items (like Tables, Rules, Views) or statements that are only granted to predefined roles (such as Drop Table).
-
Aug 15th, 2006, 12:46 AM
#8
Re: SQL server running stored proc as different user
 Originally Posted by brucevde
No, not whatever they want (they being the stored procedure). You cannot execute statements, on behalf of users, that create database items (like Tables, Rules, Views) or statements that are only granted to predefined roles (such as Drop Table).
You are right and I am wrong . Permissions defined by predefined roles, like DDL rights, are not inherited, so CREATE and DROP statements would require the user to be member of the db_ddladmin role.
Permission inheritance are explained in BOL if you look at "ownership chains".
Last edited by kaffenils; Aug 15th, 2006 at 12:53 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|