Skip to content

Commit 3dadb03

Browse files
committed
merge v1.8.1 into develop
1 parent 9c26258 commit 3dadb03

11 files changed

Lines changed: 62 additions & 2 deletions

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ Bugs we fixed:
99
* Fix missing content and streak badges after they are all completed.
1010
* Fix issue when point is sometimes not awarded for completing "Remove term without posts" task.
1111

12+
= 1.8.1 =
13+
14+
- Security fix: Privilege escalation via an AJAX call where authenticated users could update arbitrary site options.
15+
- Added capability checks.
16+
- Thanks to [NumeX](https://github.com/NumeXx) for responsibly disclosing via the Patchstack Bug Bounty Program.
1217

1318
= 1.8.0 =
1419

classes/admin/class-page-settings.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@ public function should_show_setting( $page_type ) {
128128
* @return void
129129
*/
130130
public function store_settings_form_options() {
131+
132+
if ( ! \current_user_can( 'manage_options' ) ) {
133+
\wp_send_json_error( [ 'message' => \esc_html__( 'You do not have permission to update settings.', 'progress-planner' ) ] );
134+
}
135+
131136
// Check the nonce.
132137
\check_admin_referer( 'progress_planner' );
133138

classes/class-suggested-tasks.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,16 @@ public function suggested_task_action() {
235235
\wp_send_json_error( [ 'message' => \esc_html__( 'Task not found.', 'progress-planner' ) ] );
236236
}
237237

238+
$provider = \progress_planner()->get_suggested_tasks()->get_tasks_manager()->get_task_provider( $task->get_provider_id() );
239+
240+
if ( ! $provider ) {
241+
\wp_send_json_error( [ 'message' => \esc_html__( 'Provider not found.', 'progress-planner' ) ] );
242+
}
243+
244+
if ( ! $provider->capability_required() ) {
245+
\wp_send_json_error( [ 'message' => \esc_html__( 'You do not have permission to complete this task.', 'progress-planner' ) ] );
246+
}
247+
238248
$updated = false;
239249

240250
switch ( $action ) {

classes/suggested-tasks/providers/class-email-sending.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,11 @@ protected function is_there_sending_email_override() {
258258
* @return void
259259
*/
260260
public function ajax_test_email_sending() {
261+
262+
if ( ! $this->capability_required() ) {
263+
\wp_send_json_error( [ 'message' => \esc_html__( 'You do not have permission to test email sending.', 'progress-planner' ) ] );
264+
}
265+
261266
// Check the nonce.
262267
\check_admin_referer( 'progress_planner' );
263268

classes/suggested-tasks/providers/class-select-locale.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,12 @@ public function print_popover_form_contents() {
241241
* @return void
242242
*/
243243
public function handle_interactive_task_specific_submit() {
244+
245+
// Check if the user has the necessary capabilities.
246+
if ( ! \current_user_can( 'manage_options' ) ) {
247+
\wp_send_json_error( [ 'message' => \esc_html__( 'You do not have permission to update settings.', 'progress-planner' ) ] );
248+
}
249+
244250
// Check the nonce.
245251
if ( ! \check_ajax_referer( 'progress_planner', 'nonce', false ) ) {
246252
\wp_send_json_error( [ 'message' => \esc_html__( 'Invalid nonce.', 'progress-planner' ) ] );

classes/suggested-tasks/providers/class-select-timezone.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,12 @@ public function print_popover_form_contents() {
158158
* @return void
159159
*/
160160
public function handle_interactive_task_specific_submit() {
161+
162+
// Check if the user has the necessary capabilities.
163+
if ( ! \current_user_can( 'manage_options' ) ) {
164+
\wp_send_json_error( [ 'message' => \esc_html__( 'You do not have permission to update settings.', 'progress-planner' ) ] );
165+
}
166+
161167
// Check the nonce.
162168
if ( ! \check_ajax_referer( 'progress_planner', 'nonce', false ) ) {
163169
\wp_send_json_error( [ 'message' => \esc_html__( 'Invalid nonce.', 'progress-planner' ) ] );

classes/suggested-tasks/providers/class-set-date-format.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,12 @@ public function print_popover_form_contents() {
253253
* @return void
254254
*/
255255
public function handle_interactive_task_specific_submit() {
256+
257+
// Check if the user has the necessary capabilities.
258+
if ( ! \current_user_can( 'manage_options' ) ) {
259+
\wp_send_json_error( [ 'message' => \esc_html__( 'You do not have permission to update settings.', 'progress-planner' ) ] );
260+
}
261+
256262
// Check the nonce.
257263
if ( ! \check_ajax_referer( 'progress_planner', 'nonce', false ) ) {
258264
\wp_send_json_error( [ 'message' => \esc_html__( 'Invalid nonce.', 'progress-planner' ) ] );

classes/suggested-tasks/providers/class-tasks-interactive.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ public function get_task_details( $task_data = [] ) {
6161
* @return void
6262
*/
6363
public function handle_interactive_task_submit() {
64+
65+
// Check if the user has the necessary capabilities.
66+
if ( ! \current_user_can( 'manage_options' ) ) {
67+
\wp_send_json_error( [ 'message' => \esc_html__( 'You do not have permission to update settings.', 'progress-planner' ) ] );
68+
}
69+
6470
// Check the nonce.
6571
if ( ! \check_ajax_referer( 'progress_planner', 'nonce', false ) ) {
6672
\wp_send_json_error( [ 'message' => \esc_html__( 'Invalid nonce.', 'progress-planner' ) ] );

classes/utils/class-onboard.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ public function on_activate_plugin( $plugin ) {
5858
* @return void
5959
*/
6060
public function save_onboard_response() {
61+
62+
if ( ! \current_user_can( 'manage_options' ) ) {
63+
\wp_send_json_error( [ 'message' => \esc_html__( 'You do not have permission to update settings.', 'progress-planner' ) ] );
64+
}
65+
6166
// Check the nonce.
6267
if ( ! \check_ajax_referer( 'progress_planner', 'nonce', false ) ) {
6368
\wp_send_json_error( [ 'message' => \esc_html__( 'Invalid nonce.', 'progress-planner' ) ] );

progress-planner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Description: A plugin to help you fight procrastination and get things done.
1010
* Requires at least: 6.6
1111
* Requires PHP: 7.4
12-
* Version: 1.8.0
12+
* Version: 1.8.1
1313
* Author: Team Emilia Projects
1414
* Author URI: https://prpl.fyi/about
1515
* License: GPL-3.0+

0 commit comments

Comments
 (0)