π Security Access Control in Snowflake
Snowflake uses a multi-layered security model to control access to data. It combines Role-Based Access Control (RBAC) with object-level privileges and data-level policies for granular security.
β Hierarchy and Checksβ
-
π€ User
- A user must authenticate first (e.g., via username/password, SSO, MFA).
-
π Role (RBAC)
- RBAC (Role-Based Access Control) decides which roles the user has.
- Roles determine object-level privileges (database, schema, table).
-
π¦ Object Privileges
-
Example:
GRANT SELECT ON TABLE sales TO ROLE analyst; -
First Check: Does the role have SELECT privilege on the object?
-
-
π§© Data-Level Policies
-
After object-level permissions are confirmed, Snowflake applies data policies:
- Row Access Policy β Row-Level Security (RLS)
- Masking Policy β Column-Level Security (CLS)
-
β Where Row & Column-Level Security Come Inβ
-
They do NOT replace RBAC; they layer on top of it for finer control.
-
Order of evaluation after RBAC & object privilege check:
- Row-Level Security (RLS) β restricts which rows a user can see.
- Column-Level Security (CLS) β masks or hides sensitive columns.
β Full Evaluation Flowβ
- Step 1 β RBAC (Role assigned to the user)
- Step 2 β Object Privileges (e.g.,
SELECTon a table) - Step 3 β Row-Level Security (Row Access Policy)
- Step 4 β Column-Level Security (Masking Policy)
β Hierarchy Visualβ
β Where Row & Column-Level Security Come Inβ
-
They do NOT replace RBAC; they layer on top of RBAC for finer control.
-
Order of evaluation after RBAC & object privilege check:
- Row-Level Security (RLS) β restricts which rows a user can see.
- Column-Level Security (CLS) β masks or hides sensitive columns.
Full Flowβ
- First Check β RBAC (Role access to objects)
- Second Check β Object Privileges (GRANT)
- Third Check β Row-Level Security (Row Access Policy)
- Fourth Check β Column-Level Security (Masking Policy)
β Role-Level Access Control (RBAC)β
-
What it is: RBAC is a security framework where permissions are granted to roles, not directly to users. Users are assigned to roles β roles have privileges on objects β users inherit those privileges.
-
Hierarchy: Snowflake allows role hierarchy, so a parent role inherits privileges from its child roles.
-
Why it matters:
- Centralized and scalable security.
- Easier management (you manage roles, not users).
- Supports least privilege principle.
π― Simply:
RBAC is a security model that uses roles to control access to resources. Instead of assigning privileges directly to users, you assign privileges to roles, and assign roles to users.
-
β Purpose:
- Enforce least privilege by giving users only the permissions they need.
- Simplify privilege managementβroles can be assigned and adjusted without touching individual users.
- Enable scalability and consistency in managing access.
β Relationship with Other Levelsβ
- RBAC defines which role can access which objects β this is the first check.
- Then, object-level, row-level, and column-level policies add granular control.
- So the hierarchy is: