updated plugin Jetpack Protect version 2.2.0

This commit is contained in:
2024-06-27 12:10:57 +00:00
committed by Gitium
parent ec9d8a5834
commit 938cef2946
218 changed files with 7469 additions and 1864 deletions

View File

@ -5,6 +5,62 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.20.0] - 2024-05-20
### Removed
- IDC: Remove deprecated code. [#37421]
## [0.19.0] - 2024-05-16
### Added
- IDC: Add escapes to echo statements. [#37395]
### Changed
- Updated package dependencies. [#37379]
- Updated package dependencies. [#37380]
## [0.18.6] - 2024-05-06
### Changed
- Updated package dependencies. [#37147]
### Fixed
- Fix class references in `URL_Secret::create_secret()` exception handler. [#37201]
## [0.18.5] - 2024-04-29
### Changed
- Internal updates.
## [0.18.4] - 2024-04-25
### Changed
- Update dependencies.
## [0.18.3] - 2024-04-08
### Changed
- Updated package dependencies. [#36760]
## [0.18.2] - 2024-04-02
### Changed
- Internal updates.
## [0.18.1] - 2024-04-01
### Changed
- Tests: moved tests from a separate files to the main tests file. [#36656]
## [0.18.0] - 2024-03-29
### Added
- Packages: added version tracking for identity-crisis. [#36635]
- REST: added endpoint for IDC validation. [#36537]
## [0.17.6] - 2024-03-27
### Changed
- Updated package dependencies. [#36585]
## [0.17.5] - 2024-03-25
### Changed
- Internal updates.
## [0.17.4] - 2024-03-18
### Changed
- Internal updates.
## [0.17.3] - 2024-03-14
### Changed
- Internal updates.
@ -503,6 +559,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Updated package dependencies.
- Use Connection/Urls for home_url and site_url functions migrated from Sync.
[0.20.0]: https://github.com/Automattic/jetpack-identity-crisis/compare/v0.19.0...v0.20.0
[0.19.0]: https://github.com/Automattic/jetpack-identity-crisis/compare/v0.18.6...v0.19.0
[0.18.6]: https://github.com/Automattic/jetpack-identity-crisis/compare/v0.18.5...v0.18.6
[0.18.5]: https://github.com/Automattic/jetpack-identity-crisis/compare/v0.18.4...v0.18.5
[0.18.4]: https://github.com/Automattic/jetpack-identity-crisis/compare/v0.18.3...v0.18.4
[0.18.3]: https://github.com/Automattic/jetpack-identity-crisis/compare/v0.18.2...v0.18.3
[0.18.2]: https://github.com/Automattic/jetpack-identity-crisis/compare/v0.18.1...v0.18.2
[0.18.1]: https://github.com/Automattic/jetpack-identity-crisis/compare/v0.18.0...v0.18.1
[0.18.0]: https://github.com/Automattic/jetpack-identity-crisis/compare/v0.17.6...v0.18.0
[0.17.6]: https://github.com/Automattic/jetpack-identity-crisis/compare/v0.17.5...v0.17.6
[0.17.5]: https://github.com/Automattic/jetpack-identity-crisis/compare/v0.17.4...v0.17.5
[0.17.4]: https://github.com/Automattic/jetpack-identity-crisis/compare/v0.17.3...v0.17.4
[0.17.3]: https://github.com/Automattic/jetpack-identity-crisis/compare/v0.17.2...v0.17.3
[0.17.2]: https://github.com/Automattic/jetpack-identity-crisis/compare/v0.17.1...v0.17.2
[0.17.1]: https://github.com/Automattic/jetpack-identity-crisis/compare/v0.17.0...v0.17.1

View File

@ -1 +1 @@
<?php return array('dependencies' => array('react', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n', 'wp-polyfill', 'wp-url'), 'version' => '607b018606bd0a465d3b');
<?php return array('dependencies' => array('react', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n', 'wp-polyfill', 'wp-url'), 'version' => '4b5c20bc6fc08deb6c73');

View File

@ -5,14 +5,14 @@
"license": "GPL-2.0-or-later",
"require": {
"php": ">=7.0",
"automattic/jetpack-connection": "^2.4.1",
"automattic/jetpack-constants": "^2.0.1",
"automattic/jetpack-status": "^2.1.2",
"automattic/jetpack-logo": "^2.0.1",
"automattic/jetpack-assets": "^2.1.4"
"automattic/jetpack-connection": "^2.8.3",
"automattic/jetpack-constants": "^2.0.2",
"automattic/jetpack-status": "^3.1.0",
"automattic/jetpack-logo": "^2.0.3",
"automattic/jetpack-assets": "^2.1.11"
},
"require-dev": {
"automattic/jetpack-changelogger": "^4.1.1",
"automattic/jetpack-changelogger": "^4.2.4",
"yoast/phpunit-polyfills": "1.1.0",
"automattic/wordbless": "@dev"
},
@ -57,7 +57,7 @@
"link-template": "https://github.com/Automattic/jetpack-identity-crisis/compare/v${old}...v${new}"
},
"branch-alias": {
"dev-trunk": "0.17.x-dev"
"dev-trunk": "0.20.x-dev"
}
},
"config": {

View File

@ -26,7 +26,12 @@ class Identity_Crisis {
/**
* Package Version
*/
const PACKAGE_VERSION = '0.17.3';
const PACKAGE_VERSION = '0.20.0';
/**
* Package Slug
*/
const PACKAGE_SLUG = 'identity-crisis';
/**
* Persistent WPCOM blog ID that stays in the options after disconnect.
@ -58,7 +63,7 @@ class Identity_Crisis {
/**
* The current screen, which is set if the current user is a non-admin and this is an admin page.
*
* @var WP_Screen
* @var \WP_Screen
*/
public static $current_screen;
@ -98,6 +103,9 @@ class Identity_Crisis {
add_filter( 'jetpack_register_request_body', array( static::class, 'register_request_body' ) );
add_action( 'jetpack_site_registered', array( static::class, 'site_registered' ) );
// Set up package version hook.
add_filter( 'jetpack_package_versions', array( static::class, 'send_package_version_to_tracker' ) );
$urls_in_crisis = self::check_identity_crisis();
if ( false === $urls_in_crisis ) {
return;
@ -107,6 +115,19 @@ class Identity_Crisis {
add_action( 'init', array( $this, 'wordpress_init' ) );
}
/**
* Adds the package slug and version to the package version tracker's data.
*
* @param array $package_versions The package version array.
*
* @return array The package version array.
*/
public static function send_package_version_to_tracker( $package_versions ) {
$package_versions[ self::PACKAGE_SLUG ] = self::PACKAGE_VERSION;
return $package_versions;
}
/**
* Disconnect current connection and clear IDC options.
*/
@ -138,17 +159,6 @@ class Identity_Crisis {
return ! self::validate_sync_error_idc_option();
}
/**
* Gets the link to the support document used to explain Safe Mode to users.
*
* @deprecated since 0.17.0 Use `@automattic/jetpack-idc` instead.
* @return string
*/
public static function get_safe_mod_doc_url() {
_deprecated_function( __METHOD__, 'package-0.17.0' );
return Redirect::get_url( 'jetpack-support-safe-mode' );
}
/**
* This method loops through the array of processed items from sync and checks if one of the items was the
* home_url or site_url callable. If so, then we delete the jetpack_migrate_for_idc option.
@ -354,19 +364,6 @@ class Identity_Crisis {
return false;
}
/**
* Prepare URL for display.
*
* @deprecated since 0.17.0 Use `@automattic/jetpack-idc` instead.
* @param string $url URL to display.
*
* @return string
*/
public static function prepare_url_for_display( $url ) {
_deprecated_function( __METHOD__, 'package-0.17.0' );
return untrailingslashit( self::normalize_url_protocol_agnostic( $url ) );
}
/**
* Clears all IDC specific options. This method is used on disconnect and reconnect.
*
@ -571,447 +568,6 @@ class Identity_Crisis {
return (bool) apply_filters( 'jetpack_should_handle_idc', $default );
}
/**
* Is a container for the error notices.
* Will be shown/controlled by jQuery in idc-notice.js.
*
* @deprecated 0.17.0 Use `@automattic/jetpack-idc` instead.
* @return void
*/
public function render_error_notice() {
_deprecated_function( __METHOD__, 'package-0.17.0' );
?>
<div class="jp-idc-error__notice dops-notice is-error">
<svg class="gridicon gridicons-notice dops-notice__icon" height="24" width="24" viewBox="0 0 24 24">
<g>
<path d="M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2l-.5-6h3l-.5 6z"></path>
</g>
</svg>
<div class="dops-notice__content">
<span class="dops-notice__text">
<?php esc_html_e( 'Something went wrong:', 'jetpack-idc' ); ?>
<span class="jp-idc-error__desc"></span>
</span>
<a class="dops-notice__action" href="javascript:void(0);">
<span id="jp-idc-error__action">
<?php esc_html_e( 'Try Again', 'jetpack-idc' ); ?>
</span>
</a>
</div>
</div>
<?php
}
/**
* Renders the first step notice.
*
* @deprecated 0.17.0 Use `@automattic/jetpack-idc` instead.
* @return void
*/
public function render_notice_first_step() {
_deprecated_function( __METHOD__, ' 0.17.0' );
?>
<div class="jp-idc-notice__first-step">
<div class="jp-idc-notice__content-header">
<h3 class="jp-idc-notice__content-header__lead">
<?php echo $this->get_first_step_header_lead(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</h3>
<p class="jp-idc-notice__content-header__explanation">
<?php echo $this->get_first_step_header_explanation(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</p>
</div>
<?php $this->render_error_notice(); ?>
<div class="jp-idc-notice__actions">
<div class="jp-idc-notice__action">
<p class="jp-idc-notice__action__explanation">
<?php echo $this->get_confirm_safe_mode_action_explanation(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</p>
<button id="jp-idc-confirm-safe-mode-action" class="dops-button">
<?php echo $this->get_confirm_safe_mode_button_text(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</button>
</div>
<div class="jp-idc-notice__action">
<p class="jp-idc-notice__action__explanation">
<?php echo $this->get_first_step_fix_connection_action_explanation(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</p>
<button id="jp-idc-fix-connection-action" class="dops-button">
<?php echo $this->get_first_step_fix_connection_button_text(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</button>
</div>
</div>
</div>
<?php
}
/**
* Renders the second step notice.
*
* @deprecated 0.17.0 Use `@automattic/jetpack-idc` instead.
*
* @return void
*/
public function render_notice_second_step() {
_deprecated_function( __METHOD__, ' 0.17.0' );
?>
<div class="jp-idc-notice__second-step">
<div class="jp-idc-notice__content-header">
<h3 class="jp-idc-notice__content-header__lead">
<?php echo $this->get_second_step_header_lead(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</h3>
</div>
<?php $this->render_error_notice(); ?>
<div class="jp-idc-notice__actions">
<div class="jp-idc-notice__action">
<p class="jp-idc-notice__action__explanation">
<?php echo $this->get_migrate_site_action_explanation(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</p>
<button id="jp-idc-migrate-action" class="dops-button">
<?php echo $this->get_migrate_site_button_text(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</button>
</div>
<div class="jp-idc-notice__action">
<p class="jp-idc-notice__action__explanation">
<?php echo $this->get_start_fresh_action_explanation(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</p>
<button id="jp-idc-reconnect-site-action" class="dops-button">
<?php echo $this->get_start_fresh_button_text(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</button>
</div>
</div>
<p class="jp-idc-notice__unsure-prompt">
<?php echo $this->get_unsure_prompt(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</p>
</div>
<?php
}
/**
* Returns the first step header lead.
*
* @deprecated 0.17.0 Use `@automattic/jetpack-idc` instead.
*
* @return string
*/
public function get_first_step_header_lead() {
_deprecated_function( __METHOD__, 'package-0.17.0' );
$html = wp_kses(
sprintf(
/* translators: %s: Safe mode docs URL and site URL. */
__( 'Jetpack has been placed into <a href="%1$s">Safe mode</a> because we noticed this is an exact copy of <a href="%2$s">%3$s</a>.', 'jetpack-idc' ),
esc_url( self::get_safe_mod_doc_url() ),
esc_url( self::$wpcom_home_url ),
self::prepare_url_for_display( esc_url_raw( self::$wpcom_home_url ) )
),
array( 'a' => array( 'href' => array() ) )
);
/**
* Allows overriding of the default header text in the first step of the Safe Mode notice.
*
* @param string $html The HTML to be displayed.
*
* @since 0.2.0
* @since-jetpack 4.4.0
*/
return apply_filters( 'jetpack_idc_first_step_header_lead', $html );
}
/**
* Returns the first step header explanation.
*
* @deprecated since 0.17.0 Use `@automattic/jetpack-idc` instead.
*
* @return string
*/
public function get_first_step_header_explanation() {
_deprecated_function( __METHOD__, 'package-0.17.0' );
$html = wp_kses(
sprintf(
/* translators: %s: Safe mode docs URL. */
__( 'Please confirm Safe Mode or fix the Jetpack connection. Select one of the options below or <a href="%1$s">learn more about Safe Mode</a>.', 'jetpack-idc' ),
esc_url( self::get_safe_mod_doc_url() )
),
array( 'a' => array( 'href' => array() ) )
);
/**
* Allows overriding of the default header explanation text in the first step of the Safe Mode notice.
*
* @param string $html The HTML to be displayed.
*
* @since 0.2.0
* @since-jetpack 4.4.0
*/
return apply_filters( 'jetpack_idc_first_step_header_explanation', $html );
}
/**
* Returns the confirm safe mode explanation.
*
* @deprecated since 0.17.0 Use `@automattic/jetpack-idc` instead.
* @return string
*/
public function get_confirm_safe_mode_action_explanation() {
_deprecated_function( __METHOD__, 'package-0.17.0' );
$html = wp_kses(
sprintf(
/* translators: %s: Site URL. */
__( 'Is this website a temporary duplicate of <a href="%1$s">%2$s</a> for the purposes of testing, staging or development? If so, we recommend keeping it in Safe Mode.', 'jetpack-idc' ),
esc_url( untrailingslashit( self::$wpcom_home_url ) ),
self::prepare_url_for_display( esc_url( self::$wpcom_home_url ) )
),
array( 'a' => array( 'href' => array() ) )
);
/**
* Allows overriding of the default text used to explain the confirm safe mode action.
*
* @param string $html The HTML to be displayed.
*
* @since 0.2.0
* @since-jetpack 4.4.0
*/
return apply_filters( 'jetpack_idc_confirm_safe_mode_explanation', $html );
}
/**
* Returns the confirm safe mode button text.
*
* @deprecated since 0.17.0 Use `@automattic/jetpack-idc` instead.
* @return string
*/
public function get_confirm_safe_mode_button_text() {
_deprecated_function( __METHOD__, 'package-0.17.0' );
$string = esc_html__( 'Confirm Safe Mode', 'jetpack-idc' );
/**
* Allows overriding of the default text used for the confirm safe mode action button.
*
* @param string $string The string to be displayed.
*
* @since 0.2.0
* @since-jetpack 4.4.0
*/
return apply_filters( 'jetpack_idc_confirm_safe_mode_button_text', $string );
}
/**
* Returns the first step fix connection action explanation.
*
* @deprecated since 0.17.0 Use `@automattic/jetpack-idc` instead.
* @return string
*/
public function get_first_step_fix_connection_action_explanation() {
_deprecated_function( __METHOD__, 'package-0.17.0' );
$html = wp_kses(
sprintf(
/* translators: %s: Site URL. */
__( 'If this is a separate and new website, or the new home of <a href="%1$s">%2$s</a>, we recommend turning Safe Mode off, and re-establishing your connection to WordPress.com.', 'jetpack-idc' ),
esc_url( untrailingslashit( self::$wpcom_home_url ) ),
self::prepare_url_for_display( esc_url( self::$wpcom_home_url ) )
),
array( 'a' => array( 'href' => array() ) )
);
/**
* Allows overriding of the default text used to explain the fix Jetpack connection action.
*
* @param string $html The HTML to be displayed.
*
* @since 0.2.0
* @since-jetpack 4.4.0
*/
return apply_filters( 'jetpack_idc_first_fix_connection_explanation', $html );
}
/**
* Returns the first step fix connection button text.
*
* @deprecated since 0.17.0 Use `@automattic/jetpack-idc` instead.
* @return string
*/
public function get_first_step_fix_connection_button_text() {
_deprecated_function( __METHOD__, 'package-0.17.0' );
$string = esc_html__( "Fix Jetpack's Connection", 'jetpack-idc' );
/**
* Allows overriding of the default text used for the fix Jetpack connection action button.
*
* @param string $string The string to be displayed.
*
* @since 0.2.0
* @since-jetpack 4.4.0
*/
return apply_filters( 'jetpack_idc_first_step_fix_connection_button_text', $string );
}
/**
* Returns the second step header lead.
*
* @deprecated since 0.17.0 Use `@automattic/jetpack-idc` instead.
* @return string
*/
public function get_second_step_header_lead() {
_deprecated_function( __METHOD__, 'package-0.17.0' );
$string = sprintf(
/* translators: %s: Site URL. */
esc_html__( 'Is %1$s the new home of %2$s?', 'jetpack-idc' ),
untrailingslashit( self::normalize_url_protocol_agnostic( get_home_url() ) ),
untrailingslashit( self::normalize_url_protocol_agnostic( esc_url_raw( self::$wpcom_home_url ) ) )
);
/**
* Allows overriding of the default header text in the second step of the Safe Mode notice.
*
* @param string $html The HTML to be displayed.
*
* @since 0.2.0
* @since-jetpack 4.4.0
*/
return apply_filters( 'jetpack_idc_second_step_header_lead', $string );
}
/**
* Returns the site action explanation.
*
* @deprecated since 0.17.0 Use `@automattic/jetpack-idc` instead.
* @return string
*/
public function get_migrate_site_action_explanation() {
_deprecated_function( __METHOD__, 'package-0.17.0' );
$html = wp_kses(
sprintf(
/* translators: %s: Site URL. */
__( 'Yes. <a href="%1$s">%2$s</a> is replacing <a href="%3$s">%4$s</a>. I would like to migrate my stats and subscribers from <a href="%3$s">%4$s</a> to <a href="%1$s">%2$s</a>.', 'jetpack-idc' ),
esc_url( get_home_url() ),
self::prepare_url_for_display( get_home_url() ),
esc_url( self::$wpcom_home_url ),
untrailingslashit( self::normalize_url_protocol_agnostic( esc_url_raw( self::$wpcom_home_url ) ) )
),
array( 'a' => array( 'href' => array() ) )
);
/**
* Allows overriding of the default text for explaining the migrate site action.
*
* @param string $html The HTML to be displayed.
*
* @since 0.2.0
* @since-jetpack 4.4.0
*/
return apply_filters( 'jetpack_idc_migrate_site_explanation', $html );
}
/**
* Returns the migrate site button text.
*
* @deprecated since 0.17.0 Use `@automattic/jetpack-idc` instead.
* @return string
*/
public function get_migrate_site_button_text() {
_deprecated_function( __METHOD__, 'package-0.17.0' );
$string = esc_html__( 'Migrate Stats &amp; Subscribers', 'jetpack-idc' );
/**
* Allows overriding of the default text used for the migrate site action button.
*
* @param string $string The string to be displayed.
*
* @since 0.2.0
* @since-jetpack 4.4.0
*/
return apply_filters( 'jetpack_idc_migrate_site_button_text', $string );
}
/**
* Returns the start fresh explanation.
*
* @deprecated since 0.17.0 Use `@automattic/jetpack-idc` instead.
* @return string
*/
public function get_start_fresh_action_explanation() {
_deprecated_function( __METHOD__, 'package-0.17.0' );
$html = wp_kses(
sprintf(
/* translators: %s: Site URL. */
__( 'No. <a href="%1$s">%2$s</a> is a new and different website that\'s separate from <a href="%3$s">%4$s</a>. It requires a new connection to WordPress.com for new stats and subscribers.', 'jetpack-idc' ),
esc_url( get_home_url() ),
self::prepare_url_for_display( get_home_url() ),
esc_url( self::$wpcom_home_url ),
untrailingslashit( self::normalize_url_protocol_agnostic( esc_url_raw( self::$wpcom_home_url ) ) )
),
array( 'a' => array( 'href' => array() ) )
);
/**
* Allows overriding of the default text for explaining the start fresh action.
*
* @param string $html The HTML to be displayed.
*
* @since 0.2.0
* @since-jetpack 4.4.0
*/
return apply_filters( 'jetpack_idc_start_fresh_explanation', $html );
}
/**
* Returns the start fresh button text.
*
* @deprecated since 0.17.0 Use `@automattic/jetpack-idc` instead.
* @return string
*/
public function get_start_fresh_button_text() {
_deprecated_function( __METHOD__, 'package-0.17.0' );
$string = esc_html__( 'Start Fresh &amp; Create New Connection', 'jetpack-idc' );
/**
* Allows overriding of the default text used for the start fresh action button.
*
* @param string $string The string to be displayed.
*
* @since 0.2.0
* @since-jetpack 4.4.0
*/
return apply_filters( 'jetpack_idc_start_fresh_button_text', $string );
}
/**
* Returns the unsure prompt text.
*
* @deprecated since 0.17.0 Use `@automattic/jetpack-idc` instead.
* @return string
*/
public function get_unsure_prompt() {
_deprecated_function( __METHOD__, 'package-0.17.0' );
$html = wp_kses(
sprintf(
/* translators: %s: Safe mode docs URL. */
__( 'Unsure what to do? <a href="%1$s">Read more about Jetpack Safe Mode</a>', 'jetpack-idc' ),
esc_url( self::get_safe_mod_doc_url() )
),
array( 'a' => array( 'href' => array() ) )
);
/**
* Allows overriding of the default text using in the "Unsure what to do?" prompt.
*
* @param string $html The HTML to be displayed.
*
* @since 0.2.0
* @since-jetpack 4.4.0
*/
return apply_filters( 'jetpack_idc_unsure_prompt', $html );
}
/**
* Whether the site is undergoing identity crisis.
*
@ -1138,6 +694,7 @@ class Identity_Crisis {
* @param array $response The endpoint response that we're modifying.
*
* @return array
*
* phpcs:ignore Squiz.Commenting.FunctionCommentThrowTag -- The exception is being caught, false positive.
*/
public static function add_secret_to_url_validation_response( array $response ) {

View File

@ -10,6 +10,7 @@ namespace Automattic\Jetpack\IdentityCrisis;
use Automattic\Jetpack\Connection\Manager as Connection_Manager;
use Automattic\Jetpack\Connection\Rest_Authentication;
use Jetpack_Options;
use Jetpack_XMLRPC_Server;
use WP_Error;
use WP_REST_Server;
@ -64,6 +65,17 @@ class REST_Endpoints {
)
);
// Fetch URL and secret for IDC check.
register_rest_route(
'jetpack/v4',
'/identity-crisis/idc-url-validation',
array(
'methods' => WP_REST_Server::READABLE,
'callback' => array( static::class, 'validate_urls_and_set_secret' ),
'permission_callback' => array( static::class, 'url_secret_permission_check' ),
)
);
// Fetch URL verification secret.
register_rest_route(
'jetpack/v4',
@ -214,6 +226,20 @@ class REST_Endpoints {
return new WP_Error( 'invalid_user_permission_identity_crisis', $error_msg, array( 'status' => rest_authorization_required_code() ) );
}
/**
* Endpoint for URL validation and creating a secret.
*
* @since 0.18.0
*
* @return array
*/
public static function validate_urls_and_set_secret() {
$xmlrpc_server = new Jetpack_XMLRPC_Server();
$result = $xmlrpc_server->validate_urls_for_idc_mitigation();
return $result;
}
/**
* Endpoint for fetching the existing secret.
*

View File

@ -7,6 +7,8 @@
namespace Automattic\Jetpack\IdentityCrisis;
use Automattic\Jetpack\Connection\Urls;
use Automattic\Jetpack\Tracking;
use Jetpack_Options;
/**