How SQL Server Verifies Permissions on Securables?

Published: 19 June 2020
on channel: Decode ITES
403
9

#DecodeITeS

Permission is the most crucial aspect of SQL Server security. Permissions mean privileges over securables to perform the mentioned activity. Each securable has its permissions.

Things DBA & Security admin should consider while assigning permissions: -
Least-Privileged User Account (LUA) - DBA & Security admins should review each permission assigned to ensure the least-privileged user account (LUA) approach is implemented. Additional access may lead your system to data security and availability risk.

Role-Based Permissions – Permissions can be assigned directly to individual users, groups or Server or Database roles. Permissions assigned to server & database roles can be inherited to users assigned to the role. You can create customized user-defined server & database roles for your requirement. Managing permission of roles is far easier than managing permissions of individual users.

Prefer Groups over Individual Logins – Once you create customized user-defined server & database roles, you can assign them individual logins as well as Window AG groups. DBA & Security admin should keep reviewing the individuals requesting access. If multiple users belong to the same groups than they should force to have windows AD group so that permissions can be assigned to the group.

E.g.: You need to give 5 similar permissions to 10 users. This makes 50 entries to make and manage for DBAs.
With the help “Role-Based Permissions” you can create 1 role with all 5 permissions and assign to all 10 users. This brings 50 to 10 and reduces DBA stress.

Now, your review and found these 10 users are related to 2 business groups. You asked then to have windows AD groups, and this will further bring entries from 10 to 2.

Permissions through procedures & functions: DBAs should promote of assigning permissions through procedure & functions in place of direct object access. This help is securing your object details and direct brute force attack by adding an extra layer in database security. Most of the time requester is only concerns about output not about database objects used. This way helps to hide object-level details.

Permissions Statements
SQL Server gives 3 T-SQL statements for Permissions management: -
1. GRANT - Grants permission on mentioned securable
2. REVOKE - Revokes permission on mentioned securable. This is the default state of a new object. Permission revoked from a user or role can still be inherited from other groups or roles to which the principal is assigned.
3. DENY - DENY revokes permission so that it cannot be inherited.

Permissions Name
SQL Server comes up with a long list of permissions that can be allocated. You can use fn_builtin_permissions to list down all possible permissions for each DB or server level object.

SQL Server permission verification works on 3 core elements the security context, the permission space, and the required permission.
SQL Server Security has 3 aspects. “To whom you want to assign permissions?”, “On which you want to assign permission?” and “what permissions you want to assign?”.
“To whom you want to assign permissions?” is known as the Security context or SQL Server Principals. SQL Server Logins, Server Roles, Database User, Database Roles are one who can request and can have permissions.
“On which you want to assign permissions” is called Permission space or Securables. Securables are one on which permissions can be assigned. Securables are divided based on scoped – Server, Database, Schema.
“what permissions you want to assign” considered as Required permission or Permissions. Type of permissions you can give to principals over securables. Each securable has its permission type.

Permission Check elements & Process
SQL Server has an inbuilt process of permission validation each time action requested on securables. You can’t modify or control this process. Steps of Permission Check Processes are as below: -
1) Check if the requestor is a member of the SYSADMIN fixed server role or DBO user. Bypass all security check both cases.
2) Allow access if ownership chaining is applicable and the access check on the object earlier in the chain passed the security check.
3) To get the real identity of principal or security context permission element, the SQL server goes through & consolidates related server-level, database-level.
4) Once the security context is list down, collect all the permissions for permission space. Permissions can be explicitly given on securable or to individual principals or through object owners or groups respectively.
5) Identify the required permission for the requested action.
6) Permission check will fail if permissions are not enough or required permission is directly or implicitly denied
7) Pass the Permission check if required permission is directly or implicitly available


Watch video How SQL Server Verifies Permissions on Securables? online without registration, duration hours minute second in high quality. This video was added by user Decode ITES 19 June 2020, don't forget to share it with your friends and acquaintances, it has been viewed on our site 403 once and liked it 9 people.