Skip to content

Commit 5e13ffd

Browse files
committed
Customizer: Improve changeset handling.
Merges [64876] to the 7.1 branch. Props westonruter, lancewillett, jorbin, jeremyfelt, antonade. git-svn-id: https://develop.svn.wordpress.org/branches/7.1@64888 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 5be628d commit 5e13ffd

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎src/wp-includes/class-wp-customize-manager.php‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,13 @@ public function establish_loaded_changeset() {
628628
if ( empty( $this->_changeset_uuid ) ) {
629629
$changeset_uuid = null;
630630

631-
if ( ! $this->branching() && $this->is_theme_active() ) {
631+
/**
632+
* Only users who can customize may have the latest unpublished changeset auto-loaded. Otherwise, an
633+
* unauthenticated preview request lacking a UUID could adopt another user's unpublished changeset and
634+
* disclose its state, since the UUID serves as the secret key for previewing. Unauthorized requests
635+
* get a fresh UUID instead, which matches no changeset and is rejected in {@see self::setup_theme()}.
636+
*/
637+
if ( ! $this->branching() && $this->is_theme_active() && current_user_can( 'customize' ) ) {
632638
$unpublished_changeset_posts = $this->get_changeset_posts(
633639
array(
634640
'post_status' => array_diff( get_post_stati(), array( 'auto-draft', 'publish', 'trash', 'inherit', 'private' ) ),

0 commit comments

Comments
 (0)