Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3284031
Add data tag to prevent spoofing of patrol links. Using data-mw="interface" for consistency.
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
Bawolff
Jan 26 2016, 11:40 PM
2016-01-26 23:40:09 (UTC+0)
Size
2 KB
Referenced Files
None
Subscribers
None
Add data tag to prevent spoofing of patrol links. Using data-mw="interface" for consistency.
View Options
From 26f1e6f6de2365202366b0025cce2a19cd05baab Mon Sep 17 00:00:00 2001
From: Brian Wolff <bawolff+wn@gmail.com>
Date: Tue, 27 Oct 2015 02:31:00 -0600
Subject: [PATCH] Add data attribute to patrol links so it can't be spoofed by
user
Javascript used to look just for the patrollinks class, which
could be set by the user in order to patrol an arbitrary page.
Bug: T103239
Change-Id: I13fcc3ce479c0a4a90a6217c2e5244f051eaf862
---
includes/diff/DifferenceEngine.php | 2 +-
includes/page/Article.php | 2 +-
resources/src/mediawiki/page/patrol.ajax.js | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/includes/diff/DifferenceEngine.php b/includes/diff/DifferenceEngine.php
index d588d51..ca64f89 100644
--- a/includes/diff/DifferenceEngine.php
+++ b/includes/diff/DifferenceEngine.php
@@ -474,7 +474,7 @@ class DifferenceEngine extends ContextSource {
if ( !$linkInfo ) {
$this->mMarkPatrolledLink = '';
} else {
- $this->mMarkPatrolledLink = ' <span class="patrollink">[' . Linker::linkKnown(
+ $this->mMarkPatrolledLink = ' <span class="patrollink" data-mw="interface">[' . Linker::linkKnown(
$this->mNewPage,
$this->msg( 'markaspatrolleddiff' )->escaped(),
array(),
diff --git a/includes/page/Article.php b/includes/page/Article.php
index f16158b..6e12cb7 100644
--- a/includes/page/Article.php
+++ b/includes/page/Article.php
@@ -1214,7 +1214,7 @@ class Article implements Page {
);
$outputPage->addHTML(
- "<div class='patrollink'>" .
+ "<div class='patrollink' data-mw='interface'>" .
wfMessage( 'markaspatrolledlink' )->rawParams( $link )->escaped() .
'</div>'
);
diff --git a/resources/src/mediawiki/page/patrol.ajax.js b/resources/src/mediawiki/page/patrol.ajax.js
index f9b0d35..2ad1ea4 100644
--- a/resources/src/mediawiki/page/patrol.ajax.js
+++ b/resources/src/mediawiki/page/patrol.ajax.js
@@ -12,7 +12,7 @@
return;
}
$( function () {
- var $patrolLinks = $( '.patrollink a' );
+ var $patrolLinks = $( '.patrollink[data-mw="interface"] a' );
$patrolLinks.on( 'click', function ( e ) {
var $spinner, href, rcid, apiRequest;
--
2.0.1
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3291447
Default Alt Text
Add data tag to prevent spoofing of patrol links. Using data-mw="interface" for consistency. (2 KB)
Attached To
Mode
T103239: Patrol allows click catching and patrolling of any page
Attached
Detach File
Event Timeline
Log In to Comment