diff options
| author | 2018-07-08 11:29:05 +0200 | |
|---|---|---|
| committer | 2018-07-08 11:29:05 +0200 | |
| commit | 99dfdbc10d9daa8059fd6c017b1580ad493aa8f6 (patch) | |
| tree | e3070af9257aa22ee3ee1965ee51f227dc102692 | |
| parent | 82ac9454ddf337b79b41fedae37eaf15e6e0cb12 (diff) | |
Avoid feed credentials in logs (#1949)
* Avoid feed credentials in logs
Related to https://github.com/FreshRSS/FreshRSS/pull/1891
* Changelog 1949
| -rw-r--r-- | CHANGELOG.md | 2 | ||||
| -rwxr-xr-x | app/Controllers/entryController.php | 2 | ||||
| -rwxr-xr-x | app/Controllers/feedController.php | 21 | ||||
| -rw-r--r-- | app/Models/Feed.php | 4 |
4 files changed, 15 insertions, 14 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index e6f669ebd..80361b09f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ * Bug fixing * Fix bugs when searching with special characters (e.g. preventing marking as read) [#1944](https://github.com/FreshRSS/FreshRSS/issues/1944) * Fix username check in API to allow underscores [#1955](https://github.com/FreshRSS/FreshRSS/issues/1955) +* Security + * Avoid feed credentials in logs [#1949](https://github.com/FreshRSS/FreshRSS/pull/1949) * Mics. * Auto-login after self user creation [#1928](https://github.com/FreshRSS/FreshRSS/issues/1928) diff --git a/app/Controllers/entryController.php b/app/Controllers/entryController.php index 73e181b07..838ad56ce 100755 --- a/app/Controllers/entryController.php +++ b/app/Controllers/entryController.php @@ -186,7 +186,7 @@ class FreshRSS_entry_Controller extends Minz_ActionController { $nb = $entryDAO->cleanOldEntries($feed->id(), $date_min, $feed_history); if ($nb > 0) { $nb_total += $nb; - Minz_Log::debug($nb . ' old entries cleaned in feed [' . $feed->url() . ']'); + Minz_Log::debug($nb . ' old entries cleaned in feed [' . $feed->url(false) . ']'); } } } diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index ec88156f9..168d5a661 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -295,12 +295,12 @@ class FreshRSS_feed_Controller extends Minz_ActionController { if ($feed->lastUpdate() + 10 >= $mtime) { continue; //Nothing newer from other users } - //Minz_Log::debug($feed->url() . ' was updated at ' . date('c', $mtime) . ' by another user'); + //Minz_Log::debug($feed->url(false) . ' was updated at ' . date('c', $mtime) . ' by another user'); //Will take advantage of the newer cache } if (!$feed->lock()) { - Minz_Log::notice('Feed already being actualized: ' . $feed->url()); + Minz_Log::notice('Feed already being actualized: ' . $feed->url(false)); continue; } @@ -351,7 +351,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { //This entry already exists and is unchanged. TODO: Remove the test with the zero'ed hash in FreshRSS v1.3 $oldGuids[] = $entry->guid(); } else { //This entry already exists but has been updated - //Minz_Log::debug('Entry with GUID `' . $entry->guid() . '` updated in feed ' . $feed->url() . + //Minz_Log::debug('Entry with GUID `' . $entry->guid() . '` updated in feed ' . $feed->url(false) . //', old hash ' . $existingHash . ', new hash ' . $entry->hash()); $mark_updated_article_unread = $feed->attributes('mark_updated_article_unread') !== null ? ( $feed->attributes('mark_updated_article_unread') @@ -425,8 +425,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { max($feed_history, count($entries) + 10)); if ($nb > 0) { $needFeedCacheRefresh = true; - Minz_Log::debug($nb . ' old entries cleaned in feed [' . - $feed->url() . ']'); + Minz_Log::debug($nb . ' old entries cleaned in feed [' . $feed->url(false) . ']'); } } @@ -442,25 +441,25 @@ class FreshRSS_feed_Controller extends Minz_ActionController { if ($feed->selfUrl() !== $url) { //https://code.google.com/p/pubsubhubbub/wiki/MovingFeedsOrChangingHubs $selfUrl = checkUrl($feed->selfUrl()); if ($selfUrl) { - Minz_Log::debug('PubSubHubbub unsubscribe ' . $feed->url()); + Minz_Log::debug('PubSubHubbub unsubscribe ' . $feed->url(false)); if (!$feed->pubSubHubbubSubscribe(false)) { //Unsubscribe - Minz_Log::warning('Error while PubSubHubbub unsubscribing from ' . $feed->url()); + Minz_Log::warning('Error while PubSubHubbub unsubscribing from ' . $feed->url(false)); } $feed->_url($selfUrl, false); - Minz_Log::notice('Feed ' . $url . ' canonical address moved to ' . $feed->url()); + Minz_Log::notice('Feed ' . $url . ' canonical address moved to ' . $feed->url(false)); $feedDAO->updateFeed($feed->id(), array('url' => $feed->url())); } } } elseif ($feed->url() !== $url) { // HTTP 301 Moved Permanently - Minz_Log::notice('Feed ' . $url . ' moved permanently to ' . $feed->url()); + Minz_Log::notice('Feed ' . $url . ' moved permanently to ' . $feed->url(false)); $feedDAO->updateFeed($feed->id(), array('url' => $feed->url())); } $feed->faviconPrepare(); if ($pubsubhubbubEnabledGeneral && $feed->pubSubHubbubPrepare()) { - Minz_Log::notice('PubSubHubbub subscribe ' . $feed->url()); + Minz_Log::notice('PubSubHubbub subscribe ' . $feed->url(false)); if (!$feed->pubSubHubbubSubscribe(true)) { //Subscribe - Minz_Log::warning('Error while PubSubHubbub subscribing to ' . $feed->url()); + Minz_Log::warning('Error while PubSubHubbub subscribing to ' . $feed->url(false)); } } $feed->unlock(); diff --git a/app/Models/Feed.php b/app/Models/Feed.php index 89eb0a53c..0b5647261 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -59,8 +59,8 @@ class FreshRSS_Feed extends Minz_Model { return $this->hash; } - public function url() { - return $this->url; + public function url($includeCredentials = true) { + return $includeCredentials ? $this->url : SimplePie_Misc::url_remove_credentials($this->url); } public function selfUrl() { return $this->selfUrl; |
