r108320 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108319‎ | r108320 | r108321 >
Date:15:09, 7 January 2012
Author:ashley
Status:ok (Comments)
Tags:
Comment:
Comments: follow-up to r108295: XSS fix
Modified paths:
  • /trunk/extensions/Comments/SpecialCommentIgnoreList.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Comments/SpecialCommentIgnoreList.php
@@ -42,6 +42,7 @@
4343 $out .= $this->displayCommentBlockList();
4444 } else {
4545 if( $wgRequest->wasPosted() ) {
 46+ $user_name = htmlspecialchars_decode( $user_name );
4647 $user_id = User::idFromName( $user_name );
4748 // Anons can be comment-blocked, but idFromName returns nothing
4849 // for an anon, so...
@@ -112,9 +113,9 @@
113114 wfMsg( 'comment-ignore-remove-message', $user_name ) .
114115 '</div>
115116 <div>
116 - <form action="" method="post" name="comment_block">
117 - <input type="hidden" name="user" value="' . $user_name . '" />
118 - <input type="button" class="site-button" value="' . wfMsg( 'comment-ignore-unblock' ) . '" onclick="document.comment_block.submit()" />
 117+ <form action="" method="post" name="comment_block">' .
 118+ Html::hidden( 'user', htmlspecialchars( $user_name, ENT_QUOTES ) ) .
 119+ '<input type="button" class="site-button" value="' . wfMsg( 'comment-ignore-unblock' ) . '" onclick="document.comment_block.submit()" />
119120 <input type="button" class="site-button" value="' . wfMsg( 'comment-ignore-cancel' ) . '" onclick="history.go(-1)" />
120121 </form>
121122 </div>';

Follow-up revisions

RevisionCommit summaryAuthorDate
r108327Comments: follow-up to r108320: remove htmlspecialchars() call, as per CRashley20:02, 7 January 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r108295Comments: allow removing anonymous users from your ignore list. User::idFromN...ashley00:39, 7 January 2012

Comments

#Comment by Johnduhart (talk | contribs)   19:56, 7 January 2012

No need to escape with htmlspecialchars, Html::hidden does that automatically via Html::element

Status & tagging log