Plugin Directory

Changeset 3212197


Ignore:
Timestamp:
12/23/2024 01:10:01 PM (12 months ago)
Author:
flippercode
Message:

security issues updated

Location:
ai-content
Files:
274 added
2 edited

Legend:

Unmodified
Added
Removed
  • ai-content/trunk/readme.txt

    r3189242 r3212197  
    44Tags: chatgpt, openai, gpt,ai,content
    55Requires at least: 4.0
    6 Tested up to: 6.7.0
    7 Stable tag: 1.0.7
     6Tested up to: 6.7.1
     7Stable tag: 1.0.8
    88Requires PHP: 5.0
    99License: GPLv2 or later
     
    122122== Changelog ==
    123123
     124= 1.0.8 =
     125* Fix : Security issue in shortcode render function fixed.
     126
    124127= 1.0.7 =
    125128* Fix : Max Token error is resolved.
  • ai-content/trunk/text-prompter.php

    r3168185 r3212197  
    66Author: flippercode
    77Author URI: https://www.flippercode.com/
    8 Version: 1.0.7
     8Version: 1.0.8
    99Text Domain: text-prompter
    1010Domain Path: /lang/
     
    8080                'pluginDirectoryBaseName' => basename( dirname( __FILE__ ) ),
    8181                'settingsPageSlug'        => 'wai_manage_settings',
    82                 'plugin_row_links'        => array( 'Docs' => 'http://guide.flippercode.com/securityquestions/' ),
     82                'plugin_row_links'        => array( 'Docs' => admin_url('admin.php?page=wai_how_overview') ),
    8383            );
    8484
     
    8989
    9090            if ( is_admin() ) {
     91
    9192                add_action( 'fc_plugin_module_to_load', array( $this, 'wai_plugin_module_to_load' ) );
    92 
    9393                add_action( 'wpgmp_form_header_html', [ $this, 'wai_add_custom_loader' ] );
    94 
    9594                add_action( 'admin_init', [ $this, 'aicontent_export_data' ] );
    9695                add_action( 'admin_init', [ $this, 'wai_sample_csv_download' ] );
    9796
    9897            }
    99             // don't
     98
     99            // Register endpoint for REST
    100100            add_action(
    101101                'rest_api_init',
     
    114114                }
    115115            );
    116             // don't
     116
    117117            add_action( 'enqueue_block_editor_assets', array( $this, 'aicontent_block_assets' ) );
    118118            add_action( 'plugins_loaded', array( $this, 'wai_load_plugin_languages' ) );
    119 
    120119            add_shortcode( 'text_prompter', array($this,'wai_prompt_shortcode') );
    121120
     
    126125        }
    127126
    128         //dont
     127        //Shortcode handler function
    129128        function wai_prompt_shortcode($atts,$content) {
     129
    130130            $defaults = array(
    131131              'model' => 'text-davinci-002',
     
    138138            $args = shortcode_atts($defaults, $atts);
    139139         
    140             // Construct the request data
    141             $data = array(
    142               'model' => $args['model'],
    143               'prompt' => $content,
    144               'temperature' => $args['temperature'],
    145               'max_tokens' => $args['max_tokens'],
    146               'transist' => $args['transist'],
    147             );
     140             // Sanitize the attributes
     141             $args['model'] = sanitize_text_field($args['model']); // Sanitize text input
     142             $args['temperature'] = floatval($args['temperature']); // Ensure temperature is a float
     143             $args['max_tokens'] = intval($args['max_tokens']); // Ensure max_tokens is an integer
     144             $args['transist'] = intval($args['transist']); // Ensure transist is an integer
     145             $args['attributes'] = sanitize_text_field($args['attributes']); // Sanitize additional attributes
     146         
     147             // Sanitize and process the content
     148             $content = wp_kses_post($content); // Allow basic HTML in the content
     149         
     150             // Construct the request data
     151             $data = array(
     152                 'model' => $args['model'],
     153                 'prompt' => $content,
     154                 'temperature' => $args['temperature'],
     155                 'max_tokens' => $args['max_tokens'],
     156                 'transist' => $args['transist'],
     157             );
    148158         
    149159            // Check if there is an existing cache for this prompt
     
    171181            $attributes = $args['attributes'];
    172182         
    173             // Return the result with any specified attributes
    174             return '<div ' . $attributes . '>' . $cache_value . '</div>';
     183            // Return the result with any specified attributes also with Escaped HTML
     184            return '<div ' . esc_attr( $attributes ) . '>' . wp_kses_post( $cache_value ) . '</div>';
     185           
    175186          }
    176187
     
    501512
    502513            $this->wai_define( 'WAI_SLUG', 'wai_view_overview' );
    503             $this->wai_define( 'WAI_VERSION', '1.0.1' );
     514            $this->wai_define( 'WAI_VERSION', '1.0.8' );
    504515            $this->wai_define( 'WAI_TEXT_DOMAIN', 'text-prompter' );
    505516            $this->wai_define( 'WAI_TBL_PROMPTS', 'wai_prompts' );
Note: See TracChangeset for help on using the changeset viewer.