r45427 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45426‎ | r45427 | r45428 >
Date:20:46, 5 January 2009
Author:brion
Status:ok
Tags:
Comment:
Follow-up to r45425 -- bug was in MWSearch, not core. It's supposed to be HTML-formatted, but was being built unsafely.
Adding a comment on SearchEngine to clarify that getSuggestionSnippet() returns HTML
Modified paths:
  • /trunk/extensions/MWSearch/MWSearch_body.php (modified) (history)
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/SearchEngine.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialSearch.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SearchEngine.php
@@ -470,7 +470,7 @@
471471 }
472472
473473 /**
474 - * @return string highlighted suggested query, '' if none
 474+ * @return string HTML highlighted suggested query, '' if none
475475 */
476476 function getSuggestionSnippet(){
477477 return '';
Index: trunk/phase3/includes/specials/SpecialSearch.php
@@ -169,7 +169,7 @@
170170 $this->powerSearchOptions()
171171 );
172172 $suggestLink = $sk->makeKnownLinkObj( $st,
173 - htmlspecialchars( $textMatches->getSuggestionSnippet() ),
 173+ $textMatches->getSuggestionSnippet(),
174174 $stParams );
175175
176176 $this->didYouMeanHtml = '<div class="searchdidyoumean">'.wfMsg('search-suggest',$suggestLink).'</div>';
@@ -947,7 +947,7 @@
948948 $this->powerSearchOptions());
949949
950950 $suggestLink = $sk->makeKnownLinkObj( $st,
951 - htmlspecialchars( $textMatches->getSuggestionSnippet() ),
 951+ $textMatches->getSuggestionSnippet(),
952952 $stParams );
953953
954954 $wgOut->addHTML('<div class="searchdidyoumean">'.wfMsg('search-suggest',$suggestLink).'</div>');
Index: trunk/phase3/RELEASE-NOTES
@@ -468,7 +468,6 @@
469469 that STDIN can be used for page list
470470 * Sanitizer::decodeCharReferences() now decodes the XHTML "&apos;" character
471471 entity (loosely related to bug 14365)
472 -* Fix XSS in Special:Search with extended engine features ("did you mean")
473472
474473 === API changes in 1.14 ===
475474
Index: trunk/extensions/MWSearch/MWSearch_body.php
@@ -598,10 +598,10 @@
599599 array_unshift($points,0);
600600 $suggestText = "";
601601 for($i=1;$i<count($points);$i+=2){
602 - $suggestText .= substr($sug,$points[$i-1],$points[$i]-$points[$i-1]);
603 - $suggestText .= '<em>'.substr($sug,$points[$i],$points[$i+1]-$points[$i])."</em>";
 602+ $suggestText .= htmlspecialchars(substr($sug,$points[$i-1],$points[$i]-$points[$i-1]));
 603+ $suggestText .= '<em>'.htmlspecialchars(substr($sug,$points[$i],$points[$i+1]-$points[$i]))."</em>";
604604 }
605 - $suggestText .= substr($sug,end($points));
 605+ $suggestText .= htmlspecialchars(substr($sug,end($points)));
606606
607607 $this->mSuggestionQuery = $this->replaceGenericPrefixes($sug);
608608 $this->mSuggestionSnippet = $this->replaceGenericPrefixes($suggestText);

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r45425* Fix XSS in Special:Search with extended engine features ("did you mean")...brion20:37, 5 January 2009

Status & tagging log