[
https://issues.apache.org/jira/browse/NIFI-5161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16466266#comment-16466266
]
ASF GitHub Bot commented on NIFI-5161:
--------------------------------------
Github user alopresto commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2684#discussion_r186502982
--- Diff:
nifi-toolkit/nifi-toolkit-tls/src/main/java/org/apache/nifi/toolkit/tls/manager/TlsClientManager.java
---
@@ -112,4 +112,9 @@ public void write(OutputStreamFactory
outputStreamFactory) throws IOException, G
public void
addClientConfigurationWriter(ConfigurationWriter<TlsClientConfig>
configurationWriter) {
configurationWriters.add(configurationWriter);
}
+
+
+ protected static String escapeAliasFilename(String alias) {
+ return alias.replaceAll("[^\\w&&[^\\.]]", "_");
--- End diff --
Recommend simplifying regular expression to `[^\\w\\.\\-\\n]+`.
Examples:
```
my/silly/filename my_silly_filename
my&silly&filename my_silly_filename
my silly alias my_silly_alias
my_silly_alias my_silly_alias
my.silly.alias my.silly.alias
my-silly-alias my-silly-alias
my silly alias my_silly_alias
my&/ silly*&$alias my_silly_alias
```
> Toolkit character escaping issue
> --------------------------------
>
> Key: NIFI-5161
> URL: https://issues.apache.org/jira/browse/NIFI-5161
> Project: Apache NiFi
> Issue Type: Bug
> Components: Tools and Build
> Reporter: Matt Gilman
> Assignee: Nathan Gough
> Priority: Minor
>
> The Java Keystore does not perform any character validation on the alias
> field, so theoretically a "/" character should be accepted. According to the
> Java documentation, the only instruction is "Whether aliases are case
> sensitive is implementation dependent. In order to avoid problems, it is
> recommended not to use aliases in a KeyStore that only differ in case."
> The toolkit will need to be updated to correctly escape special characters
> when passing them to the Java commands.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)