Plugin Directory

Changeset 2837062


Ignore:
Timestamp:
12/21/2022 05:55:03 AM (3 years ago)
Author:
biztechc
Message:

plugin vulnerable resolve with data sanitization

Location:
show-all-comments-in-one-page/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • show-all-comments-in-one-page/trunk/bt-comments.php

    r2836658 r2837062  
    551551function sac_post_type_call_callback() {
    552552
    553     $post_type = $_REQUEST['post_type'];
     553    $post_type = isset( $_REQUEST['post_type'] ) ? sanitize_text_field( $_REQUEST['post_type'] ) : '';
     554    $post_category = isset( $_REQUEST['post_category'] ) ? intval( sanitize_text_field( $_REQUEST['post_category'] ) ) : '';
     555    $post_id = isset( $_REQUEST['post_id'] ) ? intval( sanitize_text_field( $_REQUEST['post_id'] ) ) : '';
    554556
    555557    $exclude_post = get_option('bt_exclude_post');
     
    567569    );
    568570
    569     if (isset( $_REQUEST['post_category'] ) && $_REQUEST['post_category'] != null && $_REQUEST['post_type'] == 'post') {
    570 
    571         $args['category'] = $_REQUEST['post_category'];
     571    if ( $post_category != '' && $post_type == 'post') {
     572
     573        $args['category'] = $post_category;
    572574    }
    573575
     
    583585        foreach ($posts as $post) {
    584586
    585             if ( isset($_REQUEST['post_id']) && $post->ID == $_REQUEST['post_id']) {
     587            if ( $post->ID == $post_id ) {
    586588                ?>
    587589                <option value="<?php echo $post->ID; ?>" selected><?php echo $post->post_title; ?></option>
     
    613615
    614616    if (isset($_REQUEST['sac_posts'])) {
    615         $sac_posts = $_REQUEST['sac_posts'];
     617        $sac_posts = intval( sanitize_text_field($_REQUEST['sac_posts']) );
    616618        $sac_localize_data['sac_posts'] = $sac_posts;
    617619    }
    618620    $sac_category = '';
    619621    if (isset($_REQUEST['sac_post_types']) && $_REQUEST['sac_post_types'] == 'post') {
    620         $sac_category = isset($_REQUEST['sac_category']) ? $_REQUEST['sac_category'] : '';
     622        $sac_category = isset($_REQUEST['sac_category']) ? intval( sanitize_text_field($_REQUEST['sac_category'])) : '';
    621623        $sac_localize_data['sac_category'] = $sac_category;
    622624    }
  • show-all-comments-in-one-page/trunk/js/sac-script.js

    r2836658 r2837062  
    1111    jQuery('.sac-post-types').on('change', function () {
    1212        var sac_post_type = jQuery(this).val();
     13        var sac_post_category = jQuery('.sac-category').val();
    1314
    1415        if (sac_post_type) {
     
    2122            }
    2223
    23             if (typeof sac_localize_data.sac_category != 'undefined') {
    24                 sac_post_type_data.post_category = sac_localize_data.sac_category;
     24            if (typeof sac_post_category != 'undefined') {
     25                sac_post_type_data.post_category = sac_post_category;
    2526            }
    2627            jQuery('.sac-posts option').remove();
Note: See TracChangeset for help on using the changeset viewer.