szaszm commented on code in PR #1725:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1725#discussion_r1511219340


##########
libminifi/src/core/json/JsonFlowSerializer.cpp:
##########
@@ -47,14 +47,21 @@ void 
JsonFlowSerializer::encryptSensitiveProperties(rapidjson::Value &property_j
     }
     if (properties.at(name).isSensitive()) {
       auto& value = property.value;
-      const std::string_view value_sv{value.GetString(), 
value.GetStringLength()};
+      const std::string_view value_sv = component_overrides.contains(name) ? 
component_overrides.at(name) : std::string_view{value.GetString(), 
value.GetStringLength()};
       const std::string encrypted_value = 
utils::crypto::property_encryption::encrypt(value_sv, encryption_provider);
       value.SetString(encrypted_value.c_str(), encrypted_value.size(), alloc);
     }
+    component_overrides.erase(name);
+  }
+
+  for (const auto& [name, value] : component_overrides) {
+    const std::string encrypted_value = 
utils::crypto::property_encryption::encrypt(value, encryption_provider);
+    property_jsons.AddMember(rapidjson::Value(name, alloc), 
rapidjson::Value(encrypted_value, alloc), alloc);

Review Comment:
   What's the idea behind overrides? I see that the override values are used in 
plaintext to override existing properties in the flow definition, but if they 
were not used, then they are used encrypted. I don't understand why it works 
that way.



##########
libminifi/include/core/ProcessGroup.h:
##########
@@ -205,6 +205,8 @@ class ProcessGroup : public CoreComponent {
    */
   std::shared_ptr<core::controller::ControllerServiceNode> 
findControllerService(const std::string &nodeId) const;
 
+  std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> 
getAllControllerServices() const;

Review Comment:
   Does this really need to give ownership to the callers?



-- 
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]

Reply via email to