Skip to content

Commit

Permalink
Add email mask policy
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasyu888 committed Oct 2, 2023
1 parent 8c6492a commit 9dd332d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion admin/policies.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// https://docs.snowflake.com/en/user-guide/security-column-ddm-use
use role masking_admin;
CREATE MASKING POLICY IF NOT EXISTS synapse_data_warehouse.synapse.email_mask AS (val string) returns string ->
USE DATABASE synapse_data_warehouse;
USE SCHEMA synapse;
CREATE MASKING POLICY IF NOT EXISTS email_mask AS (val string) returns string ->
CASE
WHEN current_role() IN ('SYSADMIN') THEN VAL
ELSE regexp_replace(val,'.+\@','*****@') -- leave email domain unmasked
Expand Down

0 comments on commit 9dd332d

Please sign in to comment.