You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Dhruvil Shah (JIRA)" <ji...@apache.org> on 2018/07/19 20:55:00 UTC
[jira] [Updated] (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 ]
Dhruvil Shah updated KAFKA-7185:
--------------------------------
Description:
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.
was:
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:
```
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
```
This is a regression introduced in 2.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
>
> 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)