TICKIT-11: PII, Masking and Row-Level Security
Track: TICKIT Marketplace • Difficulty: Advanced • Mastery Points: 200 PTS
Business Problem Scenario
TICKIT Marketplace processes customer personally identifiable information (PII) including email addresses and regional location details. In compliance with data minimization standards, general business intelligence analysts should see email handles masked with asterisks while preserving domain names for delivery verification. Additionally, regional operations staff may only view customers registered within their authorized state jurisdiction.
Engineering Objective
Write the SQL definitions for dynamic masking function gov.mask_email and row filter function gov.filter_state. • gov.mask_email(val STRING): Use regexp_replace to mask username characters before @ with asterisks. • gov.filter_state(row_state STRING): Verify row_state against current_user() assignment in gov.user_state_assignment. Key Concepts: - Dynamic Masking & Row Filtering: Enforcing granular data minimization and jurisdictional access directly in the Lakehouse.
Target Table: silver.users (userid INT, email STRING, state STRING), gov.user_state_assignment (user_email STRING, state STRING)
Verification & Architecture Insights
Combining column masking with row-level territory filtering enforces least-privilege data access natively inside the SQL query engine.