Github user skrewz commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1302#discussion_r97523180
  
    --- Diff: 
nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java ---
    @@ -1027,19 +1028,24 @@ public boolean accept(final File dir, final String 
filename) {
             cmd.add("-Dorg.apache.nifi.bootstrap.config.log.dir=" + 
nifiLogDir);
             cmd.add("org.apache.nifi.NiFi");
             if (props.containsKey(NIFI_BOOTSTRAP_SENSITIVE_KEY) && 
!StringUtils.isBlank(props.get(NIFI_BOOTSTRAP_SENSITIVE_KEY))) {
    -            cmd.add("-k " + props.get(NIFI_BOOTSTRAP_SENSITIVE_KEY));
    +            File password_file = new File(confDir, "sensitive.key");
    +
    +            // Restrict permissions:
    +            password_file.setReadable(false,false);
    --- End diff --
    
    Also: one could get a file descriptor on the `sensitive.key` file in the 
configuration directory before it's locked down, permissions-wise (think race 
condition and `inotify`). It needs to be created with initial permissions not 
allowing this---like in [the `java.nio.Files`-based approach example you 
posted](http://stackoverflow.com/a/32165319/70465).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to