User with database role of "NULL"

  • So I have a query that I use to get a list of database users, and the role(s) they belong to. In running this against one particularly annoying DB (751 users!? REALLY?!?!) I come across several accounts that have NULL for their role membership. I've checked them manually, and they belong to NO database-level roles, and NO server level roles other than Public.

    So, what sort of access would one of these users have? None at all to the DB (even thought they likely can connect to SQL Server itself,) or would they have read-only?

    I need to know because I'm going to be sending a list of users and their role memberships to the DB owner to review so we can try to trim out some of the dead weight...

    I've read the Technet / MSDN info on "is_member" which indicates that either these users used to belong to a DB role that no longer exists, or to a Windows Group (of which NONE have SQL permissions!)

    Thanks,

    Jason

  • OK, quick tested this on a QA copy of the DB in question, and if the role membership is NULL, you can connect to SQL (expected) but you can't query anything in the DB. But, you can view system stored procedures and users that are built-in to SQL.

    So, really, such a user won't be able to do anything really...

    Jason

  • All Database Users will at minimum be a member of the public Role. This affords them basic permissions like connecting to the database. Now, you can grant or deny permissions from the public Role if you want everyone to have that permission, but that is ill-advised.

    That said, just because a User is only a member of public does nor mean they have no permissions. Users can be granted permissions directly.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • opc.three (7/12/2013)


    All Database Users will at minimum be a member of the public Role. This affords them basic permissions like connecting to the database. Now, you can grant or deny permissions from the public Role if you want everyone to have that permission, but that is ill-advised.

    Understood. As for altering the "basic" permissions the Public role has, that would get my SQL Servers yanked off the network around here... If it weren't for the fact that removing (if even possible) the Public Role would break just about everything in SQL, that's what they'd want done...

    Yes, where I work is that maniacally security oriented. The best way to say what the rules are for setting up / configuring servers?

    This site is the be-all / end-all bible:

    http://iase.disa.mil/stigs/index.html

    opc.three (7/12/2013)


    That said, just because a User is only a member of public does nor mean they have no permissions. Users can be granted permissions directly.

    OK. But, in this case, I know the users have no other permissions granted, only what they've got through role membership.

    Thanks!

    Jason

  • OK. But, in this case, I know the users have no other permissions granted, only what they've got through role membership.

    I'm not trying to be a complete pain here, but are you sure they don't have any object-level permissions granted to them? I know you said you have a militant security policy, but have you run something similar to the following?

    select users.name username, so.name, perms.permission_name

    from sys.database_permissions perms

    inner join sys.objects so on so.object_id = perms.major_id

    inner join sys.database_principals users on users.principal_id = perms.grantee_principal_id

    where users.name = 'suspect_username'

    order by users.name, so.name, perms.permission_name;

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply