Plugin Directory

Changeset 3173165


Ignore:
Timestamp:
10/21/2024 08:26:01 PM (16 months ago)
Author:
ali7ali
Message:

Security enhancements and code refactoring

File:
1 edited

Legend:

Unmodified
Added
Removed
  • alpha-price-table-for-elementor/trunk/includes/class-alpha-price-table-widget.php

    r3172016 r3173165  
    797797        $migration_allowed = Icons_Manager::is_migration_allowed();
    798798
    799         $allowed_tags = [
    800             'h2' => [],
    801             'h3' => [],
    802             'h4' => [],
    803             'h5' => [],
    804             'h6' => [],
    805         ];
     799        // Define an allow-list for heading tags
     800        $allowed_tags = ['h2', 'h3', 'h4', 'h5', 'h6'];
     801
     802        // Check if the provided tag is in the allow-list, default to 'h2' if not
     803        $heading_tag = in_array($settings['heading_tag'], $allowed_tags) ? $settings['heading_tag'] : 'h2';
    806804?>
    807805
     
    810808                <div class="elementor-price-table__header">
    811809                    <?php if (! empty($settings['heading'])) : ?>
    812                         <<?php echo wp_kses($settings['heading_tag'], $allowed_tags); ?> <?php echo wp_kses_post($this->get_render_attribute_string('heading')); ?>>
     810                        <<?php echo esc_attr($heading_tag); ?> <?php echo wp_kses_post($this->get_render_attribute_string('heading')); ?>>
    813811                            <?php echo wp_kses_post($settings['heading']); ?>
    814                         </<?php echo wp_kses($settings['heading_tag'], $allowed_tags); ?>>
     812                        </<?php echo esc_attr($heading_tag); ?>>
    815813                    <?php endif; ?>
    816814
Note: See TracChangeset for help on using the changeset viewer.