Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-7185

getMatchingAcls throws StringIndexOutOfBoundsException for empty resource name

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • 2.0.0
    • 2.0.0
    • None
    • None

    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:

      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.

      Attachments

        Issue Links

          Activity

            People

              dhruvilshah Dhruvil Shah
              dhruvilshah Dhruvil Shah
              Ismael Juma Ismael Juma
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: