[Bug Report] overwrites DISALLOW_FILE_EDIT in wp-config.php issue
-
Hi WPASE Team,
I’d like to report a bug in Admin and Site Enhancements Pro regarding the “Disable Plugin and Theme Editor feature.
Summary
When the “Disable Plugin and Theme Editor setting is OFF (file editing allowed), the plugin still forcibly overwrites the DISALLOW_FILE_EDIT constant in wp-config.php to false on every admin page load — silently undoing a user’s manual security hardening.Steps to reproduce
- Install ASE Pro v8.9.2, keep “Disable Plugin and Theme Editor OFF.
- Manually add define(‘DISALLOW_FILE_EDIT’, true); to wp-config.php.
- Log in as an administrator and visit any wp-admin page (dashboard, settings, etc.).
- wp-config.php is silently modified: DISALLOW_FILE_EDIT is changed back to false (within seconds).
Root cause (from code inspection)
In classes/class-disable-smaller-components.php, the enable_plugin_theme_editor() method runs on every admin request (skipped only for ajax/cron). When the option disable_plugin_theme_editor is false (feature OFF), ASE still calls enable_plugin_theme_editor(), which uses WP_Config_Transformer to force DISALLOW_FILE_EDIT to ‘false’.Expected behavior
When the feature is disabled (setting = false), ASE should NOT touch the DISALLOW_FILE_EDIT constant at all. Users who manually set DISALLOW_FILE_EDIT=true for security hardening should have their setting respected.Impact
- Security hardening (DISALLOW_FILE_EDIT=true) is silently reverted, re-enabling the plugin/theme file editor.
- Affects multiple sites using the plugin (we confirmed it on 3 sites).
- Hard to detect because there is no log or notice about the modification.
Suggested fix
Only run enable/disable_plugin_theme_editor() logic when the user explicitly enables the corresponding feature. When the setting is OFF, leave wp-config.php untouched. Alternatively, add an opt-out option for ASE not to manage DISALLOW_FILE_EDIT.Environment
- WordPress 7.0.3
- PHP 8.3.32
- Memcached object cache
Thank you for maintaining a great plugin — I’m happy to provide more details if needed.
Best regards,
You must be logged in to reply to this topic.