You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by GitBox <gi...@apache.org> on 2022/12/07 09:56:24 UTC

[GitHub] [incubator-kyuubi] MLikeWater opened a new issue, #3925: [Bug] [authZ] Don't have permissions to create UDF functions when not specify a database name

MLikeWater opened a new issue, #3925:
URL: https://github.com/apache/incubator-kyuubi/issues/3925

   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
   
   
   ### Search before asking
   
   - [X] I have searched in the [issues](https://github.com/apache/incubator-kyuubi/issues?q=is%3Aissue) and found no similar issues.
   
   
   ### Describe the bug
   
   ##  Env
   Spark version:3.2.2
   Kyuubi version: apache-kyuubi-1.7.0-SNAPSHOT-bin (master)/apache-kyuubi-1.6.1 release
   
   ## reproduce
   ```
   add jar hdfs://cluster1/warehouse/udfs/test-udf-1.0.jar;
   create function test_udf as 'com.dt.hive.udfs.TestUDF' using jar "hdfs://cluster1/warehouse/udfs/test-udf-1.0.jar";
   
   Caused by: org.apache.kyuubi.plugin.spark.authz.AccessControlException: Permission denied: user [test_user] does not have [create] privilege on [test_udf]
       at org.apache.kyuubi.plugin.spark.authz.ranger.SparkRangerAdminPlugin$.verify(SparkRangerAdminPlugin.scala:128)
       at org.apache.kyuubi.plugin.spark.authz.ranger.RuleAuthorization$.$anonfun$checkPrivileges$5(RuleAuthorization.scala:94)
       at org.apache.kyuubi.plugin.spark.authz.ranger.RuleAuthorization$.$anonfun$checkPrivileges$5$adapted(RuleAuthorization.scala:93)
       at scala.collection.mutable.ResizableArray.foreach(ResizableArray.scala:62)
       at scala.collection.mutable.ResizableArray.foreach$(ResizableArray.scala:55)
       at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:49)
       at org.apache.kyuubi.plugin.spark.authz.ranger.RuleAuthorization$.checkPrivileges(RuleAuthorization.scala:93)
       at org.apache.kyuubi.plugin.spark.authz.ranger.RuleAuthorization.apply(RuleAuthorization.scala:36)
       at org.apache.kyuubi.plugin.spark.authz.ranger.RuleAuthorization.apply(RuleAuthorization.scala:33)
       at org.apache.spark.sql.catalyst.rules.RuleExecutor.$anonfun$execute$2(RuleExecutor.scala:211)
       at scala.collection.LinearSeqOptimized.foldLeft(LinearSeqOptimized.scala:126)
       at scala.collection.LinearSeqOptimized.foldLeft$(LinearSeqOptimized.scala:122)
       at scala.collection.immutable.List.foldLeft(List.scala:91)
       at org.apache.spark.sql.catalyst.rules.RuleExecutor.$anonfun$execute$1(RuleExecutor.scala:208)
       at org.apache.spark.sql.catalyst.rules.RuleExecutor.$anonfun$execute$1$adapted(RuleExecutor.scala:200)
       at scala.collection.immutable.List.foreach(List.scala:431)
       at org.apache.spark.sql.catalyst.rules.RuleExecutor.execute(RuleExecutor.scala:200)
       at org.apache.spark.sql.catalyst.rules.RuleExecutor.$anonfun$executeAndTrack$1(RuleExecutor.scala:179)
       at org.apache.spark.sql.catalyst.QueryPlanningTracker$.withTracker(QueryPlanningTracker.scala:88)
       at org.apache.spark.sql.catalyst.rules.RuleExecutor.executeAndTrack(RuleExecutor.scala:179)
       at org.apache.spark.sql.execution.QueryExecution.$anonfun$optimizedPlan$1(QueryExecution.scala:125)
       at org.apache.spark.sql.catalyst.QueryPlanningTracker.measurePhase(QueryPlanningTracker.scala:111)
       at org.apache.spark.sql.execution.QueryExecution.$anonfun$executePhase$1(QueryExecution.scala:183)
       at org.apache.spark.sql.SparkSession.withActive(SparkSession.scala:775)
       at org.apache.spark.sql.execution.QueryExecution.executePhase(QueryExecution.scala:183)
       at org.apache.spark.sql.execution.QueryExecution.optimizedPlan$lzycompute(QueryExecution.scala:121)
       at org.apache.spark.sql.execution.QueryExecution.optimizedPlan(QueryExecution.scala:117)
       at org.apache.spark.sql.execution.QueryExecution.assertOptimized(QueryExecution.scala:135)
       at org.apache.spark.sql.execution.QueryExecution.executedPlan$lzycompute(QueryExecution.scala:153)
       at org.apache.spark.sql.execution.QueryExecution.executedPlan(QueryExecution.scala:150)
       at org.apache.spark.sql.execution.QueryExecution.simpleString(QueryExecution.scala:201)
   ```
   If specify a database name, create udf function is normal:
   ```
   create function testdb.test_udf as 'com.dt.hive.udfs.TestUDF' using jar "hdfs://cluster1/warehouse/udfs/test-udf-1.0.jar";
   show user functions;
   +-----------------------+
   |       function        |
   +-----------------------+
   | engine_id             |
   | engine_name           |
   | kyuubi_version        |
   | session_user          |
   | system_user           |
   | testdb.test_udf       |
   +-----------------------+ 
   ```
   
   
   ### Affects Version(s)
   
   1.7.0(master branch)
   
   ### Kyuubi Server Log Output
   
   _No response_
   
   ### Kyuubi Engine Log Output
   
   ```logtalk
   Caused by: org.apache.kyuubi.plugin.spark.authz.AccessControlException: Permission denied: user [test_user] does not have [create] privilege on [test_udf]
       at org.apache.kyuubi.plugin.spark.authz.ranger.SparkRangerAdminPlugin$.verify(SparkRangerAdminPlugin.scala:128)
       at org.apache.kyuubi.plugin.spark.authz.ranger.RuleAuthorization$.$anonfun$checkPrivileges$5(RuleAuthorization.scala:94)
       at org.apache.kyuubi.plugin.spark.authz.ranger.RuleAuthorization$.$anonfun$checkPrivileges$5$adapted(RuleAuthorization.scala:93)
       at scala.collection.mutable.ResizableArray.foreach(ResizableArray.scala:62)
       at scala.collection.mutable.ResizableArray.foreach$(ResizableArray.scala:55)
       at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:49)
       at org.apache.kyuubi.plugin.spark.authz.ranger.RuleAuthorization$.checkPrivileges(RuleAuthorization.scala:93)
       at org.apache.kyuubi.plugin.spark.authz.ranger.RuleAuthorization.apply(RuleAuthorization.scala:36)
       at org.apache.kyuubi.plugin.spark.authz.ranger.RuleAuthorization.apply(RuleAuthorization.scala:33)
       at org.apache.spark.sql.catalyst.rules.RuleExecutor.$anonfun$execute$2(RuleExecutor.scala:211)
       at scala.collection.LinearSeqOptimized.foldLeft(LinearSeqOptimized.scala:126)
       at scala.collection.LinearSeqOptimized.foldLeft$(LinearSeqOptimized.scala:122)
       at scala.collection.immutable.List.foldLeft(List.scala:91)
       at org.apache.spark.sql.catalyst.rules.RuleExecutor.$anonfun$execute$1(RuleExecutor.scala:208)
       at org.apache.spark.sql.catalyst.rules.RuleExecutor.$anonfun$execute$1$adapted(RuleExecutor.scala:200)
       at scala.collection.immutable.List.foreach(List.scala:431)
       at org.apache.spark.sql.catalyst.rules.RuleExecutor.execute(RuleExecutor.scala:200)
       at org.apache.spark.sql.catalyst.rules.RuleExecutor.$anonfun$executeAndTrack$1(RuleExecutor.scala:179)
       at org.apache.spark.sql.catalyst.QueryPlanningTracker$.withTracker(QueryPlanningTracker.scala:88)
       at org.apache.spark.sql.catalyst.rules.RuleExecutor.executeAndTrack(RuleExecutor.scala:179)
       at org.apache.spark.sql.execution.QueryExecution.$anonfun$optimizedPlan$1(QueryExecution.scala:125)
       at org.apache.spark.sql.catalyst.QueryPlanningTracker.measurePhase(QueryPlanningTracker.scala:111)
       at org.apache.spark.sql.execution.QueryExecution.$anonfun$executePhase$1(QueryExecution.scala:183)
       at org.apache.spark.sql.SparkSession.withActive(SparkSession.scala:775)
       at org.apache.spark.sql.execution.QueryExecution.executePhase(QueryExecution.scala:183)
       at org.apache.spark.sql.execution.QueryExecution.optimizedPlan$lzycompute(QueryExecution.scala:121)
       at org.apache.spark.sql.execution.QueryExecution.optimizedPlan(QueryExecution.scala:117)
       at org.apache.spark.sql.execution.QueryExecution.assertOptimized(QueryExecution.scala:135)
       at org.apache.spark.sql.execution.QueryExecution.executedPlan$lzycompute(QueryExecution.scala:153)
       at org.apache.spark.sql.execution.QueryExecution.executedPlan(QueryExecution.scala:150)
       at org.apache.spark.sql.execution.QueryExecution.simpleString(QueryExecution.scala:201)
   ```
   
   
   ### Kyuubi Server Configurations
   
   ```yaml
   spark.sql.extensions org.apache.kyuubi.sql.KyuubiSparkSQLExtension,org.apache.kyuubi.plugin.spark.authz.ranger.RangerSparkExtension,org.apache.iceberg.spark.extensions.IcebergSparkSessionExtensions
   spark.sql.catalog.spark_catalog org.apache.iceberg.spark.SparkSessionCatalog
   spark.sql.catalog.spark_catalog.type hive
   ```
   
   
   ### Kyuubi Engine Configurations
   
   _No response_
   
   ### Additional context
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes. I can submit a PR independently to fix.
   - [ ] Yes. I would be willing to submit a PR with guidance from the Kyuubi community to fix.
   - [ ] No. I cannot submit a PR at this time.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] cxzl25 commented on issue #3925: [Bug][AuthZ] Don't have permissions to create UDF functions when not specify a database name

Posted by GitBox <gi...@apache.org>.
cxzl25 commented on issue #3925:
URL: https://github.com/apache/incubator-kyuubi/issues/3925#issuecomment-1362399483

   I think this problem has been solved, let me close this issue.
   Thanks to @MLikeWater  report this problem.
   Thanks to @bowenliang123  check.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] bowenliang123 commented on issue #3925: [Bug][AuthZ] Don't have permissions to create UDF functions when not specify a database name

Posted by GitBox <gi...@apache.org>.
bowenliang123 commented on issue #3925:
URL: https://github.com/apache/incubator-kyuubi/issues/3925#issuecomment-1344358625

   Please try again with latest code on master branch.
   Especially with complete refactoring in Authz command mapping in pull  https://github.com/apache/incubator-kyuubi/pull/3904.
   
   Line 152-154 in [Descriptor.scala](https://github.com/apache/incubator-kyuubi/pull/3904/files#diff-19fe4c58db5cdbdcdbee33a9cde9df0dd04aa35f17a332600b6acec31b523757) should be able to fill missing database for function commands.
   ```
       if (function.database.isEmpty) {
         function = function.copy(database = databaseDesc.map(_.extract(v)))
       }
   ```
   
   And I couldn't reproduce it in ut with the latest code on the master branch.
   <img width="959" alt="image" src="https://user-images.githubusercontent.com/1935105/206720296-2849013f-bf17-4903-92df-fc5a9abb51cb.png">
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] yaooqinn commented on issue #3925: [Bug][AuthZ] Don't have permissions to create UDF functions when not specify a database name

Posted by GitBox <gi...@apache.org>.
yaooqinn commented on issue #3925:
URL: https://github.com/apache/incubator-kyuubi/issues/3925#issuecomment-1340878232

   seems we need the apply the current database when the database field is missing. cc @bowenliang123 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] cxzl25 closed issue #3925: [Bug][AuthZ] Don't have permissions to create UDF functions when not specify a database name

Posted by GitBox <gi...@apache.org>.
cxzl25 closed issue #3925: [Bug][AuthZ] Don't have permissions to create UDF functions when not specify a database name
URL: https://github.com/apache/incubator-kyuubi/issues/3925


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org