Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

非数据方能对数据进行查询吗? #120

Closed
WandQ opened this issue Jul 25, 2023 · 7 comments
Closed

非数据方能对数据进行查询吗? #120

WandQ opened this issue Jul 25, 2023 · 7 comments

Comments

@WandQ
Copy link

WandQ commented Jul 25, 2023

比如
Alice有表ta,有一列ID,执行授权:
GRANT SELECT PLAINTEXT_AFTER_JOIN(id) ON demo.ta TO carol
GRANT SELECT PLAINTEXT_AFTER_JOIN(id) ON demo.ta TO bob

Bob有表tb,有一列ID,执行授权:
GRANT SELECT PLAINTEXT_AFTER_JOIN(id) ON demo.tb TO carol
GRANT SELECT PLAINTEXT_AFTER_JOIN(id) ON demo.tb TO alice

Carol没有表,提交sql:select ta.id from ta INNER JOIN tb on ta.id=tb.id;

我试验报错:
[demo]carol> select ta.id from ta INNER JOIN tb on ta.id=tb.id
[fetch]err: Code: 300, message:ccl check failed: the 1th column demo.ta.id in the result is not visibile (PLAINTEXT_AFTER_JOIN) to party carol

上面这个场景理论上可行吗?是不是我的配置错了

@WandQ WandQ closed this as not planned Won't fix, can't repro, duplicate, stale Jul 25, 2023
@WandQ WandQ closed this as completed Jul 25, 2023
@WandQ WandQ reopened this Jul 25, 2023
@WandQ WandQ closed this as completed Jul 25, 2023
@jingshi-ant
Copy link
Contributor

原因:当前的PLAINTEXT_AFTER_JOIN有特殊限制(其它的没有):只有数据提供方能获得join后的plaintext权限。主要是出于安全上的考量,因为join后相当于交集对对方可见。
另外:请教下你们是存在问题里的业务场景、需求吗?方便的话,能否补充下相关背景信息?(不涉密可公开信息)

@WandQ
Copy link
Author

WandQ commented Jul 26, 2023

我们可能存在如下业务场景:
数据使用方A,数据提供方B,数据提供方C
A要基于B和C的数据进行数据圈人,可能A需要拿到的就是身份信息而不是统计信息。比如B有金融数据,C有户籍数据,A想知道户籍为某市,存款大于某数的名单,B和C都愿意配合做这个事情,但是不能泄露额外的数据。

@WandQ WandQ reopened this Jul 26, 2023
@WandQ
Copy link
Author

WandQ commented Jul 26, 2023

我能否修改SCDB的代码取消这个限制,能否告知在哪里修改?要修改的地方多吗

@jingshi-ant
Copy link
Contributor

感谢反馈。我们内部也会进行沟通,判断下提供配置开关取消限制。
修改的话有点繁琐,可以参考如下逻辑,这里限制了DataSourceParty(数据提供方)才能进行ccl的推演(ccl.Join 到 ccl.Plain):https://github.com/secretflow/scql/blob/main/pkg/interpreter/translator/build_ccl.go#L96

@jingshi-ant
Copy link
Contributor

补充下安全性上的风险:如果不限定数据参与方,只要经过join操作就放开ccl.Join的话,会有这种风险:carol 通过 alice的表自join,直接获取id列的所有信息:select t1.id from ta as t1 INNER JOIN ta as t2 on t1.id=t1.id;
如果容忍这种风险,可以考虑字节对carol授权plaintext ccl。

@WandQ
Copy link
Author

WandQ commented Jul 26, 2023

补充下安全性上的风险:如果不限定数据参与方,只要经过join操作就放开ccl.Join的话,会有这种风险:carol 通过 alice的表自join,直接获取id列的所有信息:select t1.id from ta as t1 INNER JOIN ta as t2 on t1.id=t1.id; 如果容忍这种风险,可以考虑字节对carol授权plaintext ccl。

原来是这方面考虑,0.0,了解了,感谢解答。

@WandQ
Copy link
Author

WandQ commented Jul 26, 2023

感谢反馈。我们内部也会进行沟通,判断下提供配置开关取消限制。 修改的话有点繁琐,可以参考如下逻辑,这里限制了DataSourceParty(数据提供方)才能进行ccl的推演(ccl.Join 到 ccl.Plain):https://github.com/secretflow/scql/blob/main/pkg/interpreter/translator/build_ccl.go#L96

好的,我研究一下感谢🙏

@WandQ WandQ closed this as completed Jul 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants