Make WordPress Core

Opened 4 months ago

Closed 5 weeks ago

#62372 closed defect (bug) (fixed)

Fix theme.json removal of insecure properties for block style variations

Reported by: aaronrobertshaw's profile aaronrobertshaw Owned by: peterwilsoncc's profile peterwilsoncc
Milestone: 6.8 Priority: normal
Severity: normal Version: 6.7
Component: Editor Keywords: gutenberg-merge, has-patch, has-unit-tests
Focuses: Cc:

Description

This ticket tracks the backporting of PHP files for the following Gutenberg updates:

These changes prevent valid inner block type and element styles from being stripped out of block style variations via remove_insecure_properties.

Change History (3)

This ticket was mentioned in PR #7759 on WordPress/wordpress-develop by @aaronrobertshaw.


4 months ago
#1

  • Keywords has-patch has-unit-tests added

This PR backports the PHP changes from https://github.com/WordPress/gutenberg/pull/66896

These changes prevent valid inner block type and element styles from being stripped out of block style variations via remove_insecure_properties.

Trac ticket: https://core.trac.wordpress.org/ticket/62372

#### Testing Instructions

  1. Ensure unit tests are passing
  2. Using a multisite install, login with a user that has access to the Site Editor but doesn't have unfiltered_html caps e.g. site admin
  3. Activate a theme that within a theme style variation defines a block style variation containing inner block and element styles
  4. Navigate to Appearance > Editor
  5. Edit a page or template and apply the block style variation from step 3
  6. Save changes
  7. Apply the theme style variation identified in step 3.
  8. Re-save changes and switch to the frontend
  9. Confirm that the block with the block style variation applied gets the correct styles defined within the theme style variation.

More detailed instructions testing with the Assembler block theme can be found on the original Gutenberg PR. It also has some test block markup.

#2 @joemcgill
5 weeks ago

  • Keywords changed from gutenberg-merge has-patch has-unit-tests to gutenberg-merge, has-patch, has-unit-tests

#3 @peterwilsoncc
5 weeks ago

  • Owner set to peterwilsoncc
  • Resolution set to fixed
  • Status changed from new to closed

In 59802:

Global Styles: Improve sanitization of block variation styles.

Fixes an issue where block style variations containing inner block type and element styles would have those inner styles stripped when the user attempting to save Global Styles does not have the unfiltered_html capability.

Props aaronrobertshaw, mukesh27, andrewserong.
Fixes #62372.

Note: See TracTickets for help on using tickets.