Plugin Directory

Changeset 2967076


Ignore:
Timestamp:
09/14/2023 12:49:17 PM (3 years ago)
Author:
integrationdevpaytm
Message:

Security Updates

Location:
paytm-donation/trunk
Files:
9 added
2 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • paytm-donation/trunk/includes/PaytmConstantsDonation.php

    r2947646 r2967076  
    1515    CONST APPEND_TIMESTAMP                      = true;
    1616    CONST X_REQUEST_ID                          = "PLUGIN_WORDPRESS_";
    17     CONST PLUGIN_VERSION_FOLDER                 = "222";
     17    CONST PLUGIN_VERSION_FOLDER                 = "223";
    1818
    1919    CONST MAX_RETRY_COUNT                       = 3;
     
    2121    CONST TIMEOUT                               = 10;
    2222
    23     CONST LAST_UPDATED                          = "20230804";
    24     CONST PLUGIN_VERSION                        = "2.2.2";
     23    CONST LAST_UPDATED                          = "20230912";
     24    CONST PLUGIN_VERSION                        = "2.2.3";
    2525    CONST PLUGIN_DOC_URL                        = "https://business.paytm.com/docs/wordpress/";
    2626
  • paytm-donation/trunk/includes/PaytmHelper.php

    r2939944 r2967076  
    9696                    'headers' => array("Content-Type"=> "application/json"),
    9797                    'body' => json_encode($requestParamList, JSON_UNESCAPED_SLASHES),
     98                    'sslverify'=>false
    9899                ));
    99100
  • paytm-donation/trunk/paytm-donation-listings.php

    r2947646 r2967076  
    237237
    238238                          <th><?php echo $row['date'] ?></th>
    239                           <td><button class="btnPrimary" onclick="displayFullDetails(<?php echo $row->id;?>)" id="myBtn">Full Details</button></td>
     239                          <td><button class="btnPrimary" onclick="displayFullDetails(<?php echo $row['id'];?>)" id="myBtn">Full Details</button></td>
    240240                          </tr>
    241241                    <?php } } else { ?>
  • paytm-donation/trunk/paytm-donation.php

    r2947646 r2967076  
    620620
    621621        global $wpdb;
    622 
    623         $serializedata = (json_encode($serializedata));
    624         $decode = json_decode($serializedata);
    625             unset($decode[count($decode)-1]);//removing action =  paytm_donation_request which is last element
    626         $serializedata_final = json_encode($decode);
     622        $serializedata_final = json_encode($serializedata);
     623        $data_array = json_decode($serializedata_final, true);
     624        $keys_to_remove = ["hide_form_field_for_nonce", "_wp_http_referer","action"];
     625       
     626        foreach ($data_array as $key => $item) {
     627            if (in_array($item['name'], $keys_to_remove)) {
     628                unset($data_array[$key]);
     629            }
     630        }
     631
     632        $data_array = array_values($data_array);
     633        $serializedata_final = json_encode($data_array);
    627634
    628635        $table_name_custom = $wpdb->prefix . "paytm_donation_user_data";
     
    717724                    /* save paytm response in db */
    718725                    if(PaytmConstantsDonation::SAVE_PAYTM_RESPONSE && !empty($_POST['STATUS'])){
    719                         $order_data_id = saveTxnResponse1(
    720                                             sanitize_text_field($_POST),
    721                                             PaytmHelperDonation::getOrderId(sanitize_text_field($_POST['ORDERID'])));
     726                        //$sanitized_post = array_map('sanitize_text_field', $_POST);
     727                        foreach ($_POST as $key => $value) {
     728                            $_POST[$key] = sanitize_text_field($value);
     729                        }   
     730                        $sanitized_post = $_POST;
     731                        $order_data_id = saveTxnResponse1($sanitized_post, PaytmHelperDonation::getOrderId(sanitize_text_field($_POST['ORDERID'])));
    722732                    }
    723733                    /* save paytm response in db */
     
    739749                /* number of retries untill cURL gets success */
    740750                if(!isset($responseParamList['STATUS'])){
    741                     $responseParamList = sanitize_text_field($_POST);
     751                    foreach ($_POST as $key => $value) {
     752                        $_POST[$key] = sanitize_text_field($value);
     753                    }                   
     754                    $responseParamList = $_POST;
    742755                }
    743756
     
    888901    * save response in db
    889902    */
    890     function saveTxnResponse1($data  = array(),$order_id, $id = false){
     903    function saveTxnResponse1($data  = array(),$order_id="", $id = false){
    891904        global $wpdb;
    892905        if(empty($data['STATUS'])) return false;
     
    911924    add_action('wp_ajax_nopriv_initiate_paytmCustomFieldSave','initiate_paytmCustomFieldSave');
    912925
    913     function initiate_paytmCustomFieldSave(){
    914         if (isset($_GET['nonce'])){
    915             if (  !wp_verify_nonce( $_GET['nonce'], 'hide_form_field_for_admin_nonce' ) ){
    916                  $error = array(
    917                 "error"   => true,
    918                 "message" => "Sorry, your request was not verified."
    919             );
    920             echo json_encode( $error );
    921             wp_die();
    922             }
    923         }
    924  
    925         //echo json_encode($_POST);wp_die();
    926         update_option('paytm_user_field', json_encode($_POST));
    927         echo json_encode(array('success'=> true));
    928         wp_die();
    929     }   
     926function initiate_paytmCustomFieldSave() {
     927    if (isset($_GET['nonce']) && current_user_can('manage_options')) {
     928        $nonce = sanitize_text_field($_GET['nonce']);
     929        if (wp_verify_nonce($nonce, 'hide_form_field_for_admin_nonce')) {
     930
     931            update_option('paytm_user_field', json_encode($_POST));
     932            echo json_encode(array('success' => true));
     933            wp_die();
     934        } else {
     935            $error = array(
     936                "error"   => true,
     937                "message" => "Sorry, your request was not verified."
     938            );
     939            echo json_encode($error);
     940            wp_die();
     941        }
     942    } else {
     943        $error = array(
     944            "error"   => true,
     945            "message" => "Unauthorized access or nonce value is missing."
     946        );
     947        echo json_encode($error);
     948        wp_die();
     949    }
     950}
     951
     952
    930953
    931954    add_action('wp_ajax_refresh_Paytmhistory','refresh_Paytmhistory');
  • paytm-donation/trunk/readme.txt

    r2947646 r2967076  
    55Requires at least: 4.9
    66Tested up to: 6.2.2
    7 Stable tag: 2.2.2
     7Stable tag: 2.2.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2828
    2929== Changelog ==
     30
     31= 2.2.3 =
     32* Security Fixes
    3033
    3134= 2.2.2 =
Note: See TracChangeset for help on using the changeset viewer.