StarRocks / starrocks

StarRocks, a Linux Foundation project, is a next-generation sub-second MPP OLAP database for full analytics scenarios, including multi-dimensional analytics, real-time analytics, and ad-hoc queries.
https://starrocks.io
Apache License 2.0
8.67k stars 1.75k forks source link

column mask and row filter #1810

Closed yiluoya closed 2 years ago

yiluoya commented 2 years ago

Feature request

column masking example:

customer table as follow ,the telephone num is sensitive ,don't want be select by user A。 but user B can view all data。 image

solution : add function at table customer column telephone for user A。 then user A do : select * from customer : image

at user B's view: select * from customer : image

row filter

example :table order image

hope user A only can view data ‘省份’ is ‘湖南’。

solution :
add express at table order for user A then when user A do : select * from order
image



next is i implement example:

CREATE  database ods;
use ods;

CREATE TABLE test_chen
(
a varchar(10)
,b int 
)
ENGINE=olap
DISTRIBUTED BY HASH(a) BUCKETS 32
PROPERTIES(
"storage_type"="column",
"replication_num"="1"
);

insert into test_chen values("1",1);
insert into test_chen values("2",2);
insert into test_chen values("3",-1);`

row filter :
`>> GRANT FILTER_POLICY ON  ods.test_chen TO 'root'  WITH a > 1;
>> SELECT * FROM ods.test_chen tc ;

image

column mask: GRANT MASK_POLICY ON ods.test_chen TO 'root' COLUMN b WITH abs(b);

image

show grants SHOW GRANTS for 'root' image

policy revoke

REVOKE FILTER_POLICY  ON  ods.test_chen FROM 'root'  
REVOKE MASK_POLICY ON  ods.test_chen FROM 'root' COLUMN b

image

propose: is it a good way use mask_priv/filter_priv to grant ?

for huawei gsDB

https://support.huaweicloud.com/devg2-dws/dws_0402_0042.html SELECT DBMS_REDACT.add_policy

for hive /presto user range image

wuqiao commented 2 years ago

Feature request

我们正打算使用starrocks,但是我们场景中会用到行过滤和字段加密, 自己也在研究这一块的东西。 如果完全自己做,可能不方便升级,所以希望社区能给个规范和接口,后面代码完成后想将代码提交给社区。

主要涉及的点 1、语法和词法类cup, 基于grant 做 需要修改 定义规则, 另起一套也行, 也可以基于ranger。 2、分析器, 需要对 queryStmt 等 进行修改。

希望社区开发,或者制定一个规则。

谢谢

you can join StarRocks Community Slack Chanel ,Let's discuss it in detail:https://join.slack.com/t/starrocks/shared_invite/zt-z5zxqr0k-U5lrTVlgypRIV8RbnCIAzg

yiluoya commented 2 years ago

Feature request

我们正打算使用starrocks,但是我们场景中会用到行过滤和字段加密, 自己也在研究这一块的东西。 如果完全自己做,可能不方便升级,所以希望社区能给个规范和接口,后面代码完成后想将代码提交给社区。 主要涉及的点 1、语法和词法类cup, 基于grant 做 需要修改 定义规则, 另起一套也行, 也可以基于ranger。 2、分析器, 需要对 queryStmt 等 进行修改。 希望社区开发,或者制定一个规则。 谢谢

you can join StarRocks Community Slack Chanel ,Let's discuss it in detail:https://join.slack.com/t/starrocks/shared_invite/zt-z5zxqr0k-U5lrTVlgypRIV8RbnCIAzg

thank you

yiluoya commented 2 years ago

我已经基本完成了这个特性,问一下怎么发起一次讨论

github-actions[bot] commented 2 years ago

We have marked this issue as stale because it has been inactive for 18 months. If this issue is still relevant, removing the stale label or adding a comment will keep it active. Otherwise, we'll close it in 10 days to keep the issue queue tidy. Thank you for your contribution to StarRocks!