Plugin Directory

Changeset 3442404


Ignore:
Timestamp:
01/19/2026 10:16:28 AM (7 weeks ago)
Author:
wedevs
Message:

Tagging version 2.0.8

Location:
wemail
Files:
16 edited
1 copied

Legend:

Unmodified
Added
Removed
  • wemail/tags/2.0.8/includes/Rest/Csv.php

    r3359591 r3442404  
    66use WP_REST_Response;
    77use WP_REST_Server;
    8 use WP_User_Query;
    98
    109class Csv {
     
    3130                array(
    3231                    'methods' => WP_REST_Server::READABLE,
    33                     'permission_callback' => array( $this, 'permission' ),
     32                    'permission_callback' => array( $this, 'can_csv_upload' ),
    3433                    'callback' => array( $this, 'csv_file_info' ),
    3534                ),
     
    4948                array(
    5049                    'methods' => WP_REST_Server::READABLE,
    51                     'permission_callback' => array( $this, 'permission' ),
     50                    'permission_callback' => array( $this, 'can_meta_fields' ),
    5251                    'callback' => array( $this, 'meta_fields' ),
    5352                ),
     
    6766                array(
    6867                    'methods' => WP_REST_Server::READABLE,
    69                     'permission_callback' => array( $this, 'permission' ),
     68                    'permission_callback' => array( $this, 'can_get_subscribers' ),
    7069                    'callback' => array( $this, 'subscribers' ),
    7170                ),
    7271            )
    7372        );
    74     }
    75 
    76     public function permission( $request ) {
    77         $api_key = $request->get_header( 'X-WeMail-Key' );
    78 
    79         $user_email = $request->get_header( 'x-wemail-user' );
    80 
    81         if ( ! empty( $user_email ) ) {
    82             $user = get_user_by( 'email', $user_email );
    83 
    84             if ( $user ) {
    85                 wp_set_current_user( $user->ID );
    86                 return wemail()->user->can( 'create_subscriber' );
    87             }
    88         }
    89 
    90         if ( ! empty( $api_key ) ) {
    91             $query = new WP_User_Query(
    92                 array(
    93                     'fields'        => 'ID',
    94                     'meta_key'      => 'wemail_api_key',
    95                     'meta_value'    => $api_key,
    96                 )
    97             );
    98 
    99             if ( $query->get_total() ) {
    100                 $results = $query->get_results();
    101                 $user_id = array_pop( $results );
    102 
    103                 wp_set_current_user( $user_id );
    104 
    105                 return wemail()->user->can( 'create_subscriber' );
    106             }
    107         }
    108 
    109         return false;
    11073    }
    11174
  • wemail/tags/2.0.8/includes/Rest/Forms.php

    r3164699 r3442404  
    122122    }
    123123
     124    /**
     125     * Permission callback for form endpoints
     126     * Requires WordPress authentication, weMail role-based capability checks, and nonce verification
     127     *
     128     * @param \WP_REST_Request $request
     129     *
     130     * @return bool
     131     */
    124132    public function permission( $request ) {
     133        // 1. Require WordPress authentication (user must be logged in)
     134        if ( ! is_user_logged_in() ) {
     135            return false;
     136        }
     137
     138        // 2. Check user has appropriate weMail role-based capabilities
     139        if ( ! function_exists( 'wemail' ) || ! method_exists( wemail(), 'user' ) ) {
     140            return false;
     141        }
     142
     143        if ( ! wemail()->user->can( 'manage_form' ) ) {
     144            return false;
     145        }
     146
     147        // 3. Require nonce verification for CSRF protection
    125148        $nonce = $request->get_header( 'X-WP-Nonce' );
    126 
    127         if ( $nonce && wp_verify_nonce( $nonce, 'wp_rest' ) ) {
    128             return true;
    129         }
    130 
    131         return false;
     149        if ( ! $nonce || ! wp_verify_nonce( $nonce, 'wp_rest' ) ) {
     150            return false;
     151        }
     152
     153        return true;
    132154    }
    133155
  • wemail/tags/2.0.8/includes/WeMail.php

    r3423372 r3442404  
    2424     * @var string
    2525     */
    26     public $version = '2.0.7';
     26    public $version = '2.0.8';
    2727
    2828    /**
  • wemail/tags/2.0.8/readme.txt

    r3423372 r3442404  
    55Requires at least: 5.6
    66Tested up to: 6.8.3
    7 Stable tag: 2.0.7
     7Stable tag: 2.0.8
    88Requires PHP: 7.4
    99License: GPLv2 or later
     
    278278
    279279== Changelog ==
     280v2.0.8 - (19th Jan, 2026) =
     281* Refactor permission callbacks for form and CSV handling
     282* Fix Wordfence security scan issues
     283
    280284v2.0.7 - (19th Dec, 2025) =
    281285* Handle API calls when the API key is missing
  • wemail/tags/2.0.8/vendor/autoload.php

    r3423372 r3442404  
    55require_once __DIR__ . '/composer/autoload_real.php';
    66
    7 return ComposerAutoloaderInit18fef7787195e2a0a9a89e28738fc125::getLoader();
     7return ComposerAutoloaderInitbc7f456b1ad6c710a056c0877d6ff1c7::getLoader();
  • wemail/tags/2.0.8/vendor/composer/autoload_real.php

    r3423372 r3442404  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInit18fef7787195e2a0a9a89e28738fc125
     5class ComposerAutoloaderInitbc7f456b1ad6c710a056c0877d6ff1c7
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInit18fef7787195e2a0a9a89e28738fc125', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInitbc7f456b1ad6c710a056c0877d6ff1c7', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
    29         spl_autoload_unregister(array('ComposerAutoloaderInit18fef7787195e2a0a9a89e28738fc125', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInitbc7f456b1ad6c710a056c0877d6ff1c7', 'loadClassLoader'));
    3030
    3131        $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
     
    3333            require __DIR__ . '/autoload_static.php';
    3434
    35             call_user_func(\Composer\Autoload\ComposerStaticInit18fef7787195e2a0a9a89e28738fc125::getInitializer($loader));
     35            call_user_func(\Composer\Autoload\ComposerStaticInitbc7f456b1ad6c710a056c0877d6ff1c7::getInitializer($loader));
    3636        } else {
    3737            $map = require __DIR__ . '/autoload_namespaces.php';
     
    5454
    5555        if ($useStaticLoader) {
    56             $includeFiles = Composer\Autoload\ComposerStaticInit18fef7787195e2a0a9a89e28738fc125::$files;
     56            $includeFiles = Composer\Autoload\ComposerStaticInitbc7f456b1ad6c710a056c0877d6ff1c7::$files;
    5757        } else {
    5858            $includeFiles = require __DIR__ . '/autoload_files.php';
    5959        }
    6060        foreach ($includeFiles as $fileIdentifier => $file) {
    61             composerRequire18fef7787195e2a0a9a89e28738fc125($fileIdentifier, $file);
     61            composerRequirebc7f456b1ad6c710a056c0877d6ff1c7($fileIdentifier, $file);
    6262        }
    6363
     
    7171 * @return void
    7272 */
    73 function composerRequire18fef7787195e2a0a9a89e28738fc125($fileIdentifier, $file)
     73function composerRequirebc7f456b1ad6c710a056c0877d6ff1c7($fileIdentifier, $file)
    7474{
    7575    if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  • wemail/tags/2.0.8/vendor/composer/autoload_static.php

    r3423372 r3442404  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInit18fef7787195e2a0a9a89e28738fc125
     7class ComposerStaticInitbc7f456b1ad6c710a056c0877d6ff1c7
    88{
    99    public static $files = array (
     
    206206    {
    207207        return \Closure::bind(function () use ($loader) {
    208             $loader->prefixLengthsPsr4 = ComposerStaticInit18fef7787195e2a0a9a89e28738fc125::$prefixLengthsPsr4;
    209             $loader->prefixDirsPsr4 = ComposerStaticInit18fef7787195e2a0a9a89e28738fc125::$prefixDirsPsr4;
    210             $loader->classMap = ComposerStaticInit18fef7787195e2a0a9a89e28738fc125::$classMap;
     208            $loader->prefixLengthsPsr4 = ComposerStaticInitbc7f456b1ad6c710a056c0877d6ff1c7::$prefixLengthsPsr4;
     209            $loader->prefixDirsPsr4 = ComposerStaticInitbc7f456b1ad6c710a056c0877d6ff1c7::$prefixDirsPsr4;
     210            $loader->classMap = ComposerStaticInitbc7f456b1ad6c710a056c0877d6ff1c7::$classMap;
    211211
    212212        }, null, ClassLoader::class);
  • wemail/tags/2.0.8/wemail.php

    r3423372 r3442404  
    77 * Author: weDevs
    88 * Author URI: https://getwemail.io/?utm_source=wp-org&utm_medium=author-uri
    9  * Version: 2.0.7
     9 * Version: 2.0.8
    1010 * License: GPL-3.0
    1111 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
  • wemail/trunk/includes/Rest/Csv.php

    r3359591 r3442404  
    66use WP_REST_Response;
    77use WP_REST_Server;
    8 use WP_User_Query;
    98
    109class Csv {
     
    3130                array(
    3231                    'methods' => WP_REST_Server::READABLE,
    33                     'permission_callback' => array( $this, 'permission' ),
     32                    'permission_callback' => array( $this, 'can_csv_upload' ),
    3433                    'callback' => array( $this, 'csv_file_info' ),
    3534                ),
     
    4948                array(
    5049                    'methods' => WP_REST_Server::READABLE,
    51                     'permission_callback' => array( $this, 'permission' ),
     50                    'permission_callback' => array( $this, 'can_meta_fields' ),
    5251                    'callback' => array( $this, 'meta_fields' ),
    5352                ),
     
    6766                array(
    6867                    'methods' => WP_REST_Server::READABLE,
    69                     'permission_callback' => array( $this, 'permission' ),
     68                    'permission_callback' => array( $this, 'can_get_subscribers' ),
    7069                    'callback' => array( $this, 'subscribers' ),
    7170                ),
    7271            )
    7372        );
    74     }
    75 
    76     public function permission( $request ) {
    77         $api_key = $request->get_header( 'X-WeMail-Key' );
    78 
    79         $user_email = $request->get_header( 'x-wemail-user' );
    80 
    81         if ( ! empty( $user_email ) ) {
    82             $user = get_user_by( 'email', $user_email );
    83 
    84             if ( $user ) {
    85                 wp_set_current_user( $user->ID );
    86                 return wemail()->user->can( 'create_subscriber' );
    87             }
    88         }
    89 
    90         if ( ! empty( $api_key ) ) {
    91             $query = new WP_User_Query(
    92                 array(
    93                     'fields'        => 'ID',
    94                     'meta_key'      => 'wemail_api_key',
    95                     'meta_value'    => $api_key,
    96                 )
    97             );
    98 
    99             if ( $query->get_total() ) {
    100                 $results = $query->get_results();
    101                 $user_id = array_pop( $results );
    102 
    103                 wp_set_current_user( $user_id );
    104 
    105                 return wemail()->user->can( 'create_subscriber' );
    106             }
    107         }
    108 
    109         return false;
    11073    }
    11174
  • wemail/trunk/includes/Rest/Forms.php

    r3164699 r3442404  
    122122    }
    123123
     124    /**
     125     * Permission callback for form endpoints
     126     * Requires WordPress authentication, weMail role-based capability checks, and nonce verification
     127     *
     128     * @param \WP_REST_Request $request
     129     *
     130     * @return bool
     131     */
    124132    public function permission( $request ) {
     133        // 1. Require WordPress authentication (user must be logged in)
     134        if ( ! is_user_logged_in() ) {
     135            return false;
     136        }
     137
     138        // 2. Check user has appropriate weMail role-based capabilities
     139        if ( ! function_exists( 'wemail' ) || ! method_exists( wemail(), 'user' ) ) {
     140            return false;
     141        }
     142
     143        if ( ! wemail()->user->can( 'manage_form' ) ) {
     144            return false;
     145        }
     146
     147        // 3. Require nonce verification for CSRF protection
    125148        $nonce = $request->get_header( 'X-WP-Nonce' );
    126 
    127         if ( $nonce && wp_verify_nonce( $nonce, 'wp_rest' ) ) {
    128             return true;
    129         }
    130 
    131         return false;
     149        if ( ! $nonce || ! wp_verify_nonce( $nonce, 'wp_rest' ) ) {
     150            return false;
     151        }
     152
     153        return true;
    132154    }
    133155
  • wemail/trunk/includes/WeMail.php

    r3423372 r3442404  
    2424     * @var string
    2525     */
    26     public $version = '2.0.7';
     26    public $version = '2.0.8';
    2727
    2828    /**
  • wemail/trunk/readme.txt

    r3423372 r3442404  
    55Requires at least: 5.6
    66Tested up to: 6.8.3
    7 Stable tag: 2.0.7
     7Stable tag: 2.0.8
    88Requires PHP: 7.4
    99License: GPLv2 or later
     
    278278
    279279== Changelog ==
     280v2.0.8 - (19th Jan, 2026) =
     281* Refactor permission callbacks for form and CSV handling
     282* Fix Wordfence security scan issues
     283
    280284v2.0.7 - (19th Dec, 2025) =
    281285* Handle API calls when the API key is missing
  • wemail/trunk/vendor/autoload.php

    r3423372 r3442404  
    55require_once __DIR__ . '/composer/autoload_real.php';
    66
    7 return ComposerAutoloaderInit18fef7787195e2a0a9a89e28738fc125::getLoader();
     7return ComposerAutoloaderInitbc7f456b1ad6c710a056c0877d6ff1c7::getLoader();
  • wemail/trunk/vendor/composer/autoload_real.php

    r3423372 r3442404  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInit18fef7787195e2a0a9a89e28738fc125
     5class ComposerAutoloaderInitbc7f456b1ad6c710a056c0877d6ff1c7
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInit18fef7787195e2a0a9a89e28738fc125', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInitbc7f456b1ad6c710a056c0877d6ff1c7', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
    29         spl_autoload_unregister(array('ComposerAutoloaderInit18fef7787195e2a0a9a89e28738fc125', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInitbc7f456b1ad6c710a056c0877d6ff1c7', 'loadClassLoader'));
    3030
    3131        $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
     
    3333            require __DIR__ . '/autoload_static.php';
    3434
    35             call_user_func(\Composer\Autoload\ComposerStaticInit18fef7787195e2a0a9a89e28738fc125::getInitializer($loader));
     35            call_user_func(\Composer\Autoload\ComposerStaticInitbc7f456b1ad6c710a056c0877d6ff1c7::getInitializer($loader));
    3636        } else {
    3737            $map = require __DIR__ . '/autoload_namespaces.php';
     
    5454
    5555        if ($useStaticLoader) {
    56             $includeFiles = Composer\Autoload\ComposerStaticInit18fef7787195e2a0a9a89e28738fc125::$files;
     56            $includeFiles = Composer\Autoload\ComposerStaticInitbc7f456b1ad6c710a056c0877d6ff1c7::$files;
    5757        } else {
    5858            $includeFiles = require __DIR__ . '/autoload_files.php';
    5959        }
    6060        foreach ($includeFiles as $fileIdentifier => $file) {
    61             composerRequire18fef7787195e2a0a9a89e28738fc125($fileIdentifier, $file);
     61            composerRequirebc7f456b1ad6c710a056c0877d6ff1c7($fileIdentifier, $file);
    6262        }
    6363
     
    7171 * @return void
    7272 */
    73 function composerRequire18fef7787195e2a0a9a89e28738fc125($fileIdentifier, $file)
     73function composerRequirebc7f456b1ad6c710a056c0877d6ff1c7($fileIdentifier, $file)
    7474{
    7575    if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  • wemail/trunk/vendor/composer/autoload_static.php

    r3423372 r3442404  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInit18fef7787195e2a0a9a89e28738fc125
     7class ComposerStaticInitbc7f456b1ad6c710a056c0877d6ff1c7
    88{
    99    public static $files = array (
     
    206206    {
    207207        return \Closure::bind(function () use ($loader) {
    208             $loader->prefixLengthsPsr4 = ComposerStaticInit18fef7787195e2a0a9a89e28738fc125::$prefixLengthsPsr4;
    209             $loader->prefixDirsPsr4 = ComposerStaticInit18fef7787195e2a0a9a89e28738fc125::$prefixDirsPsr4;
    210             $loader->classMap = ComposerStaticInit18fef7787195e2a0a9a89e28738fc125::$classMap;
     208            $loader->prefixLengthsPsr4 = ComposerStaticInitbc7f456b1ad6c710a056c0877d6ff1c7::$prefixLengthsPsr4;
     209            $loader->prefixDirsPsr4 = ComposerStaticInitbc7f456b1ad6c710a056c0877d6ff1c7::$prefixDirsPsr4;
     210            $loader->classMap = ComposerStaticInitbc7f456b1ad6c710a056c0877d6ff1c7::$classMap;
    211211
    212212        }, null, ClassLoader::class);
  • wemail/trunk/wemail.php

    r3423372 r3442404  
    77 * Author: weDevs
    88 * Author URI: https://getwemail.io/?utm_source=wp-org&utm_medium=author-uri
    9  * Version: 2.0.7
     9 * Version: 2.0.8
    1010 * License: GPL-3.0
    1111 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset for help on using the changeset viewer.