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

Lack of default for URL encoding configuration for OAuth causes NPE

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.9.0
    • 3.9.0
    • clients, security

    Description

      KAFKA-16345 added a new client configuration option SASL_OAUTHBEARER_HEADER_URLENCODE. This is an optional configuration, so the user doesn't need to provide it. When an AdminConfig, ConsumerConfig, or ProducerConfig object is created, it uses the default value of DEFAULT_SASL_OAUTHBEARER_HEADER_URLENCODE if the value isn't present.

      However, if the configuration is created as a plain Map or Properties and the sasl.oauthbearer.header.urlencode key isn't present, it can lead to a NullPointerException. This occurs because the code in AccessTokenRetriever.create() assumes that there's always a value present in the incoming configs parameter. But if there isn't an entry for the sasl.oauthbearer.header.urlencode key in the map, a NullPointerException is thrown.

      When using map-based configuration, one workaround is to explicitly add an entry to the map like so:

      Map<String, Object> configs = new HashMap();
      . . .
      configs.put(SASL_OAUTHBEARER_HEADER_URLENCODE, DEFAULT_SASL_OAUTHBEARER_HEADER_URLENCODE);
      . . .
      configureSomething(configs);

      Attachments

        Issue Links

          Activity

            People

              kirktrue Kirk True
              kirktrue Kirk True
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: