Skip to content

Commit 5b502f8

Browse files
georgeolaruclaude
andcommitted
Security: add capability checks to AJAX handlers
Added current_user_can('manage_options') checks to the theme migration and user feedback AJAX handlers for defense-in-depth. Updated changelog. Fixes #250 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 06f4127 commit 5b502f8

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

includes/class-customify-style-manager.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -869,6 +869,10 @@ public function should_ask_for_feedback( $timestamp_limit = false ) {
869869
public function user_feedback_callback() {
870870
check_ajax_referer( 'customify_style_manager_user_feedback', 'nonce' );
871871

872+
if ( ! current_user_can( 'manage_options' ) ) {
873+
wp_send_json_error( esc_html__( 'You do not have permission to perform this action.', 'customify' ) );
874+
}
875+
872876
if ( empty( $_POST['type'] ) ) {
873877
wp_send_json_error( esc_html__( 'No type provided', 'customify' ) );
874878
}

includes/extras.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,10 @@ function customify_migrate_customizations_from_parent_to_child_theme() {
441441
// Check nonce.
442442
check_ajax_referer( 'customify_migrate_customizations_from_parent_to_child_theme', 'nonce_migrate' );
443443

444+
if ( ! current_user_can( 'manage_options' ) ) {
445+
wp_send_json_error( esc_html__( 'You do not have permission to perform this action.', 'customify' ) );
446+
}
447+
444448
$parent_theme = wp_get_theme( get_template() );
445449
if ( ! $parent_theme->exists() ) {
446450
wp_send_json_error();

readme.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@ This plugin is **primarily intended** to be used together with [Pixelgrade theme
3131
== Changelog ==
3232

3333
= 2.10.6 =
34+
* Security: added capability checks to AJAX handlers for defense-in-depth.
3435
* Fix inline font script breaking AJAX-based theme navigation.
36+
* PHP 8.x compatibility: added null safety guards for array operations.
37+
* Updated minimum PHP requirement to 7.4.
38+
* Updated minimum WordPress requirement to 5.9.
39+
* Tested with WordPress 6.9.
3540

3641
= 2.10.5 =
3742
* Security fixes.

0 commit comments

Comments
 (0)