[MXS-2508] Using DIV function in query produces an error Created: 2019-05-27  Updated: 2020-03-07  Resolved: 2020-03-03

Status: Closed
Project: MariaDB MaxScale
Component/s: dbfwfilter, Filter, qc_sqlite
Affects Version/s: None
Fix Version/s: 2.4.8

Type: Bug Priority: Major
Reporter: Alexandr Hacicheant Assignee: Johan Wikman
Resolution: Fixed Votes: 0
Labels: None

Sprint: MXS-SPRINT-101

 Description   

I've noticed that queries with DIV function produces an error

The statement could not be fully parsed and will hence be rejected (masking filter).

The query is:

select UNIX_TIMESTAMP() DIV 20;

The error produces when filters (Column-Masking and/or Firewall-Blacklist) are enabled, but it works when no filters are enabled.



 Comments   
Comment by Alexandr Hacicheant [ 2019-05-27 ]

Column-masking config is:

{
   "rules": [
       {
           "replace": {
                "column": "email"
           },
           "with": {
               "fill": "*"
           }
       },
       {
           "replace": {
                "column": "firstName"
           },
           "with": {
               "fill": "*"
           }
       },
       {
           "replace": {
                "column": "lastName"
           },
           "with": {
               "fill": "*"
           }
       },
       {
           "replace": {
                "column": "birthDate"
           },
           "with": {
               "fill": "*"
           }
       },
       {
           "replace": {
                "column": "address"
           },
           "with": {
               "fill": "*"
           }
       },
       {
           "replace": {
                "column": "zip"
           },
           "with": {
               "fill": "*"
           }
       },
       {
           "replace": {
                "column": "phone"
           },
           "with": {
               "fill": "*"
           }
       },
       {
           "replace": {
                "column": "idNumber"
           },
           "with": {
               "fill": "*"
           }
       },
       {
           "replace": {
                "column": "agreement"
           },
           "with": {
               "fill": "*"
           }
       }
   ]
}

Comment by Alexandr Hacicheant [ 2019-05-27 ]

Firewall blacklist:

rule USERS deny columns email
rule PERSONS deny columns firstName lastName birthDate address zip phone idNumber agreement
 
users %@% match any rules USERS PERSONS

Comment by Alexandr Hacicheant [ 2019-05-27 ]

Receive this error when masking filter is disabled:
Query: select UNIX_TIMESTAMP() DIV 20;

Access denied for user 'user'@'192.168.XX.XXX': Query could not be parsed completely and will hence be rejected. Please ensure that the SQL syntax is correct.

Generated at Thu Feb 08 04:14:38 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.