Quanlong Huang created IMPALA-13722:
---------------------------------------
Summary: Ranger request should have no null values in the
resources map
Key: IMPALA-13722
URL: https://issues.apache.org/jira/browse/IMPALA-13722
Project: IMPALA
Issue Type: Bug
Components: Test
Reporter: Quanlong Huang
Assignee: Quanlong Huang
In a downstream build with newer versions of Ranger, we saw tests in
AuthorizationStmtTest failed to grant and revoke privileges. The cause is there
is an illegal key-value pair of url=null in the resources map:
{code:java}
2025-01-22 17:37:59,430 ERROR org.apache.ranger.rest.ServiceREST:
[http-nio-6080-exec-5]: grantAccess(test_impala,
GrantRevokeRequest={grantor={admin} grantorGroups={admin }
resource={database=*; column=*; table=*; url=null; } users={non_owner }
groups={} roles={} accessTypes={create } delegateAdmin={false}
enableAudit={true} replaceExistingPermissions={false} isRecursive={false}
clientIPAddress={127.0.0.1} clientType={null} requestData={null}
sessionId={null} clusterName={test-cluster} zoneName={null} }) failed
java.lang.NullPointerException: null
at
org.apache.ranger.rest.ServiceRESTUtil.getAccessResourceObjectMap(ServiceRESTUtil.java:443)
~[classes/:?]
at
org.apache.ranger.rest.ServiceREST.grantAccess(ServiceREST.java:1272)
~[classes/:?]
at
org.apache.ranger.rest.ServiceREST$$FastClassBySpringCGLIB$$92dab672.invoke(<generated>)
~[classes/:?]
at
org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
~[spring-core-5.3.39.jar:5.3.39]
...{code}
The resource map in the above case is resource=\{database=\*; column=\*;
table=\*; url=null; \}. It shouldn't have url=null in the map. This is added
unintentionally in our FE test code:
{code:java}
private static Map<String, String> updateUri(Map<String, String> resources) {
String uri = resources.get(RangerImpalaResourceBuilder.URL);
if (uri != null && uri.startsWith("/")) {
uri = "hdfs://localhost:20500" + uri;
}
resources.put(RangerImpalaResourceBuilder.URL, uri);
return resources;
} {code}
[https://github.com/apache/impala/blob/8eb57a9921ed6d0ffccb98932d50506fede24fa9/fe/src/test/java/org/apache/impala/authorization/AuthorizationTestBase.java#L231-L235]
When the resources map doesn't contains a key for "url", we get a null uri and
then set it in the resources map. What we want is just updating it when it
exists.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)