Skip to content

Commit

Permalink
Search term should be escaped but not sanitized
Browse files Browse the repository at this point in the history
  • Loading branch information
delawski committed Jul 18, 2024
1 parent c7787cd commit c33a537
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions classes/class-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -908,18 +908,14 @@ public function filter_option( $args ) {
* @return void
*/
public function filter_search() {
$search = null;
if ( isset( $_GET['search'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
$search = sanitize_key( wp_unslash( $_GET['search'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
}
printf(
'<p class="search-box">
<label class="screen-reader-text" for="record-search-input">%1$s:</label>
<input type="search" id="record-search-input" name="search" value="%2$s" />
<input type="submit" name="" id="search-submit" class="button" value="%3$s" />
</p>',
esc_html__( 'Search Records', 'stream' ),
esc_attr( $search ),
esc_attr( ! empty( $_GET['search'] ) ? $_GET['search'] : '' ), // phpcs:ignore WordPress.Security.NonceVerification.Recommended
esc_attr__( 'Search Records', 'stream' )
);
}
Expand Down

0 comments on commit c33a537

Please sign in to comment.