Opened 2 months ago
Last modified 7 weeks ago
#64280 new defect (bug)
Unable to change the lightbox settings of the Image block within Global Styles when KSES is active
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | 7.0 | Priority: | normal |
| Severity: | normal | Version: | 6.4 |
| Component: | Themes | Keywords: | has-patch has-unit-tests gutenberg-merge |
| Focuses: | Cc: |
Description
This ticket corresponds to the bug report in https://github.com/WordPress/gutenberg/issues/73157
When KSES filters are active (via add_action( 'init', 'kses_init_filters' )), valid non-preset settings in Global Styles are being incorrectly filtered out. Specifically:
lightbox.enabledandlightbox.allowEditingfor Image blocks
The issue occurs because remove_insecure_settings() only preserved:
- Presets (from
PRESETS_METADATA) - Indirect CSS properties (from
INDIRECT_PROPERTIES_METADATA)
Step-by-step reproduction instructions
- Enable the KSES filters with add_action( 'init', 'kses_init_filters' );
- Go to Appearance > Editor
- Open the Styles sidebar
- Select "Blocks"
- Select "Image"
- Change the "Enlarge on click" options
- Save the changes
⚠️ Note how the changes are reverted
Change History (6)
This ticket was mentioned in PR #10534 on WordPress/wordpress-develop by @ramonopoly.
2 months ago
#1
#3
@
7 weeks ago
- Milestone changed from Awaiting Review to 7.0
Was this introduced in trunk (6.9)
Are you asking which milestone this should be?
I've updated it to 7.0. The bug has been around for eons. See:
https://github.com/WordPress/gutenberg/pull/73452#issuecomment-3562566719
#4
@
7 weeks ago
Oh, I see it's filed under trunk which I thought means that it's introduced in the current unreleased version.
#5
@
7 weeks ago
- Version changed from trunk to 6.4
Oh, I see it's filed under trunk which I thought means that it's introduced in the current unreleased version.
Oh, that is a very good point.
I think the bug was introduced in 6.4!
https://github.com/WordPress/gutenberg/pull/54509
So the "version" is the affected version. https://make.wordpress.org/core/handbook/contribute/trac/
I get it. I can update.
Thanks for checking.
A PR to sync https://github.com/WordPress/gutenberg/pull/73452
## Problem
When KSES filters are active (via
add_action( 'init', 'kses_init_filters' )), valid non-preset settings in Global Styles are being incorrectly filtered out. Specifically:lightbox.enabledandlightbox.allowEditingfor Image blocksThe issue occurs because
remove_insecure_settings()only preserved:PRESETS_METADATA)INDIRECT_PROPERTIES_METADATA)All other valid settings were being stripped, even though they're defined in
VALID_SETTINGSand are safe scalar values or arrays.Related Issue: https://github.com/WordPress/gutenberg/issues/73157
## Solution
Added a new
preserve_valid_settings()method andSAFE_SETTINGSconst that work to preserves valid settings.## Testing Instructions
### Manual Testing
add_action( 'init', 'kses_init_filters' );Trac ticket: https://core.trac.wordpress.org/ticket/64280