Changeset 3319016
- Timestamp:
- 06/28/2025 03:35:52 AM (6 months ago)
- Location:
- filester/trunk
- Files:
-
- 6 edited
-
assets/js/file_manager_admin.js (modified) (2 diffs)
-
includes/File_manager/FileManager.php (modified) (6 diffs)
-
includes/File_manager/lib/php/elFinder.class.php (modified) (1 diff)
-
ninja-file-manager.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
-
views/pages/html-filemanager-settings.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
filester/trunk/assets/js/file_manager_admin.js
r3186518 r3319016 209 209 const enable_htaccess = jQuery("#enable_htaccess").is(":checked") 210 210 const enable_trash = jQuery("#enable_trash").is(":checked") 211 const enable_sensitive_protection = jQuery("#enable_sensitive_protection").is(":checked") 211 212 const data = { 212 213 'nonce': wpData.nonce, … … 218 219 'fm_locale': fm_locale, 219 220 'enable_htaccess': enable_htaccess, 220 'enable_trash': enable_trash 221 'enable_trash': enable_trash, 222 'enable_sensitive_protection': enable_sensitive_protection 221 223 222 224 } -
filester/trunk/includes/File_manager/FileManager.php
r3310066 r3319016 53 53 'njt_fs_file_manager_settings' => array( 54 54 'root_folder_path' => ABSPATH, 55 'root_folder_url' => site_url() 55 'root_folder_url' => site_url(), 56 'enable_sensitive_protection' => '1' 56 57 ), 57 58 ); … … 290 291 'uploadDeny' => array('htaccess'), 291 292 //'acceptedName' => 'validName', 292 'attributes' => array( 293 array( 294 'pattern' => '/.htaccess/', 295 'read' => true, 296 'write' => false, 297 'hidden' => false, 298 'locked' => true 299 ) 300 ) // default is empty 293 'attributes' => array() // default is empty 301 294 ), 302 295 ), 303 296 ); 304 297 305 // .htaccess 306 if(isset($this->options['njt_fs_file_manager_settings']['enable_htaccess']) && ($this->options['njt_fs_file_manager_settings']['enable_htaccess'] == '1')) { 307 $attributes = array( 308 'pattern' => '/.htaccess/', 309 'read' => true, 310 'write' => false, 311 'hidden' => true, 312 'locked' => true 313 ); 314 array_push($opts['roots'][0]['attributes'], $attributes); 315 } 298 316 299 317 300 //Enable Trash … … 483 466 } 484 467 485 468 // Sensitive files protection 469 if(isset($this->options['njt_fs_file_manager_settings']['enable_sensitive_protection']) && ($this->options['njt_fs_file_manager_settings']['enable_sensitive_protection'] == '1')) { 470 $sensitive_files = apply_filters('njt_fs_sensitive_files', array( 471 '.htaccess', 472 'wp-config.php', 473 '.env', 474 'wp-config-sample.php', 475 'readme.html', 476 'license.txt', 477 'xmlrpc.php' 478 )); 479 480 foreach ($sensitive_files as $file) { 481 $attributes = array( 482 'pattern' => '/' . preg_quote($file, '/') . '/', 483 'read' => $this->canAccessSensitiveFiles(), 484 'write' => $this->canEditSensitiveFiles(), 485 'hidden' => !$this->canAccessSensitiveFiles(), 486 'locked' => !$this->canEditSensitiveFiles() 487 ); 488 array_push($opts['roots'][0]['attributes'], $attributes); 489 } 490 } 491 492 // .htaccess 493 if(isset($this->options['njt_fs_file_manager_settings']['enable_htaccess']) && ($this->options['njt_fs_file_manager_settings']['enable_htaccess'] == '1')) { 494 $attributes = array( 495 'pattern' => '/.htaccess/', 496 'read' => true, 497 'write' => false, 498 'hidden' => true, 499 'locked' => true 500 ); 501 array_push($opts['roots'][0]['attributes'], $attributes); 502 } 486 503 487 504 //End --setting User Role Restrictions … … 566 583 $enable_htaccess = isset($_POST['enable_htaccess']) && $_POST['enable_htaccess'] == 'true' ? 1 : 0; 567 584 $enable_trash = isset($_POST['enable_trash']) && $_POST['enable_trash'] == 'true' ? 1 : 0; 585 $enable_sensitive_protection = isset($_POST['enable_sensitive_protection']) && $_POST['enable_sensitive_protection'] == 'true' ? 1 : 0; 568 586 //save options 569 587 $this->options['njt_fs_file_manager_settings']['root_folder_path'] = $root_folder_path; … … 574 592 $this->options['njt_fs_file_manager_settings']['enable_htaccess'] = $enable_htaccess; 575 593 $this->options['njt_fs_file_manager_settings']['enable_trash'] = $enable_trash; 594 $this->options['njt_fs_file_manager_settings']['enable_sensitive_protection'] = $enable_sensitive_protection; 576 595 //update options 577 596 update_option('njt_fs_settings', $this->options); … … 618 637 } 619 638 639 public function canAccessSensitiveFiles() { 640 // Filter hook for developers 641 if (apply_filters('njt_fs_allow_sensitive_access', false)) { 642 return true; 643 } 644 645 return false; 646 } 647 648 public function canEditSensitiveFiles() { 649 // Filter hook for developers 650 if (apply_filters('njt_fs_allow_sensitive_edit', false)) { 651 return true; 652 } 653 654 return false; 655 } 656 620 657 } -
filester/trunk/includes/File_manager/lib/php/elFinder.class.php
r3129722 r3319016 2009 2009 return $a404; 2010 2010 } 2011 2012 // SECURITY FIX: Validate $src path to prevent directory traversal 2013 $realSrc = realpath($src); 2014 $realTmpDir = realpath($tmpdir); 2015 if (!$realSrc || !$realTmpDir || strpos($realSrc, $realTmpDir) !== 0) { 2016 fclose($fp); 2017 return $a403; 2018 } 2019 2011 2020 if (strpos($src, $tmpdir) === 0) { 2012 2021 $GLOBALS['elFinderTempFiles'][$src] = true; -
filester/trunk/ninja-file-manager.php
r3310066 r3319016 4 4 * Plugin URI: https://ninjateam.org/filester 5 5 * Description: Made to help you focus on WordPress file management and avoid being distracted. 6 * Version: 1. 8.96 * Version: 1.9 7 7 * Author: Ninja Team 8 8 * Author URI: https://ninjateam.org … … 36 36 37 37 define('NJT_FS_BN_PREFIX', 'njt-fs'); 38 define('NJT_FS_BN_VERSION', '1. 8.9');38 define('NJT_FS_BN_VERSION', '1.9'); 39 39 define('NJT_FS_BN_DOMAIN', 'filester'); 40 40 -
filester/trunk/readme.txt
r3310066 r3319016 5 5 Requires at least: 3.0 6 6 Tested up to: 6.8 7 Stable tag: 1. 8.97 Stable tag: 1.9 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 112 112 == Changelog == 113 113 114 = Jun 28, 2025 - Version 1.9 = 115 - Fixed: Authenticated (Subscriber+) Directory Traversal to Arbitrary File Deletion 116 114 117 = Jun 11, 2025 - Version 1.8.9 = 115 118 - Fixed: Patchstack security report -
filester/trunk/views/pages/html-filemanager-settings.php
r3310066 r3319016 141 141 </td> 142 142 </tr> 143 <!-- Sensitive Files Protection --> 144 <tr> 145 <th><?php _e("Sensitive Files Protection", 'filester'); ?></th> 146 <td> 147 <label class="shortcode-switch" for="enable_sensitive_protection"> 148 <input name="enable_sensitive_protection" type="checkbox" id="enable_sensitive_protection" value="1" 149 <?php echo isset($this->options['njt_fs_file_manager_settings']['enable_sensitive_protection']) && ($this->options['njt_fs_file_manager_settings']['enable_sensitive_protection'] == '1') ? 'checked="checked"' : '';?>> 150 <div class="slider round"></div> 151 </label> 152 <p class="description njt-settting-width"> 153 <?php _e("Protect sensitive files like wp-config.php, .env, etc. Only administrators can access.", 'filester'); ?> 154 </p> 155 </td> 156 </tr> 143 157 <!-- button submit --> 144 158 <tr>
Note: See TracChangeset
for help on using the changeset viewer.