DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
View Events Video Library
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Migrate, Modernize and Build Java Web Apps on Azure: This live workshop will cover methods to enhance Java application development workflow.

Modern Digital Website Security: Prepare to face any form of malicious web activity and enable your sites to optimally serve your customers.

Kubernetes in the Enterprise: The latest expert insights on scaling, serverless, Kubernetes-powered AI, cluster security, FinOps, and more.

A Guide to Continuous Integration and Deployment: Learn the fundamentals and understand the use of CI/CD in your apps.

Related

  • Leveraging "INSERT INTO ... RETURNING": Practical Scenarios
  • Using the PostgreSQL Pager With MariaDB Xpand
  • Distributed SQL: An Alternative to Database Sharding
  • Building a 24-Core Docker Swarm Cluster on Banana Pi Zero

Trending

  • The Most Valuable Code Is the Code You Should Not Write
  • A Comprehensive Approach to Performance Monitoring and Observability
  • CodeCraft: Agile Strategies for Crafting Exemplary Software
  • Examining Use Cases for Asynchronous APIs: Webhooks and WebSockets
  1. DZone
  2. Data Engineering
  3. Databases
  4. Sensitive Data Masking With MariaDB MaxScale

Sensitive Data Masking With MariaDB MaxScale

Data redaction obfuscates data, reducing unnecessary exposure of sensitive data while maintaining its usability. Learn how to redact data using a masking filter.

Dipti Joshi user avatar by
Dipti Joshi
·
Aug. 17, 17 · Tutorial
Like (7)
Save
Tweet
Share
4.8K Views

Join the DZone community and get the full member experience.

Join For Free

Protecting personal and sensitive data and complying with security and privacy regulations is a high priority for organizations. This includes personally identifiable information (PII), protected health information (PHI), payment card information (subject to PCI-DSS regulation), and intellectual property (subject to ITAR and EAR regulations). In many cases, if not most, it needs to be redacted or masked when accessed (internally and/or externally).

Data redaction obfuscates all or part of the data, reducing unnecessary exposure of sensitive data while at the same time maintaining its usability. Various terms such as data masking, data obfuscation, and data anonymization are used to describe this functionality in databases. Data redaction allows an organization to:

  • Meet regulations.
  • Protect against insider threat.
  • Use production data for non-production use cases (for example, testing and training).

MariaDB TX and MariaDB AX are complete solutions for high performance transactional and analytical workloads, respectively. Included in both of these solutions is MariaDB MaxScale, a next-generation database proxy. In addition to load balancing and query routing, this database proxy provides enhanced security, like encryption of data in flight and masking of sensitive end user data.  

In this blog, we show you how to redact data using the masking filter in MariaDB MaxScale.

Data Masking

With the masking filter, the value of a particular column returned by a query can be obfuscated. For instance, suppose there is a table patients that, among other columns, contains the column ssn where the social security number or national identification number of a patient is stored. With the masking filter, it is possible to specify that when the ssn field is queried, a masked value is returned instead of actual ssn. 

For example:

> SELECT name, ssn FROM patients; 

Without masking of SSN column, query result would be:

+-------+-------------+
+ name  | ssn         |
+-------+-------------+
| Alice | 721-07-4426 |
| Bob   | 435-22-3267 |
...

And with masking of SSN column, the query result would be:

+-------+-------------+
+ name  | ssn         |
+-------+-------------+
| Alice | XXXXXXXXXXX |
| Bob   | XXXXXXXXXXX |
...

An example configuration of masking filter in MaxScale configuration looks like the following:

[MyMasking]
type=filter
module=masking
warn_type_mismatch=always
large_payload=abort
rules=masking_rules.json

[MyService]
type=service
...
filters=MyMasking

And the masking_rules.json will look like this

{
   "rules": [
       {
           "replace": {
               "column": "ssn"
           },
           "with": {
               "fill": "X"
           }
       }
   ]
}

Now doing the following query will show masked data for the ssn column:

> select name, ssn from patients;
+---------------+--------------+
| name          | ssn          |
+---------------+--------------+
| John Doe      | XXXXXXXXXXX  |
| Jack Smith    | XXXXXXXXXXX  |
| Jane Richards | XXXXXXXXXXX  |
+---------------+--------------+
> select * from patients;
+------+---------------+-------------+--------+-------+ 
| id   | name          | ssn         | gender | age  | 
|+------+--------------+-------------+--------+-------+
|    1 | John Doe      | XXXXXXXXXXX | M      |   55 |
|    2 | Jack Smith    | XXXXXXXXXXX | M      |   38 |
|    3 | Jane Richards | XXXXXXXXXXX | F      |   48 |
+------+---------------+-------------+--------+-------+
> select name, ssn as xyz from patients;
+---------------+--------------+
| name          | xyz          |
+---------------+--------------+
| John Doe      | XXXXXXXXXXX  |
| Jack Smith    | XXXXXXXXXXX  |
| Jane Richards | XXXXXXXXXXX  |
+---------------+--------------+

We have additional enhancements planned for the masking filter in the next release (MariaDB MaxScale 2.2), including partial data masking. 

For details on how to setup the rules, please see MariaDB MaxScale masking filter guide.

If you would like to prevent users from using functions on columns to be masked, you may use the database firewall filter to block such queries. For details on how to configure black-listing and white-listing rules with firewall filter, please see MariaDB MaxScale Database Firewall filter guide.

Data masking MariaDB Database

Published at DZone with permission of Dipti Joshi, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Leveraging "INSERT INTO ... RETURNING": Practical Scenarios
  • Using the PostgreSQL Pager With MariaDB Xpand
  • Distributed SQL: An Alternative to Database Sharding
  • Building a 24-Core Docker Swarm Cluster on Banana Pi Zero

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: