apache / apache/iotdb

[v0.12.4]用户与角色UDF权限赋予问题,非root用户查询返回空值时,报错"Msg: 602: No permissions for this operation UDTF"

Open
#4,399 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
6.4k
Forks
1.2k
Avg merge
1d 23h
Merged PRs (30d)
115

Description

**Describe the bug**
iotdb 0.12.4修复了0.12.2版本中用户与角色UDF权限赋予非root无法正确生效的问题,可参考[Issue-4308](https://github.com/apache/iotdb/issues/4308)。但是当我们使用非root用户进行UDF查询时,如果查询的值不存在,依然报错"Msg: 602: No permissions for this operation UDTF"。这会给用户误导。希望可以在新版本中修复。

**To Reproduce**
Steps to reproduce the behavior:
1. 使用root用户登录sbin/start-cli.sh -h 127.0.0.1 -p 6667 -u root -pw root
2. 创建非root用户并赋权:
CREATE ROLE udtf_test 'udtf_passwd'
CREATE ROLE udtf_test_role
GRANT ROLE udtf_test_role PRIVILEGES 'SET_STORAGE_GROUP','CREATE_TIMESERIES','INSERT_TIMESERIES','READ_TIMESERIES','DELETE_TIMESERIES','DROP_FUNCTION','CREATE_FUNCTION' ON root.test
GRANT udtf_test_role TO udtf_test

3. 使用root用户查询:
select WTUR_PwrAt_Ra_F32 from root.test.20.123456789 where time >= 2021-01-01 and time<= 2021-01-31 23:59:59
+----+
|Time|
+----+
+----+

4. 使用udtf_test用户查询:Msg: 602: No permissions for this operation UDTF。

5. 执行命令,导入数据:
insert into root.test.20.123456789(time, WTUR_PwrAt_Ra_F32) values(1,1)
6. root用户和用户分别使用相同命令查询,得到相同的结果如下:
select WTUR_PwrAt_Ra_F32 from root.test.20.123456789 where time >= 2021-01-01 and time<= 2021-01-31 23:59:59
+----+-----------------------------------------+
|Time|root.test.20.123456789.WTUR_PwrAt_Ra_F32|
+----+-----------------------------------------+
+----+-----------------------------------------+

**Expected behavior**
非root用户查询空表格时,应正确返回空值,而非报权限错误,这会使用户产生误解。

Desktop (please complete the following information):

OS: Amazon Linux

Contributor guide

Open the contributing guide

Research direction

Reproduce the report with sbin/start-cli.sh using the provided role grants and UDF query, first with an empty table and then after inserting data. Read Issue-4308 for related permission handling and trace the UDF authorization path. Done means an authorized non-root user receives an empty result, not a misleading permission error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, sql
Domain
authorization, databases, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.