Changeset 14784
- Timestamp:
- 03/31/2026 08:11:10 PM (6 hours ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/mu-plugins/pub/wporg-bad-request.php
r14775 r14784 204 204 205 205 /** 206 * Detect non-scalar values in Pattern Directory query parameters. 207 * 208 * Scanners pass nested arrays like `curation[$in][]=all` which cause PHP 209 * warnings downstream when the value is used in esc_attr(). 210 */ 211 add_action( 'send_headers', function() { 212 if ( ! str_contains( $_SERVER['REQUEST_URI'], 'wordpress.org/patterns/' ) ) { 213 return; 214 } 215 216 $scalar_only = [ 'curation', 'pattern-categories' ]; 217 218 foreach ( $scalar_only as $field ) { 219 if ( isset( $_REQUEST[ $field ] ) && ! is_scalar( $_REQUEST[ $field ] ) ) { 220 die_bad_request( "non-scalar $field in \$_REQUEST" ); 221 } 222 } 223 } ); 224 225 /** 206 226 * Detect invalid requests from vulnerability scanners to Jetpack Share by Email forms. 207 227 */
Note: See TracChangeset
for help on using the changeset viewer.