This is an automated email from the ASF dual-hosted git repository.
csringhofer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git
The following commit(s) were added to refs/heads/master by this push:
new 59616d7bd IMPALA-13722: Ranger request should have no null values in
the resources map
59616d7bd is described below
commit 59616d7bd1b1f4fe3e2174343453b8554e75033e
Author: stiga-huang <[email protected]>
AuthorDate: Sat Feb 1 11:38:06 2025 +0800
IMPALA-13722: Ranger request should have no null values in the resources map
Each Ranger privilege grant/revoke request has a resources map to
describe the target resource, e.g. db, table, url, etc. The keys of the
resources map are predefined strings like "database", "table", "column",
"url", etc. The values are the actual resource name or "*" as a wildcard
for all such kinds of resources.
Our FE tests unintentionally set null values on "url" when the resources
map doesn't have such a key. See AuthorizationTestBase#updateUri().
Using null as the value is an undefined behavior and it causes
NullPointerException in newer versions of Ranger when granting/revoking
privileges (might due to RANGER-4638 that adds a code to split the
string value).
This patch fixes AuthorizationTestBase#updateUri() to only update the
URL when it's not null and starts with "/".
Tests:
- Verified the fix in a downstream build with a newer Ranger version
that hits the issue.
Change-Id: Ibed929bcd25ffdf54fa5f0fc848a0cc13c1fb0a2
Reviewed-on: http://gerrit.cloudera.org:8080/22435
Reviewed-by: Impala Public Jenkins <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>
---
.../java/org/apache/impala/authorization/AuthorizationTestBase.java | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git
a/fe/src/test/java/org/apache/impala/authorization/AuthorizationTestBase.java
b/fe/src/test/java/org/apache/impala/authorization/AuthorizationTestBase.java
index 364628456..480391c26 100644
---
a/fe/src/test/java/org/apache/impala/authorization/AuthorizationTestBase.java
+++
b/fe/src/test/java/org/apache/impala/authorization/AuthorizationTestBase.java
@@ -231,9 +231,8 @@ public abstract class AuthorizationTestBase extends
FrontendTestBase {
String uri = resources.get(RangerImpalaResourceBuilder.URL);
if (uri != null && uri.startsWith("/")) {
uri = "hdfs://localhost:20500" + uri;
+ resources.put(RangerImpalaResourceBuilder.URL, uri);
}
- resources.put(RangerImpalaResourceBuilder.URL, uri);
-
return resources;
}