This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.0 by this push:
new f36b2389979 branch-4.0: [fix](auth)Fixed the issue nereids not check
for the existence of permission items #58282 (#58325)
f36b2389979 is described below
commit f36b2389979325ea238bc897358e629437e9aa7d
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Nov 25 16:07:36 2025 +0800
branch-4.0: [fix](auth)Fixed the issue nereids not check for the existence
of permission items #58282 (#58325)
Cherry-picked from #58282
Co-authored-by: zhangdong <[email protected]>
---
.../apache/doris/nereids/parser/LogicalPlanBuilder.java | 3 +++
regression-test/suites/auth_p0/test_grant_auth.groovy | 14 ++++++++++++++
2 files changed, 17 insertions(+)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
index 6ca96e32ae7..c1e26372cd0 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
@@ -8420,6 +8420,9 @@ public class LogicalPlanBuilder extends
DorisParserBaseVisitor<Object> {
} else {
String privilegeName = stripQuotes(ctx.name.getText());
AccessPrivilege accessPrivilege =
AccessPrivilege.fromName(privilegeName);
+ if (accessPrivilege == null) {
+ throw new AnalysisException("Unknown privilege type " +
privilegeName);
+ }
List<String> columns = ctx.identifierList() == null
? ImmutableList.of() :
visitIdentifierList(ctx.identifierList());
accessPrivilegeWithCols = new
AccessPrivilegeWithCols(accessPrivilege, columns);
diff --git a/regression-test/suites/auth_p0/test_grant_auth.groovy
b/regression-test/suites/auth_p0/test_grant_auth.groovy
index c026cfd91ed..f364c8c13a1 100644
--- a/regression-test/suites/auth_p0/test_grant_auth.groovy
+++ b/regression-test/suites/auth_p0/test_grant_auth.groovy
@@ -24,5 +24,19 @@ suite("test_grant_auth","p0,auth") {
sql """CREATE USER '${user}' IDENTIFIED BY '${pwd}'"""
sql """grant select_priv on `__internal_schema`.* to ${user}"""
+ test {
+ sql """
+ grant INSERT_PRIV on *.*.* to ${user}
+ """
+ exception "Unknown privilege type"
+ }
+
+ test {
+ sql """
+ revoke INSERT_PRIV on *.*.* from ${user}
+ """
+ exception "Unknown privilege type"
+ }
+
try_sql("DROP USER ${user}")
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]