Uploaded image for project: 'Apache NiFi MiNiFi - MOVED TO NIFI PROJECT'
  1. Apache NiFi MiNiFi - MOVED TO NIFI PROJECT
  2. MINIFI-537

Possible NullPointerException in BootstrapTransformer

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.14.0
    • None
    • None

    Description

      https://github.com/apache/nifi-minifi/pull/167 introduced the ability to override security properties and sensitive properties in bootstrap.conf

      When using this feature, there is a potential NPE that prevents MiNiFi from starting.

      Steps to reproduce:

      In bootstrap.conf set any of the SSL/TLS properties, for example:

       

      nifi.minifi.security.keystoreType=jks

      Leave this unset / blank:

       

       

      nifi.minifi.sensitive.props.key=

       

       

      Start minifi and observe the following in app.log:

      2020-08-27 10:12:10,877 INFO [main] o.a.n.m.bootstrap.util.ConfigTransformer Bootstrap flow override: Replaced security properties2020-08-27 10:12:10,877 INFO [main] o.a.n.m.bootstrap.util.ConfigTransformer Bootstrap flow override: Replaced security properties2020-08-27 10:12:10,881 ERROR [main] o.apache.nifi.minifi.bootstrap.RunMiNiFi The config file is malformed, unable to start.org.apache.nifi.minifi.bootstrap.configuration.ConfigurationChangeException: Failed to parse the config YAML while creating the nifi.properties at org.apache.nifi.minifi.bootstrap.util.ConfigTransformer.writeNiFiProperties(ConfigTransformer.java:290) at org.apache.nifi.minifi.bootstrap.util.ConfigTransformer.transformConfigFile(ConfigTransformer.java:120) at org.apache.nifi.minifi.bootstrap.RunMiNiFi.performTransformation(RunMiNiFi.java:1712) at org.apache.nifi.minifi.bootstrap.RunMiNiFi.start(RunMiNiFi.java:1180) at org.apache.nifi.minifi.bootstrap.RunMiNiFi.main(RunMiNiFi.java:244)Caused by: java.lang.NullPointerException: null at java.util.Hashtable.put(Hashtable.java:460) at org.apache.nifi.minifi.bootstrap.util.OrderedProperties.put(OrderedProperties.java:45) at java.util.Properties.setProperty(Properties.java:166) at org.apache.nifi.minifi.bootstrap.util.OrderedProperties.setProperty(OrderedProperties.java:62) at org.apache.nifi.minifi.bootstrap.util.ConfigTransformer.writeNiFiProperties(ConfigTransformer.java:260) ... 4 common frames omitted

      This is because when SecurityPropertiesSchema is created (caused by the override properties in bootstrap.conf), the nested SensitivePropsSchema is created, but initialized with a null key. This causes the NPE when this property is accessed later (unchecked) in ConfigTransformer.writeNiFiProperties.

      I think the best solution here is to always initialize SensitivePropsSchema.key to its default value (empty string) which is what happens when it is created normally without the bootstrap.conf overrides.

      Attachments

        Issue Links

          Activity

            People

              kdoran Kevin Doran
              kdoran Kevin Doran
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 50m
                  1h 50m