fgerlits commented on code in PR #1708:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1708#discussion_r1427928523


##########
libminifi/src/core/FlowConfiguration.cpp:
##########
@@ -174,4 +180,21 @@ std::shared_ptr<core::controller::ControllerServiceNode> 
FlowConfiguration::crea
   return controllerServicesNode;
 }
 
+std::string FlowConfiguration::decryptProperty(const std::string& 
encrypted_value) const {
+  static constexpr std::string_view WrapperBegin = "enc{";
+  static constexpr std::string_view WrapperEnd = "}";
+
+  if (!(encrypted_value.starts_with(WrapperBegin) && 
encrypted_value.ends_with(WrapperEnd))) {
+    // this is normal: sensitive properties come from the C2 server in 
cleartext over TLS
+    return encrypted_value;
+  }
+
+  const std::string unwrapped_value = 
encrypted_value.substr(WrapperBegin.size(), encrypted_value.length() - 
(WrapperBegin.size() + WrapperEnd.size()));
+  return sensitive_properties_encryptor_.decrypt(unwrapped_value);

Review Comment:
   I have changed this and a few of the related functions to take a 
`string_view` argument in 51d37c808a977631653b7a71e8e16a14aebf0b4c



-- 
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: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to