You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by "Kevin Doran (Jira)" <ji...@apache.org> on 2020/08/27 15:21:00 UTC

[jira] [Created] (MINIFI-537) Possible NullPointerException in BootstrapTransformer

Kevin Doran created MINIFI-537:
----------------------------------

             Summary: Possible NullPointerException in BootstrapTransformer
                 Key: MINIFI-537
                 URL: https://issues.apache.org/jira/browse/MINIFI-537
             Project: Apache NiFi MiNiFi
          Issue Type: New Feature
            Reporter: Kevin Doran


[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:

 
{noformat}
nifi.minifi.security.keystoreType=jus{noformat}
Leave this unset / blank:

 

 
{noformat}
nifi.minifi.sensitive.props.key={noformat}
 

 

Start minifi and observe the following in app.log:
{noformat}
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{noformat}
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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)