fgerlits commented on code in PR #1725:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1725#discussion_r1512455086
##########
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:
Also, this part of the code handles the case when the property given by the
user to the `encrypt-config` tool does not exist in the JSON, yet. In this
case, we add the property to the JSON flow configuration.
--
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]