From d782ee4c3cc99fc217794aad890edb1ebf8baab6 Mon Sep 17 00:00:00 2001 From: David Baumwald Date: Wed, 3 Nov 2021 20:00:36 +0000 Subject: [PATCH] Comments: Add `noopener noreferrer` to author links in list table. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When viewing the listing of all comments, author links previously passed referrer information to untrusted URLs. This change adds `noreferrer` to each author link, as well as `noopener` to prevent the passing of information about the parent window. Props cybr, adam3128, erayalakese, andraganescu, audrasjb, joedolson, sabernhardt.  Fixes #40916. git-svn-id: https://develop.svn.wordpress.org/trunk@52007 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/class-wp-comments-list-table.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/wp-admin/includes/class-wp-comments-list-table.php b/src/wp-admin/includes/class-wp-comments-list-table.php index 2fbbbc3328..9f7a998a4d 100644 --- a/src/wp-admin/includes/class-wp-comments-list-table.php +++ b/src/wp-admin/includes/class-wp-comments-list-table.php @@ -947,7 +947,12 @@ class WP_Comments_List_Table extends WP_List_Table { echo '
'; if ( ! empty( $author_url_display ) ) { - printf( '%s
', esc_url( $author_url ), esc_html( $author_url_display ) ); + // Print link to author URL, and disallow referrer information (without using target="_blank"). + printf( + '%s
', + esc_url( $author_url ), + esc_html( $author_url_display ) + ); } if ( $this->user_can ) {