From a8b56cb1c9b59cc58d8f5fbb2f479829019a53d4 Mon Sep 17 00:00:00 2001 From: JR Tashjian Date: Tue, 3 Mar 2026 12:58:39 -0500 Subject: [PATCH] Sanitize event time and error messages to prevent XSS --- src/blocks/events/index.php | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/blocks/events/index.php b/src/blocks/events/index.php index 9f82323c0d5..c888f1908d4 100644 --- a/src/blocks/events/index.php +++ b/src/blocks/events/index.php @@ -99,8 +99,8 @@ function coblocks_render_coblocks_events_block( $attributes, $content ) { $event_time_string = sprintf( '%1$s - %2$s', - gmdate( 'g:ia', $start_date_string ), - gmdate( 'g:ia', $end_date_string ) + esc_html( gmdate( 'g:ia', $start_date_string ) ), + esc_html( gmdate( 'g:ia', $end_date_string ) ) ); $events_layout .= coblocks_render_single_day_event_item( @@ -117,8 +117,8 @@ function coblocks_render_coblocks_events_block( $attributes, $content ) { $event_time_string = sprintf( '%1$s - %2$s', - gmdate( 'g:ia', $start_date_string ), - gmdate( 'g:ia', $end_date_string ) + esc_html( gmdate( 'g:ia', $start_date_string ) ), + esc_html( gmdate( 'g:ia', $end_date_string ) ) ); $events_layout .= coblocks_render_multi_day_event_item( @@ -136,8 +136,8 @@ function coblocks_render_coblocks_events_block( $attributes, $content ) { $event_time_string = sprintf( '', - gmdate( 'c', $start_date_string ), - gmdate( 'c', $end_date_string ) + esc_html( gmdate( 'c', $start_date_string ) ), + esc_html( gmdate( 'c', $end_date_string ) ) ); $events_layout .= coblocks_render_single_day_event_item( @@ -154,8 +154,8 @@ function coblocks_render_coblocks_events_block( $attributes, $content ) { $event_time_string = sprintf( '', - gmdate( 'c', $start_date_string ), - gmdate( 'c', $end_date_string ) + esc_html( gmdate( 'c', $start_date_string ) ), + esc_html( gmdate( 'c', $end_date_string ) ) ); $events_layout .= coblocks_render_multi_day_event_item( @@ -188,8 +188,8 @@ function coblocks_render_coblocks_events_block( $attributes, $content ) { $events_layout .= ''; - $events_layout .= sprintf( '