Plugin Directory


Ignore:
Timestamp:
10/05/2026 08:05:53 AM (13 days ago)
Author:
retainful
Message:

v1.0.11 release

File:
1 edited

Legend:

Unmodified
Added
Removed
  • retainful/trunk/App/Controllers/Webhook.php

    r3705113 r3728354  
    1515use RTFL\App\Helpers\Platform;
    1616use RTFL\App\Helpers\Product;
     17use RTFL\App\Helpers\RateLimiter;
    1718use RTFL\App\Helpers\Settings;
    1819use RTFL\App\Helpers\Util;
    … …  
    516517                }
    517518
    518                 // 2. Input validation
     519                if ( RateLimiter::isEnabled() && ! RateLimiter::checkLimit( 'trackProductViewed' )['allowed'] ) {
     520                        wp_send_json_error( [ 'message' => __( 'Rate limit exceeded', 'retainful' ) ], 429 );
     521                }
     522
     523                // 2. Input validation. The email comes from the server-side identity (logged-in user / session),
     524                // never from the request, so a visitor cannot trigger product-view events for someone else's email.
    519525                $product_id = absint( Input::get( 'product_id', 0 ) );
    520                 $email      = sanitize_email( Input::get( 'email', '' ) );
     526                $email      = \RTFL\App\Controllers\Store\Common::getIdentifiedCustomerEmail();
    521527
    522528                if ( ! $product_id || ! is_email( $email ) ) {
    … …  
    838844                                ], 403 );
    839845                        }
     846                        if ( RateLimiter::isEnabled() && ! RateLimiter::checkLimit( 'trackUserData' )['allowed'] ) {
     847                                wp_send_json_error( [
     848                                        'message' => __( 'Rate limit exceeded', 'retainful' )
     849                                ], 429 );
     850                        }
    840851                }
    841852                if ( ! function_exists( 'wc_get_webhook' ) || ! function_exists( 'as_next_scheduled_action' ) || ! function_exists( 'as_schedule_single_action' ) ) {
Note: See TracChangeset for help on using the changeset viewer.