Open raviann opened 5 years ago
This falls under the umbrella of https://github.com/prestosql/presto/issues/18. Our plan is not to expose connectors to the AST, but to allow them to supply additional filters or projections base on authorization. There are multiple reasons why exposing the ASI to connectors is problematic:
Terms AST - abstract syntax tree
Description Today one can provide custom authorisation by implementing io.prestosql.spi.security.SystemAccessControl in the plugin form. SystemAccessControl does support allow/deny kind of use-cases, which does not suffice for filter-masking and other use cases being required by 3rd party authorisation plugins
To support them, it would require AST rewrite, and today it is not pluggable either. We should make AST rewrite pluggable i.e io.prestosql.sql.rewrite.StatementRewrite.Rewrite to support the use-cases mentioned below
Use-cases
select id, quantity, amount from orders
Modified query:select id, quantity, amount from (select id, mask(quantity), amount from orders where amount < 10000)orders
select name, salary from accounts where salary> 10000;
Modified query:select name, decrypt(salary) from accounts where decrypt(salary)> 10000;
select name, age from employee where age < 40
Modified query:select name, mask(age) from (select name, age from employee where id > 100 and location='US' and age > 30 )employee where age< 40