mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-27 23:40:19 +00:00
Prevent leaking of filters through diffs
This commit is contained in:
parent
80fdcf77ce
commit
4e6754e082
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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];
|
||||
|
||||
|
|
Loading…
Reference in a new issue