Changeset 3370739
- Timestamp:
- 09/30/2025 10:15:50 PM (6 months ago)
- Location:
- clariti
- Files:
-
- 12 edited
- 1 copied
-
tags/1.2.2 (copied) (copied from clariti/trunk)
-
tags/1.2.2/clariti.php (modified) (4 diffs)
-
tags/1.2.2/inc/class-admin.php (modified) (6 diffs)
-
tags/1.2.2/inc/class-notifier.php (modified) (7 diffs)
-
tags/1.2.2/inc/class-rest-api.php (modified) (2 diffs)
-
tags/1.2.2/inc/integrations/class-the-blog-fixer.php (modified) (1 diff)
-
tags/1.2.2/readme.txt (modified) (3 diffs)
-
trunk/clariti.php (modified) (4 diffs)
-
trunk/inc/class-admin.php (modified) (6 diffs)
-
trunk/inc/class-notifier.php (modified) (7 diffs)
-
trunk/inc/class-rest-api.php (modified) (2 diffs)
-
trunk/inc/integrations/class-the-blog-fixer.php (modified) (1 diff)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
clariti/tags/1.2.2/clariti.php
r3062842 r3370739 7 7 * Text Domain: clariti 8 8 * Domain Path: /languages 9 * Version: 1.2. 19 * Version: 1.2.2 10 10 * Requires at least: 6.0 11 11 * Requires PHP: 7.4 … … 20 20 */ 21 21 add_action( 'admin_menu', array( 'Clariti\Admin', 'action_admin_menu' ) ); 22 add_ action( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( 'Clariti\Admin', 'filter_plugin_action_links' ) );23 add_ action( 'rest_index', array( 'Clariti\REST_API', 'filter_rest_index' ) );22 add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( 'Clariti\Admin', 'filter_plugin_action_links' ) ); 23 add_filter( 'rest_index', array( 'Clariti\REST_API', 'filter_rest_index' ) ); 24 24 add_action( 'rest_api_init', array( 'Clariti\REST_API', 'register_routes' ) ); 25 25 /** … … 76 76 */ 77 77 function clariti_get_supported_post_types() { 78 $post_types = get_post_types( array(), 'object ' );78 $post_types = get_post_types( array(), 'objects' ); 79 79 $skipped = array( 80 80 'nav_menu_item', … … 89 89 continue; 90 90 } 91 // Has to public=true && show_in_rest=true. 91 92 // Post type must be public and have REST API support. 92 93 if ( empty( $post_type->public ) || empty( $post_type->show_in_rest ) ) { 93 94 continue; 94 95 } 95 // Has to support 'title' and 'editor'. 96 97 // Post type must support 'title' and 'editor'. 96 98 if ( ! post_type_supports( $post_type->name, 'title' ) || ! post_type_supports( $post_type->name, 'editor' ) ) { 97 99 continue; -
clariti/tags/1.2.2/inc/class-admin.php
r3045960 r3370739 95 95 $key = self::get_api_key(); 96 96 97 if ( ! empty( $_GET['verify'] ) && $key ) { 97 if ( ! empty( $_GET['verify'] ) && $key ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended 98 98 Notifier::action_updated_option( self::API_KEY_OPTION, $key, $key ); 99 99 } … … 105 105 self::PAGE_SLUG 106 106 ); 107 if ( ! empty( $_GET['advanced'] ) || get_option( self::API_HOST_OPTION ) ) { 107 if ( ! empty( $_GET['advanced'] ) || get_option( self::API_HOST_OPTION ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended 108 108 add_settings_field( 109 109 self::API_HOST_OPTION, … … 137 137 <?php submit_button(); ?> 138 138 </form> 139 <?php if ( isset( $_GET['advanced'] ) && $_GET['advanced'] ) :?>139 <?php if ( isset( $_GET['advanced'] ) && (int) $_GET['advanced'] ) : // phpcs:ignore WordPress.Security.NonceVerification.Recommended ?> 140 140 <form method="post" action="admin-post.php"> 141 141 <table class="form-table" role="presentation"> … … 151 151 <input type="hidden" name="action" value="clear_secret"> 152 152 <input type="hidden" name="clear-secret" value="1"> 153 <?php wp_nonce_field( 'clear_secret', 'clear_secret_nonce' ); ?> 153 154 <?php submit_button( 'Clear Secret' ); ?> 154 155 </form> … … 267 268 */ 268 269 public static function clear_secret(): void { 269 delete_option( Admin::API_SECRET_OPTION );270 delete_option( self::API_SECRET_OPTION ); 270 271 } 271 272 … … 276 277 */ 277 278 public static function get_api_key(): string { 278 $value = get_option( Admin::API_KEY_OPTION, '' );279 $value = get_option( self::API_KEY_OPTION, '' ); 279 280 280 281 return (string) $value; -
clariti/tags/1.2.2/inc/class-notifier.php
r3062842 r3370739 85 85 } 86 86 87 error_log( 'CLARITI:ERROR - action_added_option - ' . $exception->getMessage() ); 87 error_log( 'CLARITI:ERROR - action_added_option - ' . $exception->getMessage() ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log 88 88 } 89 89 } … … 138 138 } 139 139 140 error_log( 'CLARITI:ERROR - action_updated_option - ' . $exception->getMessage() ); 140 error_log( 'CLARITI:ERROR - action_updated_option - ' . $exception->getMessage() ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log 141 141 } 142 142 } … … 246 246 * Inform Clariti when an approved comment is updated. 247 247 * 248 * @param integer $id The comment ID.249 * @param WP_Comment $comment Comment object.248 * @param integer $id The comment ID. 249 * @param \WP_Comment $comment Comment object. 250 250 */ 251 251 public static function action_wp_insert_comment( $id, $comment ) { … … 393 393 self::send_clariti_payload( $payload ); 394 394 } catch ( \Exception $exception ) { 395 error_log( 'CLARITI:ERROR - action_updated_option - ' . $exception->getMessage() ); 395 error_log( 'CLARITI:ERROR - action_updated_option - ' . $exception->getMessage() ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log 396 396 } 397 397 } … … 407 407 } elseif ( get_option( Admin::API_HOST_OPTION, '' ) ) { 408 408 $host = get_option( Admin::API_HOST_OPTION, '' ); 409 } elseif ( ! empty( $_POST[ Admin::API_HOST_OPTION ] ) && ! Admin::is_valid_api_host( $_POST[ Admin::API_HOST_OPTION ] ) ) {410 $host = $_POST[ Admin::API_HOST_OPTION ];409 } elseif ( ! empty( $_POST[ Admin::API_HOST_OPTION ] ) && ! Admin::is_valid_api_host( sanitize_text_field( wp_unslash( $_POST[ Admin::API_HOST_OPTION ] ) ) ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing 410 $host = sanitize_text_field( wp_unslash( $_POST[ Admin::API_HOST_OPTION ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing 411 411 } else { 412 412 $host = self::API_HOST_DEFAULT; … … 456 456 457 457 if ( $response instanceof \WP_Error ) { 458 throw new \Exception( $response->get_error_message() );458 throw new \Exception( esc_html( $response->get_error_message() ) ); 459 459 } 460 460 461 461 $data = json_decode( $response['body'], true ); 462 462 463 if ( ! $data || is_wp_error( $data ) ) {463 if ( ! $data || ! is_array( $data ) ) { 464 464 throw new \Exception( 'Could not read response from Clariti' ); 465 465 } 466 466 467 if ( false === ( (bool)$data['ok'] ?? false ) ) {467 if ( false === (bool) ( $data['ok'] ?? false ) ) { 468 468 // If Clariti replies with a 601 error code, clear the secret and 469 469 // prevent further requests until a new API key is added. 470 if ( 601 === ( (int)$data['error']['code'] ?? null ) ) {470 if ( 601 === (int) ( $data['error']['code'] ?? null ) ) { 471 471 Admin::clear_secret(); 472 472 } 473 473 474 throw new \Exception( "{$data['error']['code']} - {$data['error']['message']}");474 throw new \Exception( esc_html( "{$data['error']['code']} - {$data['error']['message']}" ) ); 475 475 } 476 476 … … 527 527 */ 528 528 public static function clear_secret_option() { 529 check_admin_referer( 'clear_secret', 'clear_secret_nonce' ); 530 531 if ( ! current_user_can( Admin::CAPABILITY ) ) { 532 wp_die( esc_html__( 'You are not authorized to perform this action.', 'clariti' ) ); 533 } 534 529 535 Admin::clear_secret(); 530 536 Admin::send_admin_notification( 'clariti-updated-option', 'clariti-updated-option-success', 'Clariti Secret cleared!', 'success' ); -
clariti/tags/1.2.2/inc/class-rest-api.php
r3045960 r3370739 41 41 * Filters the REST API index to include our own data. 42 42 * 43 * @param WP_REST_Response $response Existing response object.43 * @param \WP_REST_Response $response Existing response object. 44 44 * @return object 45 45 */ … … 164 164 } 165 165 166 $key = admin::get_api_key();166 $key = Admin::get_api_key(); 167 167 168 168 return array( -
clariti/tags/1.2.2/inc/integrations/class-the-blog-fixer.php
r2997887 r3370739 18 18 * Fires after an operation has been performed on a post. 19 19 * 20 * @param object $po Post operation object.21 * @param object $post Post.20 * @param object $po Post operation object. 21 * @param \WP_Post $post Post. 22 22 */ 23 23 public static function action_tbf_after_post_operation_execution( $po, $post ) { -
clariti/tags/1.2.2/readme.txt
r3370647 r3370739 4 4 Requires at least: 6.0 5 5 Tested up to: 6.8 6 Stable tag: 1.2. 16 Stable tag: 1.2.2 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 28 28 == Frequently Asked Questions == 29 29 30 = Where do I report security bugs found in this plugin? =30 = Where do I report security bugs? = 31 31 32 Please report security bugs found in the source code of the Clariti plugin t hrough the [Patchstack Vulnerability Disclosure Program](https://patchstack.com/database/vdp/ce756ba9-6201-4854-bf28-499d3c2422fd). The Patchstack team will assist you with verification, CVE assignment, and notify the developers of this plugin.32 Please report security bugs found in the source code of the Clariti plugin to security@clariti.com. 33 33 34 34 == Installation == … … 49 49 50 50 == Changelog == 51 52 = 1.2.2 (September 30, 2025) = 53 54 * Fix an issue where a secondary key used in the connection to Clariti could be deleted by an authenticated user. 55 * Improve nonce verification. 51 56 52 57 = 1.2.1 (April 2, 2024) = -
clariti/trunk/clariti.php
r3062842 r3370739 7 7 * Text Domain: clariti 8 8 * Domain Path: /languages 9 * Version: 1.2. 19 * Version: 1.2.2 10 10 * Requires at least: 6.0 11 11 * Requires PHP: 7.4 … … 20 20 */ 21 21 add_action( 'admin_menu', array( 'Clariti\Admin', 'action_admin_menu' ) ); 22 add_ action( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( 'Clariti\Admin', 'filter_plugin_action_links' ) );23 add_ action( 'rest_index', array( 'Clariti\REST_API', 'filter_rest_index' ) );22 add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( 'Clariti\Admin', 'filter_plugin_action_links' ) ); 23 add_filter( 'rest_index', array( 'Clariti\REST_API', 'filter_rest_index' ) ); 24 24 add_action( 'rest_api_init', array( 'Clariti\REST_API', 'register_routes' ) ); 25 25 /** … … 76 76 */ 77 77 function clariti_get_supported_post_types() { 78 $post_types = get_post_types( array(), 'object ' );78 $post_types = get_post_types( array(), 'objects' ); 79 79 $skipped = array( 80 80 'nav_menu_item', … … 89 89 continue; 90 90 } 91 // Has to public=true && show_in_rest=true. 91 92 // Post type must be public and have REST API support. 92 93 if ( empty( $post_type->public ) || empty( $post_type->show_in_rest ) ) { 93 94 continue; 94 95 } 95 // Has to support 'title' and 'editor'. 96 97 // Post type must support 'title' and 'editor'. 96 98 if ( ! post_type_supports( $post_type->name, 'title' ) || ! post_type_supports( $post_type->name, 'editor' ) ) { 97 99 continue; -
clariti/trunk/inc/class-admin.php
r3045960 r3370739 95 95 $key = self::get_api_key(); 96 96 97 if ( ! empty( $_GET['verify'] ) && $key ) { 97 if ( ! empty( $_GET['verify'] ) && $key ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended 98 98 Notifier::action_updated_option( self::API_KEY_OPTION, $key, $key ); 99 99 } … … 105 105 self::PAGE_SLUG 106 106 ); 107 if ( ! empty( $_GET['advanced'] ) || get_option( self::API_HOST_OPTION ) ) { 107 if ( ! empty( $_GET['advanced'] ) || get_option( self::API_HOST_OPTION ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended 108 108 add_settings_field( 109 109 self::API_HOST_OPTION, … … 137 137 <?php submit_button(); ?> 138 138 </form> 139 <?php if ( isset( $_GET['advanced'] ) && $_GET['advanced'] ) :?>139 <?php if ( isset( $_GET['advanced'] ) && (int) $_GET['advanced'] ) : // phpcs:ignore WordPress.Security.NonceVerification.Recommended ?> 140 140 <form method="post" action="admin-post.php"> 141 141 <table class="form-table" role="presentation"> … … 151 151 <input type="hidden" name="action" value="clear_secret"> 152 152 <input type="hidden" name="clear-secret" value="1"> 153 <?php wp_nonce_field( 'clear_secret', 'clear_secret_nonce' ); ?> 153 154 <?php submit_button( 'Clear Secret' ); ?> 154 155 </form> … … 267 268 */ 268 269 public static function clear_secret(): void { 269 delete_option( Admin::API_SECRET_OPTION );270 delete_option( self::API_SECRET_OPTION ); 270 271 } 271 272 … … 276 277 */ 277 278 public static function get_api_key(): string { 278 $value = get_option( Admin::API_KEY_OPTION, '' );279 $value = get_option( self::API_KEY_OPTION, '' ); 279 280 280 281 return (string) $value; -
clariti/trunk/inc/class-notifier.php
r3062842 r3370739 85 85 } 86 86 87 error_log( 'CLARITI:ERROR - action_added_option - ' . $exception->getMessage() ); 87 error_log( 'CLARITI:ERROR - action_added_option - ' . $exception->getMessage() ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log 88 88 } 89 89 } … … 138 138 } 139 139 140 error_log( 'CLARITI:ERROR - action_updated_option - ' . $exception->getMessage() ); 140 error_log( 'CLARITI:ERROR - action_updated_option - ' . $exception->getMessage() ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log 141 141 } 142 142 } … … 246 246 * Inform Clariti when an approved comment is updated. 247 247 * 248 * @param integer $id The comment ID.249 * @param WP_Comment $comment Comment object.248 * @param integer $id The comment ID. 249 * @param \WP_Comment $comment Comment object. 250 250 */ 251 251 public static function action_wp_insert_comment( $id, $comment ) { … … 393 393 self::send_clariti_payload( $payload ); 394 394 } catch ( \Exception $exception ) { 395 error_log( 'CLARITI:ERROR - action_updated_option - ' . $exception->getMessage() ); 395 error_log( 'CLARITI:ERROR - action_updated_option - ' . $exception->getMessage() ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log 396 396 } 397 397 } … … 407 407 } elseif ( get_option( Admin::API_HOST_OPTION, '' ) ) { 408 408 $host = get_option( Admin::API_HOST_OPTION, '' ); 409 } elseif ( ! empty( $_POST[ Admin::API_HOST_OPTION ] ) && ! Admin::is_valid_api_host( $_POST[ Admin::API_HOST_OPTION ] ) ) {410 $host = $_POST[ Admin::API_HOST_OPTION ];409 } elseif ( ! empty( $_POST[ Admin::API_HOST_OPTION ] ) && ! Admin::is_valid_api_host( sanitize_text_field( wp_unslash( $_POST[ Admin::API_HOST_OPTION ] ) ) ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing 410 $host = sanitize_text_field( wp_unslash( $_POST[ Admin::API_HOST_OPTION ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing 411 411 } else { 412 412 $host = self::API_HOST_DEFAULT; … … 456 456 457 457 if ( $response instanceof \WP_Error ) { 458 throw new \Exception( $response->get_error_message() );458 throw new \Exception( esc_html( $response->get_error_message() ) ); 459 459 } 460 460 461 461 $data = json_decode( $response['body'], true ); 462 462 463 if ( ! $data || is_wp_error( $data ) ) {463 if ( ! $data || ! is_array( $data ) ) { 464 464 throw new \Exception( 'Could not read response from Clariti' ); 465 465 } 466 466 467 if ( false === ( (bool)$data['ok'] ?? false ) ) {467 if ( false === (bool) ( $data['ok'] ?? false ) ) { 468 468 // If Clariti replies with a 601 error code, clear the secret and 469 469 // prevent further requests until a new API key is added. 470 if ( 601 === ( (int)$data['error']['code'] ?? null ) ) {470 if ( 601 === (int) ( $data['error']['code'] ?? null ) ) { 471 471 Admin::clear_secret(); 472 472 } 473 473 474 throw new \Exception( "{$data['error']['code']} - {$data['error']['message']}");474 throw new \Exception( esc_html( "{$data['error']['code']} - {$data['error']['message']}" ) ); 475 475 } 476 476 … … 527 527 */ 528 528 public static function clear_secret_option() { 529 check_admin_referer( 'clear_secret', 'clear_secret_nonce' ); 530 531 if ( ! current_user_can( Admin::CAPABILITY ) ) { 532 wp_die( esc_html__( 'You are not authorized to perform this action.', 'clariti' ) ); 533 } 534 529 535 Admin::clear_secret(); 530 536 Admin::send_admin_notification( 'clariti-updated-option', 'clariti-updated-option-success', 'Clariti Secret cleared!', 'success' ); -
clariti/trunk/inc/class-rest-api.php
r3045960 r3370739 41 41 * Filters the REST API index to include our own data. 42 42 * 43 * @param WP_REST_Response $response Existing response object.43 * @param \WP_REST_Response $response Existing response object. 44 44 * @return object 45 45 */ … … 164 164 } 165 165 166 $key = admin::get_api_key();166 $key = Admin::get_api_key(); 167 167 168 168 return array( -
clariti/trunk/inc/integrations/class-the-blog-fixer.php
r2997887 r3370739 18 18 * Fires after an operation has been performed on a post. 19 19 * 20 * @param object $po Post operation object.21 * @param object $post Post.20 * @param object $po Post operation object. 21 * @param \WP_Post $post Post. 22 22 */ 23 23 public static function action_tbf_after_post_operation_execution( $po, $post ) { -
clariti/trunk/readme.txt
r3370647 r3370739 4 4 Requires at least: 6.0 5 5 Tested up to: 6.8 6 Stable tag: 1.2. 16 Stable tag: 1.2.2 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 28 28 == Frequently Asked Questions == 29 29 30 = Where do I report security bugs found in this plugin? =30 = Where do I report security bugs? = 31 31 32 Please report security bugs found in the source code of the Clariti plugin t hrough the [Patchstack Vulnerability Disclosure Program](https://patchstack.com/database/vdp/ce756ba9-6201-4854-bf28-499d3c2422fd). The Patchstack team will assist you with verification, CVE assignment, and notify the developers of this plugin.32 Please report security bugs found in the source code of the Clariti plugin to security@clariti.com. 33 33 34 34 == Installation == … … 49 49 50 50 == Changelog == 51 52 = 1.2.2 (September 30, 2025) = 53 54 * Fix an issue where a secondary key used in the connection to Clariti could be deleted by an authenticated user. 55 * Improve nonce verification. 51 56 52 57 = 1.2.1 (April 2, 2024) =
Note: See TracChangeset
for help on using the changeset viewer.