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 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
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
Partner Zones AWS Cloud
by AWS Developer Relations
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
Partner Zones
AWS Cloud
by AWS Developer Relations
The Latest "Software Integration: The Intersection of APIs, Microservices, and Cloud-Based Systems" Trend Report
Get the report
Content provided by MariaDB logo

Masking Means Prevention

Learn more about the masking feature in MariaDB MaxScale 2.1.

Johan Wikman user avatar by
Johan Wikman
·
May. 01, 19 · Presentation
Like (1)
Save
Tweet
Share
4.31K Views

With the masking filter that was introduced in MariaDB MaxScale 2.1, it is possible to mask columns so that, although the columns themselves are visible to clients, the data in those columns are not. For instance, we can arrange things so that a query like:

SELECT name, ssn, FROM person

does not return a result like:

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

But instead, it gives us something like:

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

Taking the masking filter into use is quite straightforward. In the configuration file, you need to specify a section for the filter as follows:

[Masking]
type=filter
module=masking
rules=masking.json 

The rules parameter specifies a file where the actual masking rules are. The rules are specified using JSON, and the following is sufficient in order to unconditionally mask the values of all columns whose name is ssn.

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

The possibilities for specifying the rules are quite versatile and are explained in detail in the MaxScale documentation.

Up until MaxScale 2.2, the masking could be circumvented. All you needed to do was to access the column using a function.

SELECT name, concat(ssn) FROM person

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

The reason was that as the masking acted strictly on the result set, using a function would hide the column name, thus preventing the masking filter from masking the value. This behavior could be prevented by manually setting up a firewall filter for preventing the use of functions or some specific functions, but that was quite laborious and cumbersome.

In MaxScale 2.3, the most recent GA version of MaxScale available as part of MariaDB Platform X3, this has been greatly simplified as the masking filter now by default rejects statements that use functions in conjunction with columns that should be masked. With MaxScale 2.3 the result is as follows:

SELECT name, concat(ssn) FROM person

ERROR 1141 (HY000): The function concat is used in conjunction with a field that should be masked for 'user'@'127.0.0.1', access is denied.

This behavior is controlled with the new configuration parameter prevent_function_usage whose default value is true. If a blanket rejection of all functions is too coarse an approach, then by setting the value to false and by configuring a separate firewall filter, function usage can be controlled in a more detailed manner.


Comments

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

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

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: