[MXS-4162] EXPLAIN does not work with masking filter Created: 2022-06-09  Updated: 2022-09-22  Resolved: 2022-06-23

Status: Closed
Project: MariaDB MaxScale
Component/s: masking
Affects Version/s: 2.5, 6.2.4
Fix Version/s: 22.08.0

Type: Bug Priority: Major
Reporter: Valerii Kravchuk Assignee: Johan Wikman
Resolution: Fixed Votes: 0
Labels: None

Sprint: MXS-SPRINT-160

 Description   

It seems EXPLAIN is not handled by masking filter at all and we get:

ERROR 1141 : The statement could not be fully parsed and will hence bee rejected (masking filter)

even for simple

explain select * from T;

where T is not involved in any masking rules. Same probably applies to ANALYZE and is not documented in our KB as a limitation:

https://mariadb.com/kb/en/mariadb-maxscale-6-masking/#limitations



 Comments   
Comment by Valerii Kravchuk [ 2022-06-09 ]

Setting

require_fully_parsed=false

seems to be a workaround.

Comment by Johan Wikman [ 2022-06-14 ]

require_fully_parsed=false is a workaround, although it does mean that you may be able to bypass the masking. E.g. you use a function for hiding the column name that should be masked in a statement that MaxScale fails to parse.

Just for the record, the problem is in the parser, based upon sqlite3, that MaxScale uses. Sqlite3 does not know the EXPLAIN statement as it is in MariaDB but it is recognized merely based on the presence of the EXPLAIN keyword. That's sufficient for routing purposes because the EXPLAIN can simply be sent to any slave as it does not modify anything. However, that causes the masking filter to reject the statement since it wasn't parsed. The proper fix would be to extend the parser, but a straightforward change of the grammar causes numerous parsing conflicts, so adding support for EXPLAIN is much harder than what one might assume. So the feasible fix is for the masking filter to pass a statement directly through if it is EXPLAIN or ANALYZE irrespective of whether the whole statement could be parsed or not.

Comment by Johan Wikman [ 2022-06-23 ]

From 22.08.0 onward all EXPLAIN, DESCRIBE and ANALYZE statements will be passed through, as they do not return any user data.

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