-
Notifications
You must be signed in to change notification settings - Fork 7
PD-91 vulnerability fix #643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
PD-91
Resolves security vulnerability reports