Masking Policies for Snowflake
Overview
Organizations face an immense challenge in adhering to policy enforcements issued by governance councils and using data responsibly for their business needs. Translating those documented policies all the way to data controls on the warehouses where data is consumed is a complex and dynamic task. OneTrust's Policy Orchestration solution helps data teams institute a methodology for orchestrating policy enforcement to monitor and take action on policy violations with confidence.
This article captures how data governance teams using Snowflake data warehouses can leverage OneTrust to mask data at the data source level and ensure only authorized users can view sensitive data. This is achieved by:
-
Setting up a data source connection to Snowflake via a worker node
-
Configuring a data policy with conditions to identify sensitive data that is unmasked
-
Customizing and applying policy actions to mask (or unmask) data for select user groups
Prerequisites
Service User Requirements
-
User TYPE=LEGACY_SERVICE
-
Password authentication, without 2-factor authentication
-
Default warehouse configured
-
USAGE privilege granted for the default warehouse
-
Default role configured, with granted privileges listed below.
|
Query |
Purpose |
Privileges Needed |
|---|---|---|
|
ALTER MASKING POLICY … SET BODY … |
Update masking policy definition |
Automatically allowed for the policy creator/owner. |
|
ALTER TABLE / VIEW … MODIFY COLUMN … SET / UNSET MASKING POLICY |
Apply/unapply masking policy |
APPLY MASKING POLICY ON ACCOUNT |
|
CREATE OR REPLACE MASKING POLICY |
Create masking policy, in the schema with the tables or views to which the policy will be applied |
CREATE MASKING POLICY |
|
SELECT CURRENT_TIMESTAMP |
Connection and credentials test |
USAGE on default warehouse |
|
SELECT from SNOWFLAKE.ACCOUNT_USAGE schema (tables: MASKING_POLICIES, TABLES, COLUMNS, TAG_REFERENCES, POLICY_REFERENCES) |
Scheduled ingestion of policies, schemas, and tags (classifications); application-time policy checks |
IMPORTED PRIVILEGES ON DATABASE SNOWFLAKE |
|
SHOW MASKING POLICIES IN ACCOUNT |
Check for policy existence at policy application time |
APPLY MASKING POLICY ON ACCOUNT |
|
SHOW ROLES |
Populate role selection |
N/A |
Data Source Setup
-
On the Data Discovery menu, select . The Data Sources screen appears.
-
Click the Add Data Source button. The Data Discovery Gallery screen appears.
-
Select the Snowflake tile. The Establish Connection screen appears.
-
In the first section, choose an existing worker node.
Note:For more information on creating and deploying a worker node, see Guided Worker Node Installation Overview.
-
In the second section, provide, you can create new data source credentials or choose from existing Snowflake credentials.
Tip:Credentials can also be changed post setup in the Settings tab on the Data Source Details screen.
-
If creating new credentials, provide information for the fields:
- Field
- Description
- Credential name
-
Provide a unique name for this credential.
- Description
-
Provide a meaningful description of the credential's intended use and purpose.
- Reference key
-
Define the path to save or locate the securely stored credentials within the vault, ensuring efficient and protected access to your data source.
Example format: "/path/<key-name>"
- Standard: Key-Value Pair
-
Input the credentials as key-value pairs, where the key represents the connection field and the value represents the corresponding information. Custom keys can be added or removed.
- Advanced: JSON
-
Input the credentials as a JSON file, where the key represents the connection field, and the value represents the corresponding information.
- Add credentials to vault (optional)
-
This option simplifies the configuration of data source credentials by automatically adding them to the vault associated with your worker node.
-
Click the Next button.
-
Provide a unique name for this new data source.
-
For the Set scan profile, you can either choose the system default profile (Snowflake: Full Catalog), choose an existing profile, or create a new one.
-
Click the Save button. The Data Source Details screen appears for the new data source.
-
Click the Activate button.
-
Start a scan for the new data source to begin ingesting data that has been classified by Databricks.
Important:Due to the latency of Snowflake's ACCOUNT_USAGE schema, new tables and new tags may not be scanned for up to 3.5 hours after their creation. For additional information, see Snowflake's Account Usage article here.
Snowflake Column Masking
-
You will need to create a data policy to detect violations on observed Snowflake data that is sensitive but not yet masked. Additional conditions can be used to narrow the scope of the data.
-
The classification tag you use to detect sensitive data can be any custom/unique value. Our example uses Sensitive Personal Data.
-
Recommended: The policy can include the Policy condition, where the operator is Is Empty. This identifies data that is not masked.
Note:If this is not specified, then OneTrust masking policies will replace an existing masking policy that was previously applied to the column. A column in Snowflake can only have a single associated masking policy.
Note:For more information on creating policies, see Creating & Managing Data Policies.
-
-
Navigate to the Violations tab in the given Data Policy's details screen.
-
Select one or more violations that represent columns which need to be masked.
-
With multiple violations selected, click the Actions button to select Apply policy action. A side pane appears to create and apply a policy action.
-
Provide a unique name for this action. This will generate the Data source policy identifier string. The Action type will default to Masking.
Note:This name cannot be changed once the policy action is saved.
-
Provide an optional description for reference of what this policy action is masking.
-
Click the Next button to advance to the action rules.
-
Under Data policy conditions, define the masking value. The value supplied for the mask condition will replace the sensitive data value. This defaults to REDACTED but can be updated to any text.
-
Define inclusion/exclusion conditions on masking data for certain user groups:
-
Choose User groups except to specify which user types in Snowflake that are authorized to view this data. This masks the data for all unselected users.
-
Choose Including user groups to mask data for all selected user types. All unselected users will be able to view the data.
-
-
Click the Next button.
-
Take a moment to review all of the policy action details. Use the Back button to make changes as necessary.
Note:The modal below uses the User groups except masking option. If you selected the Including user groups masking option, those conditions will be shown here for review.
-
Click the Save and apply button to activate the policy action. An application modal appears to show how many violations have been resolved.
-
This created policy action will be available in the Policy actions menu. Use the View policy action link to navigate to the details screen.
Policy Action Management
List Screen
-
Besides the link the Policy action applied modal, you can also access created policy actions from Policy Actions on the Data Catalog menu.
-
Policy actions that have hyperlinked names are actions created manually in OneTrust, as demonstrated in the above flow. Clicking the name will take you to the details page. Their Enforcement column value will be Manual.
-
Policy actions with no hyperlinked names are actions that are ingested directly from Snowflake. You will not be able to manage these in OneTrust. Their Enforcement column value will be blank.
-
-
Click the name of a policy action to enter the details screen.
Editing Policy Actions
-
To update the policy action's conditions, click the three dots next to the name and select Edit. The Edit policy action modal appears.
Note:You will not be able to edit policy actions if there are no resolved violations. At minimum there must be at least one resolved violation to edit.
-
Update the masking value and user group selection as necessary, then click the Save and Apply button.
-
Go to the Resolved violations tab to inspect what violations were resolved by the policy action.
-
To remove the applied policy action, select one or more violations and click the Remove policy action button.
-
A confirmation modal will appear to state how many violations will be restored. Click the Remove actions to remove the policy actions and revert the violations.
Deleting Policy Actions
Before you delete policy actions, ensure that you have addressed the following:
-
You can only delete a policy action if there are no resolved violations.
-
You can only delete a data policy if there are no associated policy actions.
-
You can only delete a data source if there are no associated policy actions.
-
To delete a policy action, click the three dots next to the name and select Delete. The Delete policy action modal appears.
-
Click the Delete policy action button to confirm. This action cannot be undone.
Snowflake-OneTrust Term Mapping
For additional information on how data is classified with Snowflake, see their Sensitive data classification article here.
|
Snowflake Tag Value |
OneTrust Term |
|---|---|
|
SNOWFLAKE.CORE.SEMANTIC_CATEGORY.PASSPORT |
Passport |
|
SNOWFLAKE.CORE.SEMANTIC_CATEGORY.URL |
URL |
|
SNOWFLAKE.CORE.SEMANTIC_CATEGORY.LATITUDE |
Latitude |
|
SNOWFLAKE.CORE.SEMANTIC_CATEGORY.LONGITUDE |
Longitude |
|
SNOWFLAKE.CORE.SEMANTIC_CATEGORY.PHONE_NUMBER |
Phone Number |
|
SNOWFLAKE.CORE.SEMANTIC_CATEGORY.IP_ADDRESS |
IP Address |
|
SNOWFLAKE.CORE.SEMANTIC_CATEGORY.CITY |
City |
|
SNOWFLAKE.CORE.SEMANTIC_CATEGORY.POSTAL_CODE |
Postal Code |
|
SNOWFLAKE.CORE.SEMANTIC_CATEGORY.COUNTRY |
Country |
|
SNOWFLAKE.CORE.SEMANTIC_CATEGORY.DATE_OF_BIRTH |
Date of Birth |
|
SNOWFLAKE.CORE.SEMANTIC_CATEGORY.GENDER |
Gender |
|
SNOWFLAKE.CORE.SEMANTIC_CATEGORY.MARITAL_STATUS |
Marital Status |
|
SNOWFLAKE.CORE.SEMANTIC_CATEGORY.VIN |
Vehicle Identification Number |
|
SNOWFLAKE.CORE.SEMANTIC_CATEGORY.IMEI |
International Mobile Equipment Identity |
|
SNOWFLAKE.CORE.SEMANTIC_CATEGORY.BANK_ACCOUNT |
Bank Account Number |
|
SNOWFLAKE.CORE.SEMANTIC_CATEGORY.DRIVERS_LICENSE |
Drivers License Number |
|
SNOWFLAKE.CORE.SEMANTIC_CATEGORY.MEDICARE_NUMBER |
National Health Number |
|
SNOWFLAKE.CORE.SEMANTIC_CATEGORY.NATIONAL_IDENTIFIER |
National Identification Number |
|
SNOWFLAKE.CORE.SEMANTIC_CATEGORY.ORGANIZATION_IDENTIFIER |
Company / Entity |
|
SNOWFLAKE.CORE.SEMANTIC_CATEGORY.STREET_ADDRESS |
Address |
|
SNOWFLAKE.CORE.SEMANTIC_CATEGORY.TAX_IDENTIFIER |
Taxpayer Identification Number |
|
SNOWFLAKE.CORE.SEMANTIC_CATEGORY.EMAIL |
Email Address |
|
SNOWFLAKE.CORE.SEMANTIC_CATEGORY.NAME |
Full Name |
|
SNOWFLAKE.CORE.SEMANTIC_CATEGORY.PAYMENT_CARD |
Credit Card Number |
|
SNOWFLAKE.CORE.SEMANTIC_CATEGORY.OCCUPATION |
Job Title / Role |
|
SNOWFLAKE.CORE.SEMANTIC_CATEGORY.SALARY |
Salary / Wage |
|
SNOWFLAKE.CORE.SEMANTIC_CATEGORY.AGE |
Age of Individual |
|
SNOWFLAKE.CORE.SEMANTIC_CATEGORY.ETHNICITY |
Racial or Ethnic Origin |
|
SNOWFLAKE.CORE.SEMANTIC_CATEGORY.IBAN |
Bank Account Number |