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

getMatchingAcls throws StringIndexOutOfBoundsException for empty resource name

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0.0
    • Fix Version/s: 2.0.0
    • Component/s: None
    • Labels:
      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

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

                Dates

                • Created:
                  Updated:
                  Resolved: