Reedy has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/52644


Change subject: Bug 45857 - wgRSSUrlWhitelist protocol relativity and partial 
matching
......................................................................

Bug 45857 - wgRSSUrlWhitelist protocol relativity and partial matching

Change-Id: I4482ecd5d71e0afcaf5a109c5925c40a53b1a6b1
---
M RSSHooks.php
1 file changed, 11 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/RSS 
refs/changes/44/52644/1

diff --git a/RSSHooks.php b/RSSHooks.php
index 5b7921b..fdf734f 100644
--- a/RSSHooks.php
+++ b/RSSHooks.php
@@ -55,10 +55,20 @@
                # disallow the feed url because the url is not whitelisted;  or
                # disallow because the wildcard joker is not present to allow 
any feed url
                # which can be dangerous
-
+                       $allowed = false;
                if ( !( in_array( $input, $wgRSSUrlWhitelist ) )
                        && !( in_array( "*", $wgRSSUrlWhitelist ) ) ) {
+                       $allowed = true;
+               } else {
+                       foreach( $wgRSSUrlWhitelist as $rss ) {
+                               if ( strpos( $input, $rss ) !== false {
+                                       $allowed = true;
+                                       break;
+                               }
+                       }
+               }
 
+               if ( !$allowed ) {
                        $listOfAllowed = 
$parser->getFunctionLang()->listToText( $wgRSSUrlWhitelist );
                        $numberAllowed = $parser->getFunctionLang()->formatNum( 
count( $wgRSSUrlWhitelist ) );
 

-- 
To view, visit https://gerrit.wikimedia.org/r/52644
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4482ecd5d71e0afcaf5a109c5925c40a53b1a6b1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/RSS
Gerrit-Branch: master
Gerrit-Owner: Reedy <re...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to