Plugin Directory

Changeset 3098464


Ignore:
Timestamp:
06/06/2024 09:42:39 AM (22 months ago)
Author:
glomberg
Message:

Version: 2.134.3.

Location:
security-malware-firewall
Files:
1071 added
6 edited

Legend:

Unmodified
Added
Removed
  • security-malware-firewall/trunk/lib/CleantalkSP/Common/FSWatcher/Service.php

    r3041922 r3098464  
    9393    public static function isRC()
    9494    {
    95         if (isset($_POST['fswatcher_token']) && $_POST['fswatcher_token'] == md5((string)filemtime(__FILE__))) {
    96             return true;
    97         }
    98 
    99         return false;
     95        return static::validateFsWatcherToken();
    10096    }
    10197
     
    164160        return $storage::getProcessingJournal();
    165161    }
     162
     163    /**
     164     * Generates token (aka nonce).
     165     * The $salt must be used obligatorily
     166     *
     167     * @param $salt
     168     *
     169     * @return string
     170     */
     171    public static function generateFsWatcherToken($salt = '')
     172    {
     173        return md5(filemtime(__FILE__) . $salt);
     174    }
     175
     176    public static function validateFsWatcherToken()
     177    {
     178        return isset($_POST['fswatcher_token']) && $_POST['fswatcher_token'] === static::generateFsWatcherToken();
     179    }
    166180}
  • security-malware-firewall/trunk/lib/CleantalkSP/Common/FSWatcher/View/View.php

    r3041922 r3098464  
    55use CleantalkSP\Common\FSWatcher\Controller;
    66use CleantalkSP\Common\FSWatcher\Logger;
     7use CleantalkSP\Common\FSWatcher\Service;
    78
    89class View
     
    6061
    6162        $html .= '<script type="text/javascript">';
    62         $path = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Service.php';
    63         $html .= 'var fswatcherToken = "' . md5((string)filemtime($path)) . '";';
     63        $html .= 'var fswatcherToken = "' . Service::generateFsWatcherToken() . '";';
    6464        $html .= 'var fswatcherWebsiteUrl = "' . get_home_url() . '";';
    6565        $html .= file_get_contents(__DIR__ . '/../assets/fswatcher-logic.js');
  • security-malware-firewall/trunk/lib/CleantalkSP/SpbctWP/FSWatcher/SpbctWpFSWService.php

    r3028558 r3098464  
    6868    }
    6969
    70     /**
    71      * Is ajax call is in process
    72      *
    73      * @return bool
    74      */
    75     public static function isRC()
    76     {
    77         if (isset($_POST['fswatcher_token']) && $_POST['fswatcher_token'] == md5((string)filemtime(__FILE__))) {
    78             return true;
    79         }
    80 
    81         return false;
    82     }
    83 
    8470    public static function attachJS($buffer, $file_to_get_md5 = null)
    8571    {
    8672        return parent::attachJS($buffer, __FILE__);
    8773    }
     74
     75    public static function generateFsWatcherToken($salt = '')
     76    {
     77        return wp_create_nonce('spbc_secret_fs_watcher_token');
     78    }
     79
     80    public static function validateFsWatcherToken()
     81    {
     82        return isset($_POST['fswatcher_token']) && spbc_check_ajax_referer('spbc_secret_fs_watcher_token', 'fswatcher_token');
     83    }
    8884}
  • security-malware-firewall/trunk/lib/CleantalkSP/SpbctWP/FSWatcher/View/View.php

    r3041922 r3098464  
    55use CleantalkSP\SpbctWP\FSWatcher\SpbctWpFSWController;
    66use CleantalkSP\Common\FSWatcher\View\Phrases;
     7use CleantalkSP\SpbctWP\FSWatcher\SpbctWpFSWService;
    78
    89class View extends \CleantalkSP\Common\FSWatcher\View\View
     
    6566
    6667        $html .= '<script type="text/javascript">';
    67         $path = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'SpbctWpFSWService.php';
    68         $html .= 'var fswatcherToken = "' . md5((string)filemtime($path)) . '";';
     68        $html .= 'var fswatcherToken = "' . SpbctWpFSWService::generateFsWatcherToken() . '";';
    6969        $html .= 'var fswatcherWebsiteUrl = "' . get_home_url() . '";';
    7070        $html .= file_get_contents(\CleantalkSP\Common\FSWatcher\Storage\FileStorage::getAssetsPath());
  • security-malware-firewall/trunk/readme.txt

    r3095959 r3098464  
    55Tested up to: 6.5
    66Requires PHP: 5.6
    7 Stable tag: 2.134.2
     7Stable tag: 2.134.3
    88License: GPLv2
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    337337
    338338== Changelog ==
     339
     340= 2.134.3 June 06 2024
     341* Upd. FSWatcher. FIle system watcher functionality improved.
    339342
    340343= 2.134.2 June 01 2024
  • security-malware-firewall/trunk/security-malware-firewall.php

    r3095959 r3098464  
    66Description: Security & Malware scan by CleanTalk to protect your website from online threats and viruses. IP/Country FireWall, Web application FireWall. Detailed stats and logs to have full control.
    77Author: CleanTalk Security
    8 Version: 2.134.2
     8Version: 2.134.3
    99Author URI: https://cleantalk.org
    1010Text Domain: security-malware-firewall
     
    343343unset($spbc_cron);
    344344
    345 if ($spbc->feature_restrictions->getState($spbc, 'fswatcher')->is_active && $spbc->settings['scanner__fs_watcher']) {
    346     $fswatch_params = array(
    347         'dir_to_watch' => ABSPATH,
    348         'exclude_dirs' => array(),
    349         'extensions_to_watch' => array('php'),
    350     );
    351     FSWatcherController::work($fswatch_params);
    352 }
    353 
    354345if ( is_admin() || is_network_admin() ) {
    355346    // Async loading for JavaScript
     
    398389    add_action('login_enqueue_scripts', 'spbc_enqueue_scripts__public');
    399390}
     391
     392add_action('init', function () use ($spbc) {
     393    if ( $spbc->feature_restrictions->getState($spbc, 'fswatcher')->is_active && $spbc->settings['scanner__fs_watcher'] ) {
     394        $fswatch_params = array(
     395            'dir_to_watch' => ABSPATH,
     396            'exclude_dirs' => array(),
     397            'extensions_to_watch' => array('php'),
     398        );
     399        FSWatcherController::work($fswatch_params);
     400    }
     401});
    400402
    401403/**
Note: See TracChangeset for help on using the changeset viewer.