{"id":607,"date":"2025-02-01T05:58:05","date_gmt":"2025-02-01T05:58:05","guid":{"rendered":"https:\/\/datadandies.nl\/?p=607"},"modified":"2025-02-01T06:00:05","modified_gmt":"2025-02-01T06:00:05","slug":"607","status":"publish","type":"post","link":"https:\/\/datadandies.nl\/index.php\/2025\/02\/01\/607\/","title":{"rendered":"Snowflake hierarchy of objects and Role Based Access Control (RBAC) and Discretionary Access Control (DAC) security models"},"content":{"rendered":"\n<p>In Snowflake objects are hierarchically ordered. This means that at the top you will find the organization, then the account all the way down until you\u2019re at the level of tables. A graphical representation of this hierarchy is provided at the end of the post.<\/p>\n\n\n\n<p>This hierarchy is important when discussing the security of Snowflake. The security models used in Snowflake are the Role-Based Access Control (RBAC) and the Discretionary Access Control models.<\/p>\n\n\n\n<p>All objects are individually securable. Privileges (a defined level of access to an object e.g. if you can only read, or also edit the object) can be given to a role. Formulated differently: a role is an object to which privileges can be given. Here is an example of how this would look in Snowflake:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro padding-bottom-disabled cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:1.3rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * 1.3rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e\"><span style=\"background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e\">SQL<\/span><\/span><span role=\"button\" tabindex=\"0\" data-code=\"GRANT CREATE DATABASE ON ACCOUNT TO ROLE ROLE_1\" style=\"color:#D4D4D4;display:none\" aria-label=\"Kopieer\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">GRANT<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">CREATE<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">DATABASE<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">ON<\/span><span style=\"color: #D4D4D4\"> ACCOUNT <\/span><span style=\"color: #569CD6\">TO<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">ROLE<\/span><span style=\"color: #D4D4D4\"> ROLE_1<\/span><\/span><\/code><\/pre><span style=\"display:flex;align-items:flex-end;padding:10px;width:100%;justify-content:flex-end;background-color:#1E1E1E;color:#c7c7c7;font-size:12px;line-height:1;position:relative\">SQL<\/span><\/div>\n\n\n\n<p>A role in its turn, can be given to a user, or to another role. When you give a role to another role, you can effectively create a hierarchy of roles. E.g. ROLE_1 can see edit everything in a certain account, ROLE_2 is at a lower level in the hierarchy and can only see and edit certain databases, etc.<\/p>\n\n\n\n<p>Now, why would you care about this? Why is this important?<\/p>\n\n\n\n<p>Because, this gives you the opportunity to have granular control over who sees what! If you want really granular control, you could even create a role that only has access to a certain table, and create a row access policy (similar to Power BI Row-Level Security) that allows the role to only see certain records in that table.<\/p>\n\n\n\n<p>Another key advantage is that because of the DAC model, users are by default in control of the objects they have created, which helps with self service BI.<\/p>\n\n\n\n<p>One last advantage that I\u2019ll mention is that privilege inheritance in Snowflake&#8217;s role hierarchy is a powerful feature that simplifies access management and reduces administrative overhead. Put simply, when you create a role at a lower level (ROLE_LOWER) that has access to certain databases and you assign this role to a role higher in the hierarchy (ROLE_HIGHER), the ROLE_HIGHER inherits all privileges from ROLE_LOWER and you do not need to assign all the privileges all over again to ROLE_HIGHER. The privileges will simply be inherited by virtue of assigning ROLE_LOWER to ROLE_HIGHER which saves a lot of work. I will give an example of this in the next post.<\/p>\n\n\n\n<p>Organization<\/p>\n\n\n\n<p>\u2502<\/p>\n\n\n\n<p>Account<\/p>\n\n\n\n<p>\u2502<\/p>\n\n\n\n<p>\u251c\u2500\u2500 Users<\/p>\n\n\n\n<p>\u251c\u2500\u2500 Roles<\/p>\n\n\n\n<p>\u251c\u2500\u2500 Warehouses<\/p>\n\n\n\n<p>\u251c\u2500\u2500 Resource Monitors<\/p>\n\n\n\n<p>\u251c\u2500\u2500 Shares<\/p>\n\n\n\n<p>\u251c\u2500\u2500 Account Parameters<\/p>\n\n\n\n<p>\u251c\u2500\u2500 Network Policies<\/p>\n\n\n\n<p>\u251c\u2500\u2500 Account Usage<\/p>\n\n\n\n<p>\u251c\u2500\u2500 Storage Integrations<\/p>\n\n\n\n<p>\u251c\u2500\u2500 Notification Integrations<\/p>\n\n\n\n<p>\u251c\u2500\u2500 Security Integrations<\/p>\n\n\n\n<p>\u2502<\/p>\n\n\n\n<p>\u2514\u2500\u2500 Databases<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp; \u2502<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp; \u2514\u2500\u2500 Schemas<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u2502<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u251c\u2500\u2500 Tables<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u251c\u2500\u2500 Views<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u251c\u2500\u2500 Materialized Views<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u251c\u2500\u2500 External Tables<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u251c\u2500\u2500 Sequences<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u251c\u2500\u2500 File Formats<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u251c\u2500\u2500 Stages<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u2502&nbsp;&nbsp; \u251c\u2500\u2500 Internal Stages<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u2502&nbsp;&nbsp; \u2514\u2500\u2500 External Stages<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u251c\u2500\u2500 Pipes<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u251c\u2500\u2500 Streams<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u251c\u2500\u2500 Tasks<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u251c\u2500\u2500 Procedures<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u251c\u2500\u2500 Functions<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u2502&nbsp;&nbsp; \u251c\u2500\u2500 User-Defined Functions (UDFs)<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u2502&nbsp;&nbsp; \u2514\u2500\u2500 External Functions<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u2514\u2500\u2500 Masking Policies<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Snowflake objects are hierarchically ordered. This means that at the top you will find the organization, then the account all the way down until you\u2019re at the level of tables. A graphical representation of this hierarchy is provided at the end of the post. This hierarchy is important when discussing the security of Snowflake.&hellip;<\/p>\n<p class=\"more-link\"><a href=\"https:\/\/datadandies.nl\/index.php\/2025\/02\/01\/607\/\" class=\"themebutton\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[15,40],"class_list":["post-607","post","type-post","status-publish","format-standard","hentry","category-blog","tag-cybersecurity","tag-snowflake"],"_links":{"self":[{"href":"https:\/\/datadandies.nl\/index.php\/wp-json\/wp\/v2\/posts\/607","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/datadandies.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/datadandies.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/datadandies.nl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/datadandies.nl\/index.php\/wp-json\/wp\/v2\/comments?post=607"}],"version-history":[{"count":3,"href":"https:\/\/datadandies.nl\/index.php\/wp-json\/wp\/v2\/posts\/607\/revisions"}],"predecessor-version":[{"id":610,"href":"https:\/\/datadandies.nl\/index.php\/wp-json\/wp\/v2\/posts\/607\/revisions\/610"}],"wp:attachment":[{"href":"https:\/\/datadandies.nl\/index.php\/wp-json\/wp\/v2\/media?parent=607"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/datadandies.nl\/index.php\/wp-json\/wp\/v2\/categories?post=607"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/datadandies.nl\/index.php\/wp-json\/wp\/v2\/tags?post=607"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}