summaryrefslogtreecommitdiff
path: root/classes/RSSUtils.php
diff options
context:
space:
mode:
authorAndrew Dolgov <fox@fakecake.org>2025-04-08 09:43:03 +0300
committerAndrew Dolgov <fox@fakecake.org>2025-04-08 09:43:03 +0300
commitf00d9a18f8d8778b8305f5d2110039fc1f61fb24 (patch)
treeb77ebbc77c159df04ec9fb65c62666a36a2027e9 /classes/RSSUtils.php
parenteedc1460e5dadb00a731c1974642a4db7ab30868 (diff)
if possible, automatically encrypt stored plaintext password for feed on update
Diffstat (limited to 'classes/RSSUtils.php')
-rw-r--r--classes/RSSUtils.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/classes/RSSUtils.php b/classes/RSSUtils.php
index 8e3e56ee7..f6a81d00f 100644
--- a/classes/RSSUtils.php
+++ b/classes/RSSUtils.php
@@ -462,6 +462,18 @@ class RSSUtils {
$feed_auth_pass_plaintext = Feeds::decrypt_feed_pass($feed_obj->auth_pass);
+ // transparently encrypt plaintext password if possible
+ if ($feed_obj->auth_pass && $feed_auth_pass_plaintext === $feed_obj->auth_pass) {
+ $key = Config::get(Config::ENCRYPTION_KEY);
+
+ if ($key) {
+ Debug::log("encrypting stored plaintext feed password...", Debug::LOG_VERBOSE);
+
+ $feed_obj->auth_pass = base64_encode(serialize(Crypt::encrypt_string($feed_auth_pass_plaintext)));
+ $feed_obj->save();
+ }
+ }
+
$pluginhost->chain_hooks_callback(PluginHost::HOOK_FETCH_FEED,
function ($result, $plugin) use (&$feed_data, $start_ts) {
$feed_data = $result;