Glossary Entry

What is Data Masking?

Data masking hides or scrambles sensitive values like PII so people can query data without seeing the real values. Compare static and dynamic masking.

Written by Alex Merced

What is Data Masking?

Data Masking is a security mechanism designed to obfuscate, hide, or scramble sensitive Personally Identifiable Information (PII) within a database or Data Lakehouse. Its primary objective is to allow data analysts, software developers, and external vendors to query and work with enterprise datasets without seeing the true, legally protected information (like full Social Security Numbers or clear-text credit card details).

If a company needs to hire an external data science consultant to build a churn prediction model, handing them a raw database containing the names and home addresses of millions of customers is a serious security risk. However, if the company deletes all the sensitive columns, the data scientist has no data to build the model with. Data Masking solves this by altering the data (replacing a real name like “John Doe” with a masked string like “J*** D**”), preserving the structure of the database while hiding the sensitive values.

Static vs. Dynamic Masking

Data engineers implement masking in two different ways, depending on the security required.

1. Static Data Masking (SDM)

Static Data Masking physically alters the data resting on the hard drive. It is mostly used for creating safe “Test” or “Development” environments. The data engineering team writes an ETL pipeline that extracts the live production database. The pipeline replaces real names with randomly generated fake names, and replaces real credit card numbers with numbers that pass format checks but are fake.

The pipeline then writes this obfuscated, “Static” database to a separate server. The software developers use this fake database to test their code. Because the true values never reach the development copy, a breach of the development server does not expose the original sensitive data.

2. Dynamic Data Masking (DDM)

Dynamic Data Masking is more complex. It operates on the live Production Data Lakehouse without altering the physical files on the hard drive.

In DDM, the true, highly sensitive data (e.g., Social_Security: 123-45-6789) rests intact in the underlying Apache Parquet files. The masking occurs in the query engine (like Dremio or Snowflake) at the moment a user executes a SQL query.

When a user runs SELECT Social_Security FROM Employees:

  1. The engine checks the user’s Role-Based Access Control (RBAC) profile.
  2. If the user is the VP of HR, the engine returns the true data: 123-45-6789.
  3. If the user is a junior analyst, the engine intercepts the data as it flows from the hard drive to the screen. It applies a masking function on the fly, returning ***-**-6789.

The underlying file is unchanged, but the junior analyst cannot see the true data through the engine.

Preservation of Format and Logic

A poorly designed masking strategy can break downstream systems. If a pipeline replaces a 9-digit Social Security Number with the word “REDACTED”, downstream applications expecting an integer may fail. Format-preserving masking keeps data formats intact. It replaces a 9-digit integer with a randomly generated 9-digit integer. Furthermore, it preserves Referential Integrity. If the true string john.doe@gmail.com is masked to X19@mask.com in the Users table, a deterministic masking function masks it to the same X19@mask.com in the Orders table, so data scientists can still execute JOIN operations across tables without ever knowing John’s true identity.

Summary of Technical Value

Data Masking is a key mechanism for balancing enterprise analytics with legal compliance. By using physically altered Static environments for software development, and Dynamic masking at query time for live production analytics, Data Masking lets organizations get value from their data while limiting the exposure of sensitive consumer information.

Learn More

To learn more about the Data Lakehouse, read The Lakehouse Built for Everyone by Alex Merced. You can find this and other books by Alex Merced at books.alexmerced.com.

Work with Alex