Uploaded image for project: 'MariaDB MaxScale'
  1. MariaDB MaxScale
  2. MXS-1733

Data masking does not work with UNION queries

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.3
    • Fix Version/s: 2.2.4
    • Component/s: Filter, masking
    • Labels:
      None

      Description

      I'm not sure if it's a bug, but I have a problem with data masking filter when query contains UNION.

      CREATE TABLE `users` ( `id` INT NOT NULL AUTO_INCREMENT , `name` VARCHAR(255) NOT NULL , `email` VARCHAR(255) NOT NULL , PRIMARY KEY (`id`)) ENGINE = InnoDB;
      INSERT INTO `users` (`name`,`email`) VALUES ('John', 'john@example.com'),('Max', 'max@example.com'),('Peter', 'peter@example.com');
       
      mysql> select * from users;
      +----+-------+-------------------+
      | id | name  | email             |
      +----+-------+-------------------+
      |  1 | John  | ****************  |
      |  2 | Max   | ***************   |
      |  3 | Peter | ***************** |
      +----+-------+-------------------+
      3 rows in set (0.00 sec)
      

      The UNION issue:

      mysql> select * from users where id = 1 union select * from users where id = 2;
      +----+------+------------------+
      | id | name | email            |
      +----+------+------------------+
      |  1 | John | john@example.com |
      |  2 | Max  | max@example.com  |
      +----+------+------------------+
      2 rows in set (0.00 sec)
      

      Config:

      [Column-Masking]
      type=filter
      module=masking
      warn_type_mismatch=always
      large_payload=abort
      rules=/etc/maxscale.d/masking_rules.json
      

      masking_rules.json contains:

      {
         "rules": [
             {
                 "replace": {
                     "table": "users",
                     "column": "email"
                 },
                 "with": {
                     "fill": "*"
                 }
             }
         ]
      }
      

      If remove table definition "table": "users" it works fine

        Attachments

          Activity

            People

            Assignee:
            johan.wikman Johan Wikman
            Reporter:
            disc Alexandr Hacicheant
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Git Integration