Plugin Directory

Changeset 3837531


Ignore:
Timestamp:
12/01/2026 12:01:04 PM (less than one hour ago)
Author:
paytikocashier
Message:

Release version 1.4.11

Location:
paytiko
Files:
1 deleted
8 edited
39 copied

Legend:

Unmodified
Added
Removed
  • paytiko/tags/1.4.11/changelog.txt

    r3694761 r3837531  
    130130* Security: restricted direct access to the webhook log files and redacted API credentials from debug logs
    131131* Security: hardened MIT subscription webhook signature verification
     132
     1332026-10-26 - version 1.4.11
     134* Fixed webhook/payout/refund callbacks being rejected with a 403 when the store is proxied through Cloudflare, by resolving the real Paytiko IP from CF-Connecting-IP instead of trusting spoofable X-Forwarded-For/Client-IP headers
     135* Corrected the declared minimum PHP version in readme.txt to 7.4, matching what the plugin actually requires
  • paytiko/tags/1.4.11/constants/config.php

    r3694761 r3837531  
    77define('SANDBOX_WHR_URL', $sandboxWhrUrl ?: 'https://uat-whr.paytiko.com');
    88
    9 const PLUGIN_VERSION        = '1.4.10';
     9const PLUGIN_VERSION        = '1.4.11';
    1010const PROD_BASE_URL         = 'https://core.paytiko.com';
    1111const PROD_WHR_URL         = 'https://whr.paytiko.com';
  • paytiko/tags/1.4.11/includes/PaytikoGateway.php

    r3694761 r3837531  
    935935
    936936        private function get_client_ip() {
    937                 $ip = '';
    938                 if (isset($_SERVER['HTTP_CLIENT_IP'])) {
    939                         $ip = $_SERVER['HTTP_CLIENT_IP'];
    940                 } elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
    941                         $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
    942                 } elseif (isset($_SERVER['REMOTE_ADDR'])) {
    943                         $ip = $_SERVER['REMOTE_ADDR'];
    944                 }
    945                 return $ip;
     937                return paytiko_get_client_ip();
    946938        }
    947939
  • paytiko/tags/1.4.11/includes/PaytikoPayouts.php

    r3694761 r3837531  
    444444
    445445    private function get_client_ip() {
    446         $ip = '';
    447         if (isset($_SERVER['HTTP_CLIENT_IP'])) {
    448             $ip = $_SERVER['HTTP_CLIENT_IP'];
    449         } elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
    450             $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
    451         } elseif (isset($_SERVER['REMOTE_ADDR'])) {
    452             $ip = $_SERVER['REMOTE_ADDR'];
    453         }
    454         return $ip;
     446        return paytiko_get_client_ip();
    455447    }
    456448
  • paytiko/tags/1.4.11/includes/common.php

    r3694761 r3837531  
    1212                        error_log($log);
    1313                }
     14        }
     15}
     16
     17if (!function_exists('paytiko_cloudflare_ip_ranges')) {
     18        function paytiko_cloudflare_ip_ranges() {
     19                return [
     20                        '173.245.48.0/20',
     21                        '103.21.244.0/22',
     22                        '103.22.200.0/22',
     23                        '103.31.4.0/22',
     24                        '141.101.64.0/18',
     25                        '108.162.192.0/18',
     26                        '190.93.240.0/20',
     27                        '188.114.96.0/20',
     28                        '197.234.240.0/22',
     29                        '198.41.128.0/17',
     30                        '162.158.0.0/15',
     31                        '104.16.0.0/13',
     32                        '104.24.0.0/14',
     33                        '172.64.0.0/13',
     34                        '131.0.72.0/22',
     35                        '2400:cb00::/32',
     36                        '2606:4700::/32',
     37                        '2803:f800::/32',
     38                        '2405:b500::/32',
     39                        '2405:8100::/32',
     40                        '2a06:98c0::/29',
     41                        '2c0f:f248::/32',
     42                ];
     43        }
     44}
     45
     46if (!function_exists('paytiko_ip_in_cidr')) {
     47        function paytiko_ip_in_cidr( $ip, $cidr ) {
     48                if ( strpos( $cidr, '/' ) === false ) {
     49                        return $ip === $cidr;
     50                }
     51                list( $subnet, $mask_bits ) = explode( '/', $cidr );
     52                $ip_bin = @inet_pton( $ip );
     53                $subnet_bin = @inet_pton( $subnet );
     54                if ( $ip_bin === false || $subnet_bin === false || strlen( $ip_bin ) !== strlen( $subnet_bin ) ) {
     55                        return false;
     56                }
     57                $mask_bits = (int) $mask_bits;
     58                $full_bytes = (int) ( $mask_bits / 8 );
     59                $remaining_bits = $mask_bits % 8;
     60
     61                if ( $full_bytes > 0 && substr( $ip_bin, 0, $full_bytes ) !== substr( $subnet_bin, 0, $full_bytes ) ) {
     62                        return false;
     63                }
     64                if ( $remaining_bits === 0 ) {
     65                        return true;
     66                }
     67                $mask_byte = chr( ( 0xFF << ( 8 - $remaining_bits ) ) & 0xFF );
     68                return ( substr( $ip_bin, $full_bytes, 1 ) & $mask_byte ) === ( substr( $subnet_bin, $full_bytes, 1 ) & $mask_byte );
     69        }
     70}
     71
     72if (!function_exists('paytiko_is_cloudflare_ip')) {
     73        function paytiko_is_cloudflare_ip( $ip ) {
     74                if ( empty( $ip ) ) {
     75                        return false;
     76                }
     77                foreach ( paytiko_cloudflare_ip_ranges() as $range ) {
     78                        if ( paytiko_ip_in_cidr( $ip, $range ) ) {
     79                                return true;
     80                        }
     81                }
     82                return false;
     83        }
     84}
     85
     86if (!function_exists('paytiko_strip_port')) {
     87        function paytiko_strip_port( $ip ) {
     88                if ( preg_match( '/^(\d{1,3}\.){3}\d{1,3}:\d+$/', $ip ) ) {
     89                        return substr( $ip, 0, strrpos( $ip, ':' ) );
     90                }
     91                return $ip;
     92        }
     93}
     94
     95if (!function_exists('paytiko_public_ip_or_null')) {
     96        function paytiko_public_ip_or_null( $ip ) {
     97                $ip = paytiko_strip_port( trim( (string) $ip ) );
     98                $valid = filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE );
     99                return $valid !== false ? $ip : null;
     100        }
     101}
     102
     103if (!function_exists('paytiko_get_client_ip')) {
     104        function paytiko_get_client_ip() {
     105                $remote_addr = isset( $_SERVER['REMOTE_ADDR'] ) ? paytiko_strip_port( trim( $_SERVER['REMOTE_ADDR'] ) ) : '';
     106
     107                if ( ! paytiko_is_cloudflare_ip( $remote_addr ) && paytiko_public_ip_or_null( $remote_addr ) ) {
     108                        return $remote_addr;
     109                }
     110
     111                if ( ! empty( $_SERVER['HTTP_CF_CONNECTING_IP'] ) ) {
     112                        $cf_ip = paytiko_public_ip_or_null( $_SERVER['HTTP_CF_CONNECTING_IP'] );
     113                        if ( $cf_ip ) {
     114                                return $cf_ip;
     115                        }
     116                }
     117
     118                if ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
     119                        foreach ( explode( ',', $_SERVER['HTTP_X_FORWARDED_FOR'] ) as $hop ) {
     120                                $public_ip = paytiko_public_ip_or_null( $hop );
     121                                if ( $public_ip ) {
     122                                        return $public_ip;
     123                                }
     124                        }
     125                }
     126
     127                return filter_var( $remote_addr, FILTER_VALIDATE_IP ) ? $remote_addr : '';
    14128        }
    15129}
  • paytiko/tags/1.4.11/includes/paytiko-subscription-api.php

    r3694761 r3837531  
    2828
    2929    public function get_client_ip() {
    30         $ip = '';
    31         if (isset($_SERVER['HTTP_CLIENT_IP'])) {
    32             $ip = $_SERVER['HTTP_CLIENT_IP'];
    33         } elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
    34             $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
    35         } elseif (isset($_SERVER['REMOTE_ADDR'])) {
    36             $ip = $_SERVER['REMOTE_ADDR'];
    37         }
    38         return $ip;
     30        return paytiko_get_client_ip();
    3931    }
    4032
  • paytiko/tags/1.4.11/readme.txt

    r3694761 r3837531  
    33Tags: paytiko, cashier, payments, routing, bank, creditcard
    44Requires at least: 5.5
    5 Tested up to: 6.8
    6 Stable tag: 1.4.10
    7 Requires PHP: 5.6
     5Tested up to: 7.1
     6Stable tag: 1.4.11
     7Requires PHP: 7.4
    88License: GPLv2 or later
    99License URI: https://www.paytiko.com/legal-documents
  • paytiko/tags/1.4.11/wc-paytiko.php

    r3694761 r3837531  
    55 * Requires Plugins: woocommerce
    66 * Requires at least: 6.4
    7  * Tested up to: 6.7
     7 * Tested up to: 7.1
    88 * Description: Easily accept payments on your Woocommerce store using this plugin
    9  * Version: 1.4.10
     9 * Version: 1.4.11
    1010 */
    1111
    … …  
    1313
    1414define('PAYTIKO_PLUGIN_FILE', trailingslashit(WP_PLUGIN_DIR) . 'paytiko/' . basename(__FILE__));
    15 define('PAYTIKO_PLUGIN_VERSION', '1.4.10');
     15define('PAYTIKO_PLUGIN_VERSION', '1.4.11');
    1616
    1717if (in_array(
  • paytiko/trunk/changelog.txt

    r3694761 r3837531  
    130130* Security: restricted direct access to the webhook log files and redacted API credentials from debug logs
    131131* Security: hardened MIT subscription webhook signature verification
     132
     1332026-10-26 - version 1.4.11
     134* Fixed webhook/payout/refund callbacks being rejected with a 403 when the store is proxied through Cloudflare, by resolving the real Paytiko IP from CF-Connecting-IP instead of trusting spoofable X-Forwarded-For/Client-IP headers
     135* Corrected the declared minimum PHP version in readme.txt to 7.4, matching what the plugin actually requires
  • paytiko/trunk/constants/config.php

    r3694761 r3837531  
    77define('SANDBOX_WHR_URL', $sandboxWhrUrl ?: 'https://uat-whr.paytiko.com');
    88
    9 const PLUGIN_VERSION        = '1.4.10';
     9const PLUGIN_VERSION        = '1.4.11';
    1010const PROD_BASE_URL         = 'https://core.paytiko.com';
    1111const PROD_WHR_URL         = 'https://whr.paytiko.com';
  • paytiko/trunk/includes/PaytikoGateway.php

    r3694761 r3837531  
    935935
    936936        private function get_client_ip() {
    937                 $ip = '';
    938                 if (isset($_SERVER['HTTP_CLIENT_IP'])) {
    939                         $ip = $_SERVER['HTTP_CLIENT_IP'];
    940                 } elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
    941                         $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
    942                 } elseif (isset($_SERVER['REMOTE_ADDR'])) {
    943                         $ip = $_SERVER['REMOTE_ADDR'];
    944                 }
    945                 return $ip;
     937                return paytiko_get_client_ip();
    946938        }
    947939
  • paytiko/trunk/includes/PaytikoPayouts.php

    r3694761 r3837531  
    444444
    445445    private function get_client_ip() {
    446         $ip = '';
    447         if (isset($_SERVER['HTTP_CLIENT_IP'])) {
    448             $ip = $_SERVER['HTTP_CLIENT_IP'];
    449         } elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
    450             $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
    451         } elseif (isset($_SERVER['REMOTE_ADDR'])) {
    452             $ip = $_SERVER['REMOTE_ADDR'];
    453         }
    454         return $ip;
     446        return paytiko_get_client_ip();
    455447    }
    456448
  • paytiko/trunk/includes/common.php

    r3694761 r3837531  
    1212                        error_log($log);
    1313                }
     14        }
     15}
     16
     17if (!function_exists('paytiko_cloudflare_ip_ranges')) {
     18        function paytiko_cloudflare_ip_ranges() {
     19                return [
     20                        '173.245.48.0/20',
     21                        '103.21.244.0/22',
     22                        '103.22.200.0/22',
     23                        '103.31.4.0/22',
     24                        '141.101.64.0/18',
     25                        '108.162.192.0/18',
     26                        '190.93.240.0/20',
     27                        '188.114.96.0/20',
     28                        '197.234.240.0/22',
     29                        '198.41.128.0/17',
     30                        '162.158.0.0/15',
     31                        '104.16.0.0/13',
     32                        '104.24.0.0/14',
     33                        '172.64.0.0/13',
     34                        '131.0.72.0/22',
     35                        '2400:cb00::/32',
     36                        '2606:4700::/32',
     37                        '2803:f800::/32',
     38                        '2405:b500::/32',
     39                        '2405:8100::/32',
     40                        '2a06:98c0::/29',
     41                        '2c0f:f248::/32',
     42                ];
     43        }
     44}
     45
     46if (!function_exists('paytiko_ip_in_cidr')) {
     47        function paytiko_ip_in_cidr( $ip, $cidr ) {
     48                if ( strpos( $cidr, '/' ) === false ) {
     49                        return $ip === $cidr;
     50                }
     51                list( $subnet, $mask_bits ) = explode( '/', $cidr );
     52                $ip_bin = @inet_pton( $ip );
     53                $subnet_bin = @inet_pton( $subnet );
     54                if ( $ip_bin === false || $subnet_bin === false || strlen( $ip_bin ) !== strlen( $subnet_bin ) ) {
     55                        return false;
     56                }
     57                $mask_bits = (int) $mask_bits;
     58                $full_bytes = (int) ( $mask_bits / 8 );
     59                $remaining_bits = $mask_bits % 8;
     60
     61                if ( $full_bytes > 0 && substr( $ip_bin, 0, $full_bytes ) !== substr( $subnet_bin, 0, $full_bytes ) ) {
     62                        return false;
     63                }
     64                if ( $remaining_bits === 0 ) {
     65                        return true;
     66                }
     67                $mask_byte = chr( ( 0xFF << ( 8 - $remaining_bits ) ) & 0xFF );
     68                return ( substr( $ip_bin, $full_bytes, 1 ) & $mask_byte ) === ( substr( $subnet_bin, $full_bytes, 1 ) & $mask_byte );
     69        }
     70}
     71
     72if (!function_exists('paytiko_is_cloudflare_ip')) {
     73        function paytiko_is_cloudflare_ip( $ip ) {
     74                if ( empty( $ip ) ) {
     75                        return false;
     76                }
     77                foreach ( paytiko_cloudflare_ip_ranges() as $range ) {
     78                        if ( paytiko_ip_in_cidr( $ip, $range ) ) {
     79                                return true;
     80                        }
     81                }
     82                return false;
     83        }
     84}
     85
     86if (!function_exists('paytiko_strip_port')) {
     87        function paytiko_strip_port( $ip ) {
     88                if ( preg_match( '/^(\d{1,3}\.){3}\d{1,3}:\d+$/', $ip ) ) {
     89                        return substr( $ip, 0, strrpos( $ip, ':' ) );
     90                }
     91                return $ip;
     92        }
     93}
     94
     95if (!function_exists('paytiko_public_ip_or_null')) {
     96        function paytiko_public_ip_or_null( $ip ) {
     97                $ip = paytiko_strip_port( trim( (string) $ip ) );
     98                $valid = filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE );
     99                return $valid !== false ? $ip : null;
     100        }
     101}
     102
     103if (!function_exists('paytiko_get_client_ip')) {
     104        function paytiko_get_client_ip() {
     105                $remote_addr = isset( $_SERVER['REMOTE_ADDR'] ) ? paytiko_strip_port( trim( $_SERVER['REMOTE_ADDR'] ) ) : '';
     106
     107                if ( ! paytiko_is_cloudflare_ip( $remote_addr ) && paytiko_public_ip_or_null( $remote_addr ) ) {
     108                        return $remote_addr;
     109                }
     110
     111                if ( ! empty( $_SERVER['HTTP_CF_CONNECTING_IP'] ) ) {
     112                        $cf_ip = paytiko_public_ip_or_null( $_SERVER['HTTP_CF_CONNECTING_IP'] );
     113                        if ( $cf_ip ) {
     114                                return $cf_ip;
     115                        }
     116                }
     117
     118                if ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
     119                        foreach ( explode( ',', $_SERVER['HTTP_X_FORWARDED_FOR'] ) as $hop ) {
     120                                $public_ip = paytiko_public_ip_or_null( $hop );
     121                                if ( $public_ip ) {
     122                                        return $public_ip;
     123                                }
     124                        }
     125                }
     126
     127                return filter_var( $remote_addr, FILTER_VALIDATE_IP ) ? $remote_addr : '';
    14128        }
    15129}
  • paytiko/trunk/includes/paytiko-subscription-api.php

    r3694761 r3837531  
    2828
    2929    public function get_client_ip() {
    30         $ip = '';
    31         if (isset($_SERVER['HTTP_CLIENT_IP'])) {
    32             $ip = $_SERVER['HTTP_CLIENT_IP'];
    33         } elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
    34             $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
    35         } elseif (isset($_SERVER['REMOTE_ADDR'])) {
    36             $ip = $_SERVER['REMOTE_ADDR'];
    37         }
    38         return $ip;
     30        return paytiko_get_client_ip();
    3931    }
    4032
  • paytiko/trunk/readme.txt

    r3694761 r3837531  
    33Tags: paytiko, cashier, payments, routing, bank, creditcard
    44Requires at least: 5.5
    5 Tested up to: 6.8
    6 Stable tag: 1.4.10
    7 Requires PHP: 5.6
     5Tested up to: 7.1
     6Stable tag: 1.4.11
     7Requires PHP: 7.4
    88License: GPLv2 or later
    99License URI: https://www.paytiko.com/legal-documents
  • paytiko/trunk/wc-paytiko.php

    r3694761 r3837531  
    55 * Requires Plugins: woocommerce
    66 * Requires at least: 6.4
    7  * Tested up to: 6.7
     7 * Tested up to: 7.1
    88 * Description: Easily accept payments on your Woocommerce store using this plugin
    9  * Version: 1.4.10
     9 * Version: 1.4.11
    1010 */
    1111
    … …  
    1313
    1414define('PAYTIKO_PLUGIN_FILE', trailingslashit(WP_PLUGIN_DIR) . 'paytiko/' . basename(__FILE__));
    15 define('PAYTIKO_PLUGIN_VERSION', '1.4.10');
     15define('PAYTIKO_PLUGIN_VERSION', '1.4.11');
    1616
    1717if (in_array(
Note: See TracChangeset for help on using the changeset viewer.