Making WordPress.org

Changeset 9939


Ignore:
Timestamp:
05/29/2020 01:46:45 AM (5 years ago)
Author:
dd32
Message:

Bad Requests: Remove a case that was fixed in bbPress, expand the Jetpack Contact Form/Subscription logic.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/mu-plugins/pub/wporg-bad-request.php

    r9926 r9939  
    5757    if (
    5858        isset( $_REQUEST['action'], $_REQUEST['email'], $_REQUEST['redirect_fragment'] )
    59         && 'subscribe' === $_REQUEST['action']
     59        && ( 'subscribe' === $_REQUEST['action'] || isset( $_REQUEST['jetpack_subscriptions_widget'] ) )
    6060    ) {
    61         if ( ! is_string( $_REQUEST['email'] ) || ! is_string( $_REQUEST['redirect_fragment'] ) ) {
     61        if ( ! is_string( $_REQUEST['action'] ) || ! is_string( $_REQUEST['email'] ) || ! is_string( $_REQUEST['redirect_fragment'] ) ) {
    6262            die_bad_request( "non-scalar input to Jetpack Subscribe widget" );
    6363        }
     
    7373        }
    7474        if ( ! isset( $_SERVER['HTTP_REFERER'] ) || ! isset( $_SERVER['HTTP_USER_AGENT'] ) ) {
    75             die_bad_request( "Missing referer or user-agent" );
     75            die_bad_request( "Missing referer or user-agent for Jetpack Contact Form" );
    7676        }
    7777        foreach ( $_REQUEST as $k => $v ) {
    78             if ( 'sample@email.tst' === $v ) {
     78            if ( 'sample@email.tst' === $v || ( !empty( $v[0] ) && 'sample@email.tst' === $v[0] ) ) {
    7979                die_bad_request( "sample@email.tst input to Jetpack Contact Form" );
    8080            }
    8181        }
    8282    }
    83 } );
    84 
    85 // bbPress - https://bbpress.trac.wordpress.org/ticket/3373
    86 add_action( 'template_redirect', function () {
    87     if ( isset( $_REQUEST['action'] ) && is_array( $_REQUEST['action'] ) && function_exists( 'bbpress' ) ) {
    88         if ( isset( $_REQUEST['action'][0] ) && 'bbp' === substr( $_REQUEST['action'][0], 0, 3 ) ) {
    89             die_bad_request( "non-scalar input to bbPress subactions." );
    90         }
    91     }
    92 }, 5 ); // before bbp_template_redirect
     83}, 9 );
    9384
    9485/**
Note: See TracChangeset for help on using the changeset viewer.