Make WordPress Core


Ignore:
Timestamp:
05/12/2018 03:55:36 PM (6 years ago)
Author:
iandunn
Message:

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.
Fixes #44054.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/comment.php

    r43154 r43245  
    33543354                case 'comment_link':
    33553355                    $value = get_comment_link( $comment->comment_ID );
    3356                     $value = '<a href="' . $value . '" target="_blank" rel="noreferrer noopener">' . $value . '</a>';
     3356                    $value = sprintf(
     3357                        '<a href="%s" target="_blank" rel="noreferrer noopener">%s</a>',
     3358                        esc_url( $value ),
     3359                        esc_html( $value )
     3360                    );
    33573361                    break;
    33583362            }
Note: See TracChangeset for help on using the changeset viewer.