apache / apache/kyuubi

[Bug] insert overwrite directory Permission denied

Open
#7,155 9 comments 0 reactions 0 assignees View on GitHub
kind:bug priority:major
Dominant language
Scala
Stars
2.4k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

### 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/kyuubi/issues?q=is%3Aissue) and found no similar issues.

### Describe the bug

kyuubi-1.10.2 kerberos spark-3.5.6 ranger-2.4.0, when I config spark.sql.extensions = org.apache.kyuubi.plugin.spark.authz.ranger.RangerSparkExtension, then sql:

insert overwrite directory "hdfs://router/user/bdwh/tmp/2025-07-23/usertable/01" select * from bdwh.dim_bussiness limit 10;

have error below:
Caused by: org.apache.kyuubi.plugin.spark.authz.AccessControlException: Permission denied: user [bdwh] does not have [write] privilege on [[/user/bdwh/tmp/2025-07-23/usertable/01, /user/bdwh/tmp/2025-07-23/usertable/01/]]
at org.apache.kyuubi.plugin.spark.authz.ranger.SparkRangerAdminPlugin$.verify(SparkRangerAdminPlugin.scala:168)
at org.apache.kyuubi.plugin.spark.authz.ranger.RuleAuthorization.$anonfun$checkPrivileges$4(RuleAuthorization.scala:81)
at org.apache.kyuubi.plugin.spark.authz.ranger.RuleAuthorization.$anonfun$checkPrivileges$4$adapted(RuleAuthorization.scala:80)
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:80)
at org.apache.kyuubi.plugin.spark.authz.rule.Authorization.apply(Authorization.scala:34)
at org.apache.kyuubi.plugin.spark.authz.rule.Authorization.apply(Authorization.scala:29)
at org.apache.spark.sql.catalyst.rules.RuleExecutor.$anonfun$execute$2(RuleExecutor.scala:222)
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:219)
at org.apache.spark.sql.catalyst.rules.RuleExecutor.$anonfun$execute$1$adapted(RuleExecutor.scala:211)

BUT,the same sql I use hive is normal and hadoop fs command is normal

The Kyuubi Ranger policies for Hive databases and tables are working fine, but the HDFS policies are not working at all. I've checked the Spark Ranger plugin installation and configuration but didn't find any issues. Could you please help take a look and see what might be going wrong? Thank you very much!

### Affects Version(s)

1.10.2

### Kyuubi Server Log Output

```logtalk

```

### Kyuubi Engine Log Output

```logtalk

```

### Kyuubi Server Configurations

```yaml

```

### Kyuubi Engine Configurations

```yaml

```

### Additional context

_No response_

### Are you willing to submit PR?

- [x] 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.

Contributor guide

Open the contributing guide

Research direction

Start with SparkRangerAdminPlugin.scala at verify, then trace the privilege checks through RuleAuthorization.scala and Authorization.scala. Reproduce the reported INSERT OVERWRITE DIRECTORY statement with the listed Kyuubi, Spark, Kerberos, Ranger, and HDFS setup, comparing it with Hive and hadoop fs behavior. Done means the cause of the denied write is identified and the corrected behavior is verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
hadoop, scala
Domain
authorization, distributed-systems, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.