forked from apache/doris
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[enhance](auth)The priority of attributes is higher than session vari…
…able (apache#47185) ### What problem does this PR solve? The current priority is that session variable is higher than user property, which is incorrect because session variable can be set freely by ordinary users and will bypass the restrictions set by administrators Scope of Impact: - getInsertTimeoutS - getQueryTimeoutS - getMaxExecMemByte
- Loading branch information
Showing
5 changed files
with
191 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
regression-test/suites/account_p0/test_property_session.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
import org.junit.Assert; | ||
|
||
suite("test_property_session") { | ||
String suiteName = "test_property_session" | ||
String userName = "${suiteName}_user" | ||
String pwd = 'C123_567p' | ||
sql """drop user if exists ${userName}""" | ||
sql """CREATE USER '${userName}' IDENTIFIED BY '${pwd}'""" | ||
|
||
//cloud-mode | ||
if (isCloudMode()) { | ||
def clusters = sql " SHOW CLUSTERS; " | ||
assertTrue(!clusters.isEmpty()) | ||
def validCluster = clusters[0][0] | ||
sql """GRANT USAGE_PRIV ON CLUSTER `${validCluster}` TO ${userName}"""; | ||
} | ||
sql """GRANT select_PRIV ON *.*.* TO ${userName}"""; | ||
connect(user=userName, password="${pwd}", url=context.config.jdbcUrl) { | ||
sql """ | ||
set query_timeout=1; | ||
""" | ||
test { | ||
sql """ | ||
select sleep(3); | ||
""" | ||
exception "timeout" | ||
} | ||
} | ||
|
||
// the priority of property should be higher than session | ||
sql """set property for '${userName}' 'query_timeout' = '10';""" | ||
connect(user=userName, password="${pwd}", url=context.config.jdbcUrl) { | ||
sql """ | ||
select sleep(3); | ||
""" | ||
} | ||
|
||
sql """drop user if exists ${userName}""" | ||
} |