Skip to:
Content

BuddyPress.org

Changeset 10061


Ignore:
Timestamp:
08/22/2015 04:20:43 PM (11 years ago)
Author:
johnjamesjacoby
Message:

Messages: Audit bp-messages-template.php output functions and add escaping and/or sanitization based on their anticipated results and usages.

Hat-tip boonebgorges. Props vnd.

For 2.3.3 (2.3 branch)

Location:
branches/2.3/src/bp-messages
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2.3/src/bp-messages/bp-messages-filters.php

    r9949 r10061  
    5858add_filter( 'bp_get_the_thread_message_content', 'wpautop' );
    5959
    60 add_filter( 'bp_get_message_notice_subject',     'stripslashes_deep' );
    61 add_filter( 'bp_get_message_notice_text',        'stripslashes_deep' );
    62 add_filter( 'bp_get_message_thread_subject',     'stripslashes_deep' );
    63 add_filter( 'bp_get_message_thread_excerpt',     'stripslashes_deep' );
    64 add_filter( 'bp_get_messages_subject_value',     'stripslashes_deep' );
    65 add_filter( 'bp_get_messages_content_value',     'stripslashes_deep' );
    66 add_filter( 'bp_get_the_thread_message_content', 'stripslashes_deep' );
    67 add_filter( 'bp_get_the_thread_subject',         'stripslashes_deep' );
     60add_filter( 'bp_get_message_notice_subject',          'stripslashes_deep' );
     61add_filter( 'bp_get_message_notice_text',             'stripslashes_deep' );
     62add_filter( 'bp_get_message_thread_subject',          'stripslashes_deep' );
     63add_filter( 'bp_get_message_thread_excerpt',          'stripslashes_deep' );
     64add_filter( 'bp_get_message_get_recipient_usernames', 'stripslashes_deep' );
     65add_filter( 'bp_get_messages_subject_value',          'stripslashes_deep' );
     66add_filter( 'bp_get_messages_content_value',          'stripslashes_deep' );
     67add_filter( 'bp_get_the_thread_message_content',      'stripslashes_deep' );
     68add_filter( 'bp_get_the_thread_subject',              'stripslashes_deep' );
    6869
    6970/**
  • branches/2.3/src/bp-messages/bp-messages-template.php

    r10058 r10061  
    649649 */
    650650function bp_message_thread_delete_link() {
    651         echo bp_get_message_thread_delete_link();
     651        echo esc_url( bp_get_message_thread_delete_link() );
    652652}
    653653        /**
    … …  
    768768 */
    769769function bp_message_css_class() {
    770         echo bp_get_message_css_class();
     770        echo esc_attr( bp_get_message_css_class() );
    771771}
    772772        /**
    … …  
    820820 */
    821821function bp_message_thread_unread_count() {
    822         echo bp_get_message_thread_unread_count();
     822        echo esc_html( bp_get_message_thread_unread_count() );
    823823}
    824824        /**
    … …  
    10951095        }
    10961096
    1097         echo $message;
     1097        echo esc_html( $message );
    10981098}
    10991099
    … …  
    11421142 */
    11431143function bp_messages_form_action() {
    1144         echo bp_get_messages_form_action();
     1144        echo esc_url( bp_get_messages_form_action() );
    11451145}
    11461146        /**
    … …  
    11651165 */
    11661166function bp_messages_username_value() {
    1167         echo bp_get_messages_username_value();
     1167        echo esc_attr( bp_get_messages_username_value() );
    11681168}
    11691169        /**
    … …  
    11961196 */
    11971197function bp_messages_subject_value() {
    1198         echo bp_get_messages_subject_value();
     1198        echo esc_attr( bp_get_messages_subject_value() );
    11991199}
    12001200        /**
    … …  
    12071207         */
    12081208        function bp_get_messages_subject_value() {
     1209
     1210                // Sanitized in bp-messages-filters.php
    12091211                $subject = ! empty( $_POST['subject'] )
    12101212                        ? $_POST['subject']
    … …  
    12251227 */
    12261228function bp_messages_content_value() {
    1227         echo bp_get_messages_content_value();
     1229        echo esc_textarea( bp_get_messages_content_value() );
    12281230}
    12291231        /**
    … …  
    12371239        function bp_get_messages_content_value() {
    12381240
    1239                 $content = !empty( $_POST['content'] )
     1241                // Sanitized in bp-messages-filters.php
     1242                $content = ! empty( $_POST['content'] )
    12401243                        ? $_POST['content']
    12411244                        : '';
    … …  
    13631366 */
    13641367function bp_message_notice_id() {
    1365         echo bp_get_message_notice_id();
     1368        echo (int) bp_get_message_notice_id();
    13661369}
    13671370        /**
    … …  
    14591462 */
    14601463function bp_message_notice_delete_link() {
    1461         echo bp_get_message_notice_delete_link();
     1464        echo esc_url( bp_get_message_notice_delete_link() );
    14621465}
    14631466        /**
    … …  
    14841487 */
    14851488function bp_message_activate_deactivate_link() {
    1486         echo bp_get_message_activate_deactivate_link();
     1489        echo esc_url( bp_get_message_activate_deactivate_link() );
    14871490}
    14881491        /**
    … …  
    15141517 */
    15151518function bp_message_activate_deactivate_text() {
    1516         echo bp_get_message_activate_deactivate_text();
     1519        echo esc_html( bp_get_message_activate_deactivate_text() );
    15171520}
    15181521        /**
    … …  
    16041607 */
    16051608function bp_send_private_message_link() {
    1606         echo bp_get_send_private_message_link();
     1609        echo esc_url( bp_get_send_private_message_link() );
    16071610}
    16081611        /**
    … …  
    16811684 */
    16821685function bp_message_loading_image_src() {
    1683         echo bp_get_message_loading_image_src();
     1686        echo esc_url( bp_get_message_loading_image_src() );
    16841687}
    16851688        /**
    … …  
    17291732 */
    17301733function bp_message_get_recipient_usernames() {
    1731         echo bp_get_message_get_recipient_usernames();
     1734        echo esc_attr( bp_get_message_get_recipient_usernames() );
    17321735}
    17331736        /**
    … …  
    17371740         */
    17381741        function bp_get_message_get_recipient_usernames() {
    1739                 $recipients = isset( $_GET['r'] ) ? stripslashes( $_GET['r'] ) : '';
     1742
     1743                // Sanitized in bp-messages-filters.php
     1744                $recipients = isset( $_GET['r'] )
     1745                        ? $_GET['r']
     1746                        : '';
    17401747
    17411748                /**
    … …  
    19811988 */
    19821989function bp_thread_messages_order() {
    1983         echo bp_get_thread_messages_order();
     1990        echo esc_attr( bp_get_thread_messages_order() );
    19841991}
    19851992        /**
    … …  
    20192026 */
    20202027function bp_the_thread_id() {
    2021         echo bp_get_the_thread_id();
     2028        echo (int) bp_get_the_thread_id();
    20222029}
    20232030        /**
    … …  
    20722079 * @return string
    20732080 */
    2074 function bp_get_the_thread_recipients(){
     2081function bp_get_the_thread_recipients() {
    20752082        if ( 5 <= bp_get_thread_recipients_count() ) {
    20762083                $recipients = sprintf( __( '%s recipients', 'buddypress' ), number_format_i18n( bp_get_thread_recipients_count() ) );
    … …  
    21602167 */
    21612168function bp_the_thread_message_id() {
    2162         echo bp_get_the_thread_message_id();
     2169        echo (int) bp_get_the_thread_message_id();
    21632170}
    21642171        /**
    … …  
    21922199 */
    21932200function bp_the_thread_message_css_class() {
    2194         echo bp_get_the_thread_message_css_class();
     2201        echo esc_attr( bp_get_the_thread_message_css_class() );
    21952202}
    21962203        /**
    … …  
    22332240 */
    22342241function bp_the_thread_message_alt_class() {
    2235         echo bp_get_the_thread_message_alt_class();
     2242        echo esc_attr( bp_get_the_thread_message_alt_class() );
    22362243}
    22372244        /**
    … …  
    22652272 */
    22662273function bp_the_thread_message_sender_id() {
    2267         echo bp_get_the_thread_message_sender_id();
     2274        echo (int) bp_get_the_thread_message_sender_id();
    22682275}
    22692276        /**
    … …  
    23412348 */
    23422349function bp_the_thread_message_sender_link() {
    2343         echo bp_get_the_thread_message_sender_link();
     2350        echo esc_url( bp_get_the_thread_message_sender_link() );
    23442351}
    23452352        /**
    … …  
    23652372 */
    23662373function bp_the_thread_message_sender_name() {
    2367         echo bp_get_the_thread_message_sender_name();
     2374        echo esc_html( bp_get_the_thread_message_sender_name() );
    23682375}
    23692376        /**
    … …  
    23952402 */
    23962403function bp_the_thread_delete_link() {
    2397         echo bp_get_the_thread_delete_link();
     2404        echo esc_url( bp_get_the_thread_delete_link() );
    23982405}
    23992406        /**
Note: See TracChangeset for help on using the changeset viewer.