alopresto commented on a change in pull request #886:
URL: https://github.com/apache/nifi-minifi-cpp/pull/886#discussion_r485248137
##########
File path: libminifi/src/Configure.cpp
##########
@@ -68,6 +74,37 @@ const char *Configure::nifi_state_management_provider_local
= "nifi.state.manage
const char *Configure::nifi_state_management_provider_local_always_persist =
"nifi.state.management.provider.local.always.persist";
const char
*Configure::nifi_state_management_provider_local_auto_persistence_interval =
"nifi.state.management.provider.local.auto.persistence.interval";
+Configure::Configure()
+ : Properties("MiNiFi configuration"),
logger_(logging::LoggerFactory<Properties>::getLogger()) {}
+
+#ifdef OPENSSL_SUPPORT
+void Configure::decryptSensitiveProperties(const Decryptor& decryptor) {
+ logger_->log_info("Decrypting sensitive properties...");
+ int num_properties_decrypted = 0;
+
+ for (const auto& property : properties_) {
+ const std::string& property_key = property.first;
+ const std::string& property_value = property.second;
+
+ utils::optional<std::string> encryption_type = get(property_key +
".protected");
+ if (Decryptor::isEncrypted(encryption_type)) {
+ std::string decrypted_property_value;
+ try {
+ decrypted_property_value =
decryptor.decrypt(utils::StringUtils::from_base64(property_value),
property_key);
+ } catch (const std::exception& ex) {
+ logger_->log_error("Could not decrypt property %s=%s; error: %s",
property_key, property_value, ex.what());
Review comment:
If the encryption type isn't recognized, this could leak the "encrypted"
value (which may be plaintext).
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]