|
1 | 1 | # Changelog for EngineScript Site Exporter |
2 | 2 |
|
| 3 | +## Unreleased |
| 4 | + |
| 5 | +### Security |
| 6 | + |
| 7 | +- **Export Directory Protection**: Added `.htaccess` file to the export directory with `Deny from all` rules (Apache 2.2 and 2.4) to prevent direct HTTP access to export files during the cleanup window. Previously only an `index.php` prevented directory listing. |
| 8 | +- **Private API Removal**: Removed usage of `_get_cron_array()` (WordPress private/internal function) from cron failure diagnostics. Uses only public APIs (`wp_next_scheduled()`, `wp_schedule_single_event()`) now. |
| 9 | +- **Filesystem Compatibility**: Replaced `glob()` with `scandir()` in `sse_bulk_cleanup_exports_handler()` for cross-platform compatibility and consistency with WordPress filesystem conventions. |
| 10 | +- **SSRF Hardening**: File download functions now use `realpath()`-resolved paths for all filesystem operations (`readfile()`, `is_readable()`, `is_file()`), preventing TOCTOU and SSRF attack vectors. `sse_validate_file_output_security()` now returns the resolved path for direct use. |
| 11 | + |
| 12 | +### Bug Fixes |
| 13 | + |
| 14 | +- **Documentation Fix**: Corrected README.md Security Features section from "after 1 hour" to "after 5 minutes" to match actual cleanup timer. |
| 15 | +- **Unused Variable**: Removed unused `$export_dir_name` variable assignment in `sse_exporter_page_html()`. |
| 16 | +- **phpcs Suppression**: Removed unnecessary `phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped` comment on a line already properly escaped with `esc_html()`. |
| 17 | +- **GEMINI.md Accuracy**: Updated WP-CLI Integration section to reflect that WP-CLI is a required dependency (returns `WP_Error` if unavailable), replacing outdated "graceful fallback" language. |
| 18 | + |
| 19 | +### Architecture |
| 20 | + |
| 21 | +- **WP_Filesystem Helper**: Extracted duplicated `WP_Filesystem` initialization from 4 functions into a single `sse_init_filesystem()` helper that returns `true|WP_Error`, reducing ~40 lines of duplicated code to ~10. |
| 22 | +- **Removed Wrapper Functions**: Inlined 3 pass-through wrapper functions (`sse_validate_download_request()`, `sse_validate_file_deletion()`, `sse_validate_export_file_for_deletion()`) — callers now invoke the underlying functions directly. |
| 23 | +- **Download Validation Consolidation**: Removed 2 redundant intermediate validation passes (`sse_validate_download_file_data()`, `sse_validate_download_file_access()`) from the download flow. Entry validation and final `readfile()` security gate remain; intermediate re-validation of already-validated data removed. |
| 24 | +- **Path Resolution Consolidation**: Consolidated 7-function-deep path resolution chain into a single `sse_resolve_file_path()` function. Removed 6 single-use intermediary functions (`sse_resolve_nonexistent_file_path()`, `sse_get_upload_directory_info()`, `sse_build_validated_file_path()`, `sse_validate_parent_directory_safety()`, `sse_construct_final_file_path()`, `sse_resolve_parent_directory()`, `sse_sanitize_filename()`). |
| 25 | +- **Dead Code Removal**: Removed no-op `sse_prepare_execution_environment()` function and its call from the export flow. |
| 26 | +- **Debug Code Removal**: Removed `sse_test_cron_scheduling()` debug function that created/verified/removed a test cron event on every export — no longer needed after v2.0.0 cron fixes. |
| 27 | +- **Cron Logging Reduction**: Reduced cron scheduling functions from 5+ log entries each to 2 (success/failure), keeping `DISABLE_WP_CRON` diagnostic on failure only. |
| 28 | + |
| 29 | +### PHP 7.4 Modernization |
| 30 | + |
| 31 | +- **Type Declarations**: Added PHP 7.4 parameter types and return types to all functions where deterministic. Functions returning union types (`array|WP_Error`, `string|false`, `true|WP_Error`) retain PHPDoc-only annotations since PHP 7.4 does not support union return types. |
| 32 | +- **Short Array Syntax**: Standardized all `array()` constructor calls to short `[]` syntax throughout the plugin. |
| 33 | +- **Null Coalescing Assignment**: Replaced explicit null check + assignment pattern with PHP 7.4 `??=` operator in `sse_should_exclude_file()` file size cache, and `?:` Elvis operator for the ternary fallback. |
| 34 | + |
3 | 35 | ## 2.0.0 - March 1, 2026 |
4 | 36 |
|
5 | 37 | ### Critical Bug Fixes |
|
0 commit comments