Dynamic Data Masking

Dynamic Data Masking at Query Time

Different users see different data from the same database. Without schema changes.

Dynamic data masking (DDM) intercepts database queries and masks sensitive values in responses based on the caller's access policy. The underlying data is unchanged — masking happens transparently at query time, applied at the data layer rather than in application code. DBsafe's DDM engine enables fine-grained data visibility policies without schema changes, application modifications, or data duplication.

Zero
schema changes required to implement dynamic masking
Sub-ms
masking overhead per query in DBsafe's proxy architecture
HIPAA
minimum necessary standard addressed by role-based dynamic masking
10x
more efficient than maintaining multiple masked database copies
The Challenge

Different users need different visibility into the same data

A customer service representative needs to see the last four digits of a customer's phone number for verification — not the full number. A data analyst needs to see purchasing behaviour but not names or email addresses. A developer needs to run queries against realistic data but must not see real identity information.

Maintaining separate masked copies of a database for each access tier is expensive and operationally complex. Dynamic masking solves this by applying different masking rules to the same database depending on who is querying it, in real time.

The cost of inaction

All-or-nothing access model forces over-provisioning of sensitive data access

Maintaining multiple masked copies creates database sprawl and synchronisation overhead

HIPAA minimum necessary standard violated when full PHI is returned where partial view suffices

GDPR data minimisation principle violated by returning more data than the use case requires

The DBsafe Approach

How DBsafe implements dynamic data masking

01
01

Define role-based masking policies

Configure masking rules per role: which columns are masked for which roles, what masking technique is applied, and whether any unmasked access is permitted. Policies are defined centrally and apply to all queries from users in that role.

02
02

Intercept and transform queries

DBsafe's proxy layer sits between your application and database. Every query passes through the proxy, which applies masking transformations to the result set based on the authenticated user's role. Latency overhead is sub-millisecond.

03
03

Monitor and audit masked access

All masked queries are logged with full context: user identity, role, query text, and which masking transformations were applied. Access audits show exactly who saw what at every point in time.

Architecture of dynamic data masking

DBsafe implements DDM through a query proxy layer. Applications connect to DBsafe's proxy instead of directly to the database. The proxy authenticates the user, determines their role and associated masking policy, executes the query against the underlying database, and transforms the result set before returning it to the application. The transformation is invisible to the application: it receives a valid response in the expected format, with sensitive values replaced according to the policy.

This architecture has several advantages over database-native DDM implementations. It is database-agnostic, working consistently across PostgreSQL, MySQL, SQL Server, Oracle, and more. It provides centralised policy management across all databases. And it enables richer masking techniques than native database DDM typically supports.

Role-based masking policies

Masking policies in DBsafe are defined at the role level, not the user level. A customer service role might see email addresses masked as a***@***.com. An analyst role might see email addresses completely removed and replaced with a pseudonymous identifier. An administrator role might see full data. Engineers working on a specific project might receive access to specific columns in plaintext for a defined period.

Policies can include conditions beyond role membership: IP address ranges, time-of-day restrictions, authentication strength requirements. This enables adaptive masking policies that respond to the context of access, not just the identity of the user.

Dynamic masking versus static masking

Static masking creates a permanent altered copy of data. Dynamic masking applies transformations at query time without changing the source data. The right choice depends on the use case. For development environments that need a complete database copy, static masking is appropriate. For production systems where different users need different visibility into live data, dynamic masking is the correct approach.

Dynamic masking is particularly valuable for analytics platforms, data warehouses, and reporting systems where the same underlying tables serve users with different data access privileges.

Performance characteristics of dynamic masking

A common concern about proxy-based DDM is latency. DBsafe's masking engine is built for high-throughput production environments. Masking transformations are applied in-memory, adding sub-millisecond overhead per query for typical result sets. Bulk exports with very large result sets require proportionally more processing time, but DBsafe's streaming architecture handles these without accumulating full result sets in memory.

The proxy can be deployed as a high-availability cluster with horizontal scaling, ensuring that masking does not become a bottleneck as query volumes grow.

Compliance use cases for dynamic masking

Dynamic masking directly addresses several regulatory requirements. HIPAA's minimum necessary standard requires that access to PHI be limited to the minimum necessary for the intended use. A clinician querying a patient record for appointment scheduling does not need the full record. Dynamic masking enforces this at the query layer.

GDPR's data minimisation principle requires that personal data be adequate, relevant, and limited to what is necessary. Dynamic masking enables organisations to serve data requests while automatically removing fields that are not necessary for the stated purpose, without application code changes.

Implementing DDM without application code changes

One of the most valuable properties of DBsafe's DDM implementation is that it requires no application code changes. Applications connect to the proxy using the same connection string and protocol as the underlying database. Masking is applied transparently. This means DDM can be deployed in hours against existing applications without a development sprint.

For legacy applications where modifying access control logic is impractical, DDM provides a way to implement data minimisation without touching application code. The proxy becomes the enforcement point, regardless of how the application was built.

Platform Capabilities

Everything you need to address dynamic data masking — in one integrated platform.

Query-Time Masking

Mask sensitive values in query results based on the caller's role, transparently and in real time.

Role-Based Policies

Define masking rules per role. Different roles see different data from the same query.

Zero Schema Changes

DDM works at the proxy layer. No database schema modifications or application code changes required.

Sub-Millisecond Overhead

High-performance masking engine adds negligible latency to production queries.

Complete Query Audit

Log every masked query with user identity, role, and masking transformations applied.

Database-Agnostic

Consistent DDM behaviour across PostgreSQL, MySQL, SQL Server, Oracle, and more.

Frequently Asked Questions

Answers to the most common questions about dynamic data masking.

What is dynamic data masking?

Dynamic data masking is a technique that masks sensitive data in query results at runtime based on the requesting user's access policy. The underlying data in the database is unchanged. Different users executing the same query may receive different responses depending on their role and associated masking policy.

How does dynamic masking differ from row-level security?

Row-level security restricts which rows a user can see. Dynamic masking restricts which column values a user can see within the rows they are permitted to access. Both can be used together: row-level security controls access to records, while dynamic masking controls the detail visible within accessible records.

Does dynamic masking affect query performance?

DBsafe's DDM proxy adds sub-millisecond overhead per query for typical result sets. The masking is applied in-memory as data passes through the proxy. For high-throughput applications, the proxy can be deployed as a horizontally scaled cluster to ensure masking does not become a bottleneck.

Can applications detect that dynamic masking is applied?

Applications receive valid, correctly formatted values in all masked columns. A masked email address is a syntactically valid email address; a masked phone number is a valid phone number. Applications cannot distinguish masked values from real ones by format alone, which means existing application logic continues to work correctly.

Does DBsafe's DDM work with stored procedures and views?

Yes. DBsafe's proxy intercepts the query result regardless of whether it originates from a direct query, a stored procedure, a view, or an ORM. Masking is applied to the result set before it is returned to the application, independent of how the query was generated.

Ready in 5 minutes

Give every user exactly the data they need — nothing more

Dynamic masking enforces the principle of least privilege at the data layer, with zero application code changes required.