Skip to content

Commit

Permalink
v7.0-b31: * **Crawler** Enhanced Role Simulator security by disallowi…
Browse files Browse the repository at this point in the history
…ng editor or above access in settings.
  • Loading branch information
Hai Zheng committed Jan 13, 2025
1 parent 7d1bdea commit 93bbf33
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
4 changes: 2 additions & 2 deletions litespeed-cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin Name: LiteSpeed Cache
* Plugin URI: https://www.litespeedtech.com/products/cache-plugins/wordpress-acceleration
* Description: High-performance page caching and site optimization from LiteSpeed
* Version: 7.0-b30
* Version: 7.0-b31
* Author: LiteSpeed Technologies
* Author URI: https://www.litespeedtech.com
* License: GPLv3
Expand Down Expand Up @@ -34,7 +34,7 @@
return;
}

!defined('LSCWP_V') && define('LSCWP_V', '7.0-b30');
!defined('LSCWP_V') && define('LSCWP_V', '7.0-b31');

!defined('LSCWP_CONTENT_DIR') && define('LSCWP_CONTENT_DIR', WP_CONTENT_DIR);
!defined('LSCWP_DIR') && define('LSCWP_DIR', __DIR__ . '/'); // Full absolute path '/var/www/html/***/wp-content/plugins/litespeed-cache/' or MU
Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ You can report security bugs through the Patchstack Vulnerability Disclosure Pro
* **ESI** Added Elementor nonces (jujube0ajluxl PR#736)
* **Crawler** Enhanced hash generation function for cryptographic security.
* **Crawler** Added back `Role Simulator` w/ IP limited to `127.0.0.1` only.
* **Crawler** Enhanced Role Simulator security by disallowing editor or above access in settings.
* **Crawler** Defaulted and limited crawler `Run Duration` maximum to 900 seconds and dropped the setting.
* **Crawler** Crawler will be stopped when load limit setting is 0.
* **Crawler** Used `127.0.0.1` instead of server IP setting for DNS resolve when crawling.
Expand Down
18 changes: 14 additions & 4 deletions src/admin-settings.cls.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,18 @@ public function save($raw_data)
$data2 = array_key_exists($id, $the_matrix) ? $the_matrix[$id] : (defined('WP_CLI') && WP_CLI ? $this->conf($id) : array());
}
switch ($id) {
case self::O_CRAWLER_ROLES: // Don't allow Editor/admin to be used in crawler role simulator
$data = Utility::sanitize_lines($data);
if ($data) {
foreach ($data as $k => $v) {
if (user_can($v, 'edit_posts')) {
$msg = sprintf(__('The user id %s has the editor access, it is not allowed to be used as role simulator.', 'litespeed-cache'), '<code>' . $v . '</code>');
Admin_Display::error($msg);
unset($data[$k]);
}
}
}
break;
case self::O_CDN_MAPPING:
/**
* CDN setting
Expand Down Expand Up @@ -161,8 +173,7 @@ public function save($raw_data)
$data = $data2;
break;

// Cache exclude cat
case self::O_CACHE_EXC_CAT:
case self::O_CACHE_EXC_CAT: // Cache exclude cat
$data2 = array();
$data = Utility::sanitize_lines($data);
foreach ($data as $v) {
Expand All @@ -176,8 +187,7 @@ public function save($raw_data)
$data = $data2;
break;

// Cache exclude tag
case self::O_CACHE_EXC_TAG:
case self::O_CACHE_EXC_TAG: // Cache exclude tag
$data2 = array();
$data = Utility::sanitize_lines($data);
foreach ($data as $v) {
Expand Down

0 comments on commit 93bbf33

Please sign in to comment.