Privacy: Escape comment URLs in personal export file to prevent XSS.

There doesn't appear to be any way for an attacker to introduce malicious input into the URL, unless a plugin is filtering the URL to add it, but it's better to be safe than sorry.

Props birgire.
Merges [43245] to the 4.9 branch.
Fixes #44054.

git-svn-id: https://develop.svn.wordpress.org/branches/4.9@43270 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2018-05-15 14:07:32 +00:00
parent c5387f14f6
commit 7dcbacc723

View File

@ -3237,7 +3237,11 @@ function wp_comments_personal_data_exporter( $email_address, $page = 1 ) {
case 'comment_link':
$value = get_comment_link( $comment->comment_ID );
$value = '<a href="' . $value . '" target="_blank" rel="noreferrer noopener">' . $value . '</a>';
$value = sprintf(
'<a href="%s" target="_blank" rel="noreferrer noopener">%s</a>',
esc_url( $value ),
esc_html( $value )
);
break;
}