Plugin Directory

Changeset 3418891


Ignore:
Timestamp:
12/13/2025 12:12:22 PM (3 months ago)
Author:
babbardel
Message:

Sanitize and validate term icon/image IDs for security

Location:
category-icon/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • category-icon/trunk/category-icon.php

    r3296463 r3418891  
    44 * Plugin URI:  http://pixelgrade.com
    55 * Description: Easily attach an icon and/or an image to a category, tag or any other taxonomy term.
    6  * Version: 1.0.2
     6 * Version: 1.0.3
    77 * Author: Pixelgrade
    88 * Author URI: http://pixelgrade.com
     
    3131    protected $plugin_baseurl = null;
    3232    protected $plugin_screen_hook_suffix = null;
    33     protected $version = '1.0.2';
     33    protected $version = '1.0.3';
    3434    protected $plugin_slug = 'category-icon';
    3535    protected $plugin_key = 'category-icon';
     
    299299            <td>
    300300                <div class="open_term_icon_preview">
    301                     <input type="hidden" name="term_icon_value" id="term_icon_value" value="<?php echo $current_value; ?>">
     301                    <input type="hidden" name="term_icon_value" id="term_icon_value" value="<?php echo esc_attr( $current_value ); ?>">
    302302                    <?php if ( empty( $current_value ) ) { ?>
    303303                        <span class="open_term_icon_upload button button-secondary">
     
    327327            <td>
    328328                <div class="open_term_image_preview">
    329                     <input type="hidden" name="term_image_value" id="term_image_value" value="<?php echo $current_image_value; ?>">
     329                    <input type="hidden" name="term_image_value" id="term_image_value" value="<?php echo esc_attr( $current_image_value ); ?>">
    330330                    <?php if ( empty( $current_image_value ) ) { ?>
    331331                        <span class="open_term_image_upload button button-secondary">
     
    350350    function save_taxonomy_custom_meta ( $term_id ) {
    351351        if ( isset( $_POST['term_icon_value'] ) ) {
    352             $value = $_POST['term_icon_value'];
     352            $value = absint( wp_unslash( $_POST['term_icon_value'] ) );
     353            if ( $value <= 0 ) {
     354                $value = '';
     355            }
    353356            $current_value = get_term_meta( $term_id, 'pix_term_icon', true );
    354357
     
    362365
    363366        if ( isset( $_POST['term_image_value'] ) ) {
    364             $value_image = $_POST['term_image_value'];
     367            $value_image = absint( wp_unslash( $_POST['term_image_value'] ) );
     368            if ( $value_image <= 0 ) {
     369                $value_image = '';
     370            }
    365371            $current_value_image = get_term_meta( $term_id, 'pix_term_image', true );
    366372
  • category-icon/trunk/readme.txt

    r3296463 r3418891  
    55Tested up to: 6.8.1
    66Requires PHP: 5.6.40
    7 Stable tag: 1.0.2
     7Stable tag: 1.0.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2626
    2727== Changelog ==
     28
     29= 1.0.3 =
     30* Security: sanitize and strictly validate term icon / image IDs on save and escape them on output to prevent XSS via the `term_icon_value` and `term_image_value` fields, even for Editor-level users.
    2831
    2932= 1.0.2 =
Note: See TracChangeset for help on using the changeset viewer.