Make WordPress Core


Ignore:
Timestamp:
05/16/2018 10:38:20 PM (7 years ago)
Author:
iandunn
Message:

Comments: Escape permalink values on edit screen 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 1naveengiri, joyously.
Fixes #44115.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/edit-form-comment.php

    r42343 r43290  
    3131    <div id="comment-link-box">
    3232        <strong><?php _ex( 'Permalink:', 'comment' ); ?></strong>
    33         <span id="sample-permalink"><a href="<?php echo $comment_link; ?>"><?php echo $comment_link; ?></a></span>
     33        <span id="sample-permalink">
     34            <a href="<?php echo esc_url( $comment_link ); ?>">
     35                <?php echo esc_html( $comment_link ); ?>
     36            </a>
     37        </span>
    3438    </div>
    3539</div>
Note: See TracChangeset for help on using the changeset viewer.