Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR resolves security vulnerabilities by tightening path resolution, strengthening AJAX nonce checks, and cleaning up unused hooks.
- Removed an obsolete admin initialization hook.
- Refactored
url_to_pathto prevent directory traversal in uploads. - Boosted AJAX endpoint security: combined nonce/referrer/user-capability checks and escaped remote URLs.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| includes/class-boldgrid-editor.php | Dropped the reset_editor_action on admin_init since it’s no longer needed. |
| includes/class-boldgrid-editor-crop.php | Replaced regex-based upload path logic with a stepwise normalization and safety checks. |
| includes/class-boldgrid-editor-ajax.php | Added check_ajax_referer, current_user_can, and switched to wp_safe_remote_head + esc_url_raw. |
Comments suppressed due to low confidence (3)
includes/class-boldgrid-editor-crop.php:152
- [nitpick] The variable
$realis ambiguous. Rename it to$realpathor similar to clarify that it holds the canonical path.
$real = realpath( $full );
includes/class-boldgrid-editor-crop.php:119
- Add unit tests for
url_to_pathto cover normal, encoded, and traversal edge cases (e.g.,..,%2e%2e).
public function url_to_path( $url ) {
includes/class-boldgrid-editor-ajax.php:190
- [nitpick] The variable
$validholds the nonce validity but is generically named. Rename it to$valid_nonceto match$valid_referrerand improve readability.
$valid_referrer = check_ajax_referer( self::$nonces[ $name ], self::$nonces[ $name ], false );
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
cssjoe
approved these changes
Jun 9, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PD-91
Resolves security vulnerability reports