nifi-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [nifi-minifi-cpp] fgerlits commented on a change in pull request #886: MINIFICPP-1323 Encrypt sensitive properties
Date Tue, 15 Sep 2020 17:21:56 GMT

fgerlits commented on a change in pull request #886:
URL: https://github.com/apache/nifi-minifi-cpp/pull/886#discussion_r488834299



##########
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:
       I have removed the `property_value` from the error message.




----------------------------------------------------------------
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:
users@infra.apache.org



Mime
View raw message