Plugin Directory

Changeset 3708608


Ignore:
Timestamp:
09/23/2026 06:21:21 AM (4 weeks ago)
Author:
metaphorcreations
Message:

security fix

Location:
ditty-news-ticker
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • ditty-news-ticker/tags/3.1.71/ditty-news-ticker.php

    r3705336 r3708608  
    55 * Plugin URI:        https://www.metaphorcreations.com/ditty
    66 * Description:       Ditty offers a range of content display options, including its signature news ticker and customizable layouts.
    7  * Version:           3.1.70
     7 * Version:           3.1.71
    88 * Author:            Metaphor Creations
    99 * Author URI:        https://www.metaphorcreations.com
    … …  
    2424// Plugin version.
    2525if ( ! defined( 'DITTY_VERSION' ) ) {
    26         define( 'DITTY_VERSION', '3.1.70' );
     26        define( 'DITTY_VERSION', '3.1.71' );
    2727}
    2828
  • ditty-news-ticker/tags/3.1.71/includes/class-ditty-singles.php

    r3538064 r3708608  
    188188                if ( '' != $display_settings && 'false' != $display_settings ) {
    189189                        parse_str( html_entity_decode( $display_settings ), $custom_display_settings );
     190                        $custom_display_settings = ditty_sanitize_custom_display_settings( $custom_display_settings );
    190191                        if ( is_array( $custom_display_settings ) && count( $custom_display_settings ) > 0 ) {
    191192                                foreach ( $custom_display_settings as $key => $value ) {
     193                                        if ( is_array( $value ) ) {
     194                                                continue;
     195                                        }
    192196                                        $parts = explode( '|', $value );
    193197                                        if ( is_array( $parts ) && count( $parts ) > 0 ) {
    … …  
    368372          $display_type = $custom_display_array['type'];
    369373        }
    370         if ( isset( $custom_display_array['settings'] ) ) {
    371           $args = wp_parse_args( $custom_display_array['settings'], $args );
     374        if ( isset( $custom_display_array['settings'] ) && is_array( $custom_display_array['settings'] ) ) {
     375          $custom_display_settings_array = ditty_sanitize_custom_display_settings( $custom_display_array['settings'] );
     376          $args = wp_parse_args( $custom_display_settings_array, $args );
    372377        }
    373378      } else {
  • ditty-news-ticker/tags/3.1.71/includes/helpers.php

    r3661664 r3708608  
    15881588
    15891589/**
     1590 * Return setting keys that can't be set through custom display settings
     1591 *
     1592 * These values are always generated by Ditty. The display scripts render some
     1593 * of them as HTML, so they can't be overwritten from a shortcode, block or
     1594 * ajax request.
     1595 * *
     1596 * @since   3.1.70
     1597 */
     1598function ditty_protected_display_setting_keys() {
     1599        return apply_filters( 'ditty_protected_display_setting_keys', array(
     1600                'id',
     1601                'uniqid',
     1602                'title',
     1603                'status',
     1604                'display',
     1605                'items',
     1606                'showEditor',
     1607        ) );
     1608}
     1609
     1610/**
     1611 * Sanitize custom display settings from a shortcode, block or ajax request
     1612 * *
     1613 * @since   3.1.70
     1614 */
     1615function ditty_sanitize_custom_display_settings( $settings, $depth = 0 ) {
     1616        if ( ! is_array( $settings ) || $depth > 5 ) {
     1617                return array();
     1618        }
     1619
     1620        $protected_keys = array_map( 'strtolower', ditty_protected_display_setting_keys() );
     1621        $sanitized_settings = array();
     1622        foreach ( $settings as $key => $value ) {
     1623                if ( is_string( $key ) ) {
     1624                        $key = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $key );
     1625                        if ( '' === $key ) {
     1626                                continue;
     1627                        }
     1628                        if ( 0 === $depth && in_array( strtolower( $key ), $protected_keys, true ) ) {
     1629                                continue;
     1630                        }
     1631                } elseif ( ! is_int( $key ) ) {
     1632                        continue;
     1633                }
     1634
     1635                if ( is_array( $value ) ) {
     1636                        $sanitized_settings[$key] = ditty_sanitize_custom_display_settings( $value, $depth + 1 );
     1637                } elseif ( is_bool( $value ) || is_int( $value ) || is_float( $value ) || is_null( $value ) ) {
     1638                        $sanitized_settings[$key] = $value;
     1639                } else {
     1640                        $sanitized_settings[$key] = sanitize_text_field( $value );
     1641                }
     1642        }
     1643        return $sanitized_settings;
     1644}
     1645
     1646/**
    15901647 * Make sure an image url is safe
    15911648 */
  • ditty-news-ticker/tags/3.1.71/readme.txt

    r3705336 r3708608  
    66Requires PHP: 7.4
    77Tested up to: 7.1.1
    8 Stable tag: 3.1.70
     8Stable tag: 3.1.71
    99License: GPL2
    1010
    … …  
    135135
    136136== Changelog ==
     137
     138= 3.1.71 [2026-09-23] =
     139* Security fix: sanitize custom display settings and block protected keys passed via shortcodes, blocks and AJAX
    137140
    138141= 3.1.70 [2026-09-21] =
  • ditty-news-ticker/trunk/ditty-news-ticker.php

    r3705336 r3708608  
    55 * Plugin URI:        https://www.metaphorcreations.com/ditty
    66 * Description:       Ditty offers a range of content display options, including its signature news ticker and customizable layouts.
    7  * Version:           3.1.70
     7 * Version:           3.1.71
    88 * Author:            Metaphor Creations
    99 * Author URI:        https://www.metaphorcreations.com
    … …  
    2424// Plugin version.
    2525if ( ! defined( 'DITTY_VERSION' ) ) {
    26         define( 'DITTY_VERSION', '3.1.70' );
     26        define( 'DITTY_VERSION', '3.1.71' );
    2727}
    2828
  • ditty-news-ticker/trunk/includes/class-ditty-singles.php

    r3538064 r3708608  
    188188                if ( '' != $display_settings && 'false' != $display_settings ) {
    189189                        parse_str( html_entity_decode( $display_settings ), $custom_display_settings );
     190                        $custom_display_settings = ditty_sanitize_custom_display_settings( $custom_display_settings );
    190191                        if ( is_array( $custom_display_settings ) && count( $custom_display_settings ) > 0 ) {
    191192                                foreach ( $custom_display_settings as $key => $value ) {
     193                                        if ( is_array( $value ) ) {
     194                                                continue;
     195                                        }
    192196                                        $parts = explode( '|', $value );
    193197                                        if ( is_array( $parts ) && count( $parts ) > 0 ) {
    … …  
    368372          $display_type = $custom_display_array['type'];
    369373        }
    370         if ( isset( $custom_display_array['settings'] ) ) {
    371           $args = wp_parse_args( $custom_display_array['settings'], $args );
     374        if ( isset( $custom_display_array['settings'] ) && is_array( $custom_display_array['settings'] ) ) {
     375          $custom_display_settings_array = ditty_sanitize_custom_display_settings( $custom_display_array['settings'] );
     376          $args = wp_parse_args( $custom_display_settings_array, $args );
    372377        }
    373378      } else {
  • ditty-news-ticker/trunk/includes/helpers.php

    r3661664 r3708608  
    15881588
    15891589/**
     1590 * Return setting keys that can't be set through custom display settings
     1591 *
     1592 * These values are always generated by Ditty. The display scripts render some
     1593 * of them as HTML, so they can't be overwritten from a shortcode, block or
     1594 * ajax request.
     1595 * *
     1596 * @since   3.1.70
     1597 */
     1598function ditty_protected_display_setting_keys() {
     1599        return apply_filters( 'ditty_protected_display_setting_keys', array(
     1600                'id',
     1601                'uniqid',
     1602                'title',
     1603                'status',
     1604                'display',
     1605                'items',
     1606                'showEditor',
     1607        ) );
     1608}
     1609
     1610/**
     1611 * Sanitize custom display settings from a shortcode, block or ajax request
     1612 * *
     1613 * @since   3.1.70
     1614 */
     1615function ditty_sanitize_custom_display_settings( $settings, $depth = 0 ) {
     1616        if ( ! is_array( $settings ) || $depth > 5 ) {
     1617                return array();
     1618        }
     1619
     1620        $protected_keys = array_map( 'strtolower', ditty_protected_display_setting_keys() );
     1621        $sanitized_settings = array();
     1622        foreach ( $settings as $key => $value ) {
     1623                if ( is_string( $key ) ) {
     1624                        $key = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $key );
     1625                        if ( '' === $key ) {
     1626                                continue;
     1627                        }
     1628                        if ( 0 === $depth && in_array( strtolower( $key ), $protected_keys, true ) ) {
     1629                                continue;
     1630                        }
     1631                } elseif ( ! is_int( $key ) ) {
     1632                        continue;
     1633                }
     1634
     1635                if ( is_array( $value ) ) {
     1636                        $sanitized_settings[$key] = ditty_sanitize_custom_display_settings( $value, $depth + 1 );
     1637                } elseif ( is_bool( $value ) || is_int( $value ) || is_float( $value ) || is_null( $value ) ) {
     1638                        $sanitized_settings[$key] = $value;
     1639                } else {
     1640                        $sanitized_settings[$key] = sanitize_text_field( $value );
     1641                }
     1642        }
     1643        return $sanitized_settings;
     1644}
     1645
     1646/**
    15901647 * Make sure an image url is safe
    15911648 */
  • ditty-news-ticker/trunk/readme.txt

    r3705336 r3708608  
    66Requires PHP: 7.4
    77Tested up to: 7.1.1
    8 Stable tag: 3.1.70
     8Stable tag: 3.1.71
    99License: GPL2
    1010
    … …  
    135135
    136136== Changelog ==
     137
     138= 3.1.71 [2026-09-23] =
     139* Security fix: sanitize custom display settings and block protected keys passed via shortcodes, blocks and AJAX
    137140
    138141= 3.1.70 [2026-09-21] =
Note: See TracChangeset for help on using the changeset viewer.