markap14 commented on a change in pull request #5797:
URL: https://github.com/apache/nifi/pull/5797#discussion_r814107117
##########
File path:
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/serialization/VersionedFlowSynchronizer.java
##########
@@ -701,12 +707,35 @@ private void updateRootControllerService(final
ControllerServiceNode serviceNode
serviceNode.setName(versionedControllerService.getName());
serviceNode.setAnnotationData(versionedControllerService.getAnnotationData());
serviceNode.setComments(versionedControllerService.getComments());
-
serviceNode.setProperties(versionedControllerService.getProperties());
+
+ final Map<String, String> decryptedProperties =
decryptProperties(versionedControllerService.getProperties());
+ serviceNode.setProperties(decryptedProperties);
} finally {
serviceNode.resumeValidationTrigger();
}
}
+ private Map<String, String> decryptProperties(final Map<String, String>
encrypted) {
+ final Map<String, String> decrypted = new HashMap<>(encrypted.size());
+ encrypted.forEach((key, value) -> decrypted.put(key, decrypt(value)));
+ return decrypted;
+ }
+
+ private String decrypt(final String value) {
+ if (value != null && value.startsWith(FlowSerializer.ENC_PREFIX) &&
value.endsWith(FlowSerializer.ENC_SUFFIX)) {
+ try {
+ return
encryptor.decrypt(value.substring(FlowSerializer.ENC_PREFIX.length(),
value.length() - FlowSerializer.ENC_SUFFIX.length()));
+ } catch (EncryptionException e) {
+ final String moreDescriptiveMessage = "There was a problem
decrypting a sensitive flow configuration value. " +
+ "Check that the nifi.sensitive.props.key value in
nifi.properties matches the value used to encrypt the flow.xml.gz file";
Review comment:
Ha good catch. Will fix.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]