Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
mecha committed Jan 31, 2024
2 parents dc4a2da + 46a7268 commit 45b57df
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 19 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [4.23.6] - 2024-01-31
### Changed
* Error information is suppressed for feeds with local address URLs. This improves the previous fix for CVE-2024-0628.

## [4.23.5] - 2024-01-24
### Fixed
* Error messages no longer reveal information about potentially inaccessible resources. (CVE-2024-0628)
Expand Down
7 changes: 2 additions & 5 deletions includes/admin-metaboxes.php
Original file line number Diff line number Diff line change
Expand Up @@ -503,11 +503,8 @@ function wprss_preview_meta_box_callback()

// Check if failed to fetch the feed
if (is_wp_error($feed)) {
// Log the error
printf(
'<span class="invalid-feed-url">%s</span>',
__('The URL is invalid or is not a URL to an RSS feed.', 'wprss')
);
$message = wprss_rewrite_feed_error($feed_url, $feed->get_error_message());
printf( '<span class="invalid-feed-url">%s</span>', $message);

echo wpautop(
sprintf(
Expand Down
28 changes: 16 additions & 12 deletions includes/feed-importing.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,12 @@ function wprss_get_feed_items( $feed_url, $source, $force_feed = FALSE ) {
$feed = wprss_fetch_feed( $feed_url, $source, $force_feed );

if (is_wp_error($feed)) {
wpra_get_logger($source)->error('Failed to fetch the RSS feed. {1}', [
$feed_url,
wprss_rewrite_feed_error($feed->get_error_message())
]);
if ($source !== null) {
wpra_get_logger($source)->error('Failed to fetch the RSS feed. {1}', [
$feed_url,
wprss_rewrite_feed_error($feed_url, $feed->get_error_message())
]);
}

return NULL;
}
Expand Down Expand Up @@ -420,13 +422,6 @@ function wprss_fetch_feed($url, $source = null, $param_force_feed = false)

// Convert the feed error into a WP_Error, if applicable
if ($feed->error()) {
if ($source !== null) {
$msg = sprintf(
__('Failed to fetch the RSS feed. Error: %s', 'wprss'),
wprss_rewrite_feed_error($feed->error())
);
update_post_meta($source, 'wprss_error_last_import', $msg);
}
return new WP_Error('simplepie-error', $feed->error(), array('feed' => $feed));
}
// If no error, return the feed and remove any error meta
Expand Down Expand Up @@ -1192,8 +1187,17 @@ function wpra_parse_url($url)
return $parsed;
}

function wprss_rewrite_feed_error(string $error)
function wprss_rewrite_feed_error(string $feed_url, string $error)
{
// Check if it's a local address
$host = parse_url($feed_url, PHP_URL_HOST);
$host = strtolower(trim($host));

if ($host === 'localhost' || $host === '127.0.0.1' ||
$host === '0.0.0.0' || $host === '::1') {
return __('Kindly double-check the feed URL.', 'wprss');
}

if (str_contains($error, 'invalid XML')) {
return __('The feed is not a valid XML document', 'wprss');
}
Expand Down
4 changes: 2 additions & 2 deletions wp-rss-aggregator.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin Name: WP RSS Aggregator
* Plugin URI: https://www.wprssaggregator.com/#utm_source=wpadmin&utm_medium=plugin&utm_campaign=wpraplugin
* Description: Imports and aggregates multiple RSS Feeds.
* Version: 4.23.5
* Version: 4.23.6
* Author: RebelCode
* Author URI: https://www.wprssaggregator.com
* Text Domain: wprss
Expand Down Expand Up @@ -78,7 +78,7 @@

// Set the version number of the plugin.
if( !defined( 'WPRSS_VERSION' ) )
define( 'WPRSS_VERSION', '4.23.5' );
define( 'WPRSS_VERSION', '4.23.6' );

if( !defined( 'WPRSS_WP_MIN_VERSION' ) )
define( 'WPRSS_WP_MIN_VERSION', '4.8' );
Expand Down

0 comments on commit 45b57df

Please sign in to comment.