Skip to content

Commit

Permalink
fix: escape ticker ID in shortcode output (#28)
Browse files Browse the repository at this point in the history
Ticker ID is user input and may contain literally anything. While this
is properly escaped in the internal query, we should also escape it in
the generated HTML output.
  • Loading branch information
stklcode committed Feb 4, 2025
1 parent a0573a3 commit 313159c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions includes/class-scliveticker.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public static function shortcode_ticker_show( $atts ) {
$output = '<div class="wp-block-scliveticker-ticker';
if ( 1 === self::$options['enable_ajax'] ) {
$output .= ' sclt-ajax" '
. 'data-sclt-ticker="' . $ticker . '" '
. 'data-sclt-ticker="' . esc_attr( $ticker ) . '" '
. 'data-sclt-limit="' . $limit . '" '
. 'data-sclt-last="' . $last;
}
Expand All @@ -242,9 +242,9 @@ public static function shortcode_ticker_show( $atts ) {
if ( $show_feed ) {
$feed_link = get_post_type_archive_feed_link( 'scliveticker_tick' ) . '';
if ( false === strpos( $feed_link, '&' ) ) {
$feed_link .= '?scliveticker_ticker=' . $ticker;
$feed_link .= '?scliveticker_ticker=' . rawurlencode( $ticker );
} else {
$feed_link .= '&scliveticker_ticker=' . $ticker;
$feed_link .= '&scliveticker_ticker=' . rawurlencode( $ticker );
}
$output .= '<a href="' . esc_attr( $feed_link ) . '">Feed</a>';
}
Expand Down

0 comments on commit 313159c

Please sign in to comment.