Mglaser has uploaded a new change for review.
https://gerrit.wikimedia.org/r/180555
Change subject: SECURITY: validate URL added to listings
......................................................................
SECURITY: validate URL added to listings
Ensure listings urls are valid, and not "javascript:", etc.
Use Html::element instead of rawElement when displaying name.
Bug: T77624
Change-Id: I64cca1632525cfe8c32ad59fe03a1a3997032e3d
---
M Listings.body.php
1 file changed, 10 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Listings
refs/changes/55/180555/1
diff --git a/Listings.body.php b/Listings.body.php
index 6f4a873..cba597e 100644
--- a/Listings.body.php
+++ b/Listings.body.php
@@ -203,12 +203,18 @@
}
// @fixme: a lot of localisation-unfriendly patchwork below
- $out = Html::rawElement( 'strong', array(), $name );
+ $out = Html::element( 'strong', array(), $name );
if ( $url != '' ) {
- $out = Html::rawElement( 'a',
- array( 'href' => $url, 'class' => 'external
text', 'rel' => 'nofollow', 'title' => $name ),
- $out
+ $sanitizedHref = Sanitizer::validateAttributes(
+ array( 'href' => $url ),
+ array( 'href' )
);
+ if ( isset( $sanitizedHref['href'] ) ) {
+ $out = Html::rawElement( 'a',
+ $sanitizedHref + array( 'class' =>
'external text', 'rel' => 'nofollow', 'title' => $name ),
+ $out
+ );
+ }
}
if ( $alt != '' ) {
// @todo FIXME: i18n issue (hard coded parentheses)
--
To view, visit https://gerrit.wikimedia.org/r/180555
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I64cca1632525cfe8c32ad59fe03a1a3997032e3d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Listings
Gerrit-Branch: master
Gerrit-Owner: Mglaser <[email protected]>
Gerrit-Reviewer: CSteipp <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits