Prevent leaking of filters through diffs

This commit is contained in:
Andrew Garrett 2009-03-22 02:12:51 +00:00
parent 80fdcf77ce
commit 4e6754e082
2 changed files with 15 additions and 5 deletions

View file

@ -425,12 +425,13 @@ class AbuseFilter {
$curCount = $wgMemc->get( $countKey );
$curTotal = $wgMemc->get( $totalKey );
$wgMemc->set( $totalKey, $curTotal + $time, 3600 );
if ($curCount)
if ($curCount) {
$wgMemc->set( $totalKey, $curTotal + $time, 3600 );
$wgMemc->incr( $countKey );
else
} else {
$wgMemc->set( $countKey, 1, 3600 );
$wgMemc->set( $totalKey, $time, 3600 );
}
}
public static function getFilterProfile( $filter ) {
@ -1259,7 +1260,9 @@ class AbuseFilter {
} else {
return null;
}
$vars->setVar( 'context', 'generated' );
if ($vars)
$vars->setVar( 'context', 'generated' );
return $vars;
}

View file

@ -52,6 +52,13 @@ class AbuseFilterViewDiff extends AbuseFilterView {
static $dependentSpecs = array( 'prev', 'next' );
static $cache = array();
global $wgUser;
if ( AbuseFilter::filterHidden( $this->mFilter ) &&
!$wgUser->isAllowed( 'abusefilter-modify' ) ) {
return null;
}
if ( isset( $cache[$spec] ) )
return $cache[$spec];