You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Rajini Sivaram (JIRA)" <ji...@apache.org> on 2018/07/20 19:41:00 UTC

[jira] [Resolved] (KAFKA-7185) getMatchingAcls throws StringIndexOutOfBoundsException for empty resource name

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

Rajini Sivaram resolved KAFKA-7185.
-----------------------------------
       Resolution: Fixed
         Reviewer: Ismael Juma
    Fix Version/s: 2.0.0

> getMatchingAcls throws StringIndexOutOfBoundsException for empty resource name
> ------------------------------------------------------------------------------
>
>                 Key: KAFKA-7185
>                 URL: https://issues.apache.org/jira/browse/KAFKA-7185
>             Project: Kafka
>          Issue Type: Bug
>    Affects Versions: 2.0.0
>            Reporter: Dhruvil Shah
>            Assignee: Dhruvil Shah
>            Priority: Blocker
>             Fix For: 2.0.0
>
>
> KIP-290 introduced a way to match ACLs based on prefix. Certain resource names like that for group id can be empty strings. When an empty string is passed into `getMatchingAcls`, it would throw a `StringIndexOutOfBoundsException` because of the following logic:
> {noformat}
> val prefixed = aclCache.range(
>  Resource(resourceType, resourceName, PatternType.PREFIXED),
>  Resource(resourceType, resourceName.substring(0, Math.min(1, resourceName.length)), PatternType.PREFIXED)
>  )
>  .filterKeys(resource => resourceName.startsWith(resource.name))
>  .flatMap { case (resource, versionedAcls) => versionedAcls.acls }
>  .toSet{noformat}
> This is a regression introduced in 2.0.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)