Closed Stchena closed 1 year ago
Thank You @Stchena for the feature request write up and the PR. I won't be able to get to the review of this one until this weekend. Is that fine ?
I have merged this to main now, There are two more pending PR's and will try to cut a release this weekend after reviewing and merging them.
Thank you for spending the time to improve the package
The other two PR's may need additional review, So I have released version 0.2.4 with this change alone and will be reflected in dbt hub in a couple of hours. Please validate and confirm if this is working good for you and team.
Feature Request: Conditional Masking Policy
Description:
dbt-snow-mask
currently supports only simple, static rules based just on the meta-masked column and user's role. It would be great to introduce conditional masking policies to allow for more fine-grained control of access.For example, in our use-case, we couldn't proceed with
dbt-snow-mask
because we had our data scientists divided into 2 groups with mutually exclusive lists of client applications and their data. We wanted ds1 to have full access to their PII data, while only masked access to ds2 PII data and vice versa. With conditional masking policies, this could be possible.Link to Snowflake Documentation
Proposed Solution:
An example of how DDLs could be declared with the new feature:
An example of how to declare conditional columns in meta:
Modify
get_meta_objects.sql
macro to extract conditional columns.Modify
get_masking_policy_list_for_models.sql
andcreate_masking_policy.sql
macros to include the newly extracted parameters.Modify the
apply
query in the following way:Benefits:
Allow companies to enforce more fine-grained access control. This functionality brings in best-of-both-worlds from Snowflake's Column Masking Policies and RBAC. The introduction of conditional masking policies would add a lot of flexibility to the dbt-snow-mask tool. Users would be able to define masking policies that are more specific and nuanced than what is currently possible with static rules. This would make the tool more powerful and easier to use in complex data environments.
Challenges:
Additional Information:
I'd be happy to help implement this.
Thank you for considering this feature suggestion!