Skip to content

Commit

Permalink
Connection: allow using application password for site registration (#…
Browse files Browse the repository at this point in the history
…40233)

Adjust REST API to allow site registration without WP nonce if an application password is used.

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/11916342727

Upstream-Ref: Automattic/jetpack@6c1f800
  • Loading branch information
sergeymitr authored and matticbot committed Nov 19, 2024
1 parent 7d7b03d commit 0454c82
Show file tree
Hide file tree
Showing 16 changed files with 126 additions and 118 deletions.
78 changes: 39 additions & 39 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/automattic/jetpack-blaze/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"require": {
"php": ">=7.2",
"automattic/jetpack-assets": "^4.0.0-alpha",
"automattic/jetpack-connection": "^6.0.1",
"automattic/jetpack-connection": "^6.1.0-alpha",
"automattic/jetpack-constants": "^3.0.0",
"automattic/jetpack-plans": "^0.5.0",
"automattic/jetpack-redirect": "^3.0.0",
Expand Down
8 changes: 8 additions & 0 deletions vendor/automattic/jetpack-connection/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ 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).

## [6.1.0-alpha] - unreleased

This is an alpha version! The changes listed here are not final.

### Added
- Allow using application password for site registration.

## [6.0.1] - 2024-11-18
### Fixed
- Work around a WP user caching bug (https://core.trac.wordpress.org/ticket/62003). [#40188]
Expand Down Expand Up @@ -1250,6 +1257,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Separate the connection library into its own package.

[6.1.0-alpha]: https://github.com/Automattic/jetpack-connection/compare/v6.0.1...v6.1.0-alpha
[6.0.1]: https://github.com/Automattic/jetpack-connection/compare/v6.0.0...v6.0.1
[6.0.0]: https://github.com/Automattic/jetpack-connection/compare/v5.1.7...v6.0.0
[5.1.7]: https://github.com/Automattic/jetpack-connection/compare/v5.1.6...v5.1.7
Expand Down
2 changes: 1 addition & 1 deletion vendor/automattic/jetpack-connection/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"link-template": "https://github.com/Automattic/jetpack-connection/compare/v${old}...v${new}"
},
"branch-alias": {
"dev-trunk": "6.0.x-dev"
"dev-trunk": "6.1.x-dev"
},
"dependencies": {
"test-only": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
class Package_Version {

const PACKAGE_VERSION = '6.0.1';
const PACKAGE_VERSION = '6.1.0-alpha';

const PACKAGE_SLUG = 'connection';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ public function __construct( Manager $connection ) {
'registration_nonce' => array(
'description' => __( 'The registration nonce', 'jetpack-connection' ),
'type' => 'string',
'required' => true,
),
'redirect_uri' => array(
'description' => __( 'URI of the admin page where the user should be redirected after connection flow', 'jetpack-connection' ),
Expand Down Expand Up @@ -791,7 +790,8 @@ public static function jetpack_register_permission_check() {
* @return \WP_REST_Response|WP_Error
*/
public function connection_register( $request ) {
if ( ! wp_verify_nonce( $request->get_param( 'registration_nonce' ), 'jetpack-registration-nonce' ) ) {
// Only require nonce if cookie authentication is used.
if ( did_action( 'auth_cookie_valid' ) && ! wp_verify_nonce( $request->get_param( 'registration_nonce' ), 'jetpack-registration-nonce' ) ) {
return new WP_Error( 'invalid_nonce', __( 'Unable to verify your request.', 'jetpack-connection' ), array( 'status' => 403 ) );
}

Expand Down
2 changes: 1 addition & 1 deletion vendor/automattic/jetpack-jitm/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"php": ">=7.2",
"automattic/jetpack-a8c-mc-stats": "^3.0.0",
"automattic/jetpack-assets": "^4.0.0-alpha",
"automattic/jetpack-connection": "^6.0.1",
"automattic/jetpack-connection": "^6.1.0-alpha",
"automattic/jetpack-device-detection": "^3.0.0",
"automattic/jetpack-logo": "^3.0.0",
"automattic/jetpack-redirect": "^3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion vendor/automattic/jetpack-masterbar/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"automattic/jetpack-blaze": "^0.25.0",
"automattic/jetpack-compat": "^4.0.0",
"automattic/jetpack-device-detection": "^3.0.0",
"automattic/jetpack-connection": "^6.0.1",
"automattic/jetpack-connection": "^6.1.0-alpha",
"automattic/jetpack-jitm": "^4.0.0",
"automattic/jetpack-logo": "^3.0.0",
"automattic/jetpack-plans": "^0.5.0",
Expand Down
Loading

0 comments on commit 0454c82

Please sign in to comment.