[ 
https://issues.apache.org/jira/browse/SENTRY-563?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Xiaomeng Huang updated SENTRY-563:
----------------------------------
    Description: 
{code}
public Set<TSentryPrivilege> listPrivilegesByRoleName(String requestorUserName,
      String roleName, List<? extends Authorizable> authorizable)
  throws SentryUserException {
    TListSentryPrivilegesRequest request = new TListSentryPrivilegesRequest();
    
request.setProtocol_version(ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT);
    request.setRequestorUserName(requestorUserName);
    request.setRoleName(roleName);
    if (authorizable != null) {   ==> we should add check empty of authorizable 
here.
      TSentryAuthorizable tSentryAuthorizable = 
setupSentryAuthorizable(authorizable);
      request.setAuthorizableHierarchy(tSentryAuthorizable);
    }
   ...
{code}

Please see my test cases in this patch, before this patch, it will throw 
exception.
Sentry client interface should be robustness, it also blocks SHOW GRANT DDL of 
V2 feature.

  was:
{code}
public Set<TSentryPrivilege> listPrivilegesByRoleName(String requestorUserName,
      String roleName, List<? extends Authorizable> authorizable)
  throws SentryUserException {
    TListSentryPrivilegesRequest request = new TListSentryPrivilegesRequest();
    
request.setProtocol_version(ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT);
    request.setRequestorUserName(requestorUserName);
    request.setRoleName(roleName);
    if (authorizable != null) {   ==> we should add check empty of authorizable 
here.
      TSentryAuthorizable tSentryAuthorizable = 
setupSentryAuthorizable(authorizable);
      request.setAuthorizableHierarchy(tSentryAuthorizable);
    }
   ...
{code}

Please see my test cases in this patch, before this patch, it will throw 
exception.
This bug also blocks SHOW GRANT DDL of V2 feature.


> The interface listPrivilegesByRoleName may throw thrift exception if 
> Authorizable is empty
> ------------------------------------------------------------------------------------------
>
>                 Key: SENTRY-563
>                 URL: https://issues.apache.org/jira/browse/SENTRY-563
>             Project: Sentry
>          Issue Type: Bug
>            Reporter: Xiaomeng Huang
>            Assignee: Xiaomeng Huang
>         Attachments: SENTRY-563.001.patch
>
>
> {code}
> public Set<TSentryPrivilege> listPrivilegesByRoleName(String 
> requestorUserName,
>       String roleName, List<? extends Authorizable> authorizable)
>   throws SentryUserException {
>     TListSentryPrivilegesRequest request = new TListSentryPrivilegesRequest();
>     
> request.setProtocol_version(ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT);
>     request.setRequestorUserName(requestorUserName);
>     request.setRoleName(roleName);
>     if (authorizable != null) {   ==> we should add check empty of 
> authorizable here.
>       TSentryAuthorizable tSentryAuthorizable = 
> setupSentryAuthorizable(authorizable);
>       request.setAuthorizableHierarchy(tSentryAuthorizable);
>     }
>    ...
> {code}
> Please see my test cases in this patch, before this patch, it will throw 
> exception.
> Sentry client interface should be robustness, it also blocks SHOW GRANT DDL 
> of V2 feature.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to