Make WordPress Core

Opened 17 months ago

Closed 16 months ago

Last modified 16 months ago

#48376 closed enhancement (fixed)

Update kses safecss_filter_attr function to allow gradient backgrounds

Reported by: jorgefilipecosta Owned by: SergeyBiryukov
Milestone: 5.3.1 Priority: normal
Severity: normal Version: 5.3
Component: Formatting Keywords: has-patch
Focuses: Cc:


Currently, our KSES rules remove gradient backgrounds from style attributes (on contributor roles).
The block editor is introducing a mechanism to allow users to create and use a custom background. If our KSES rules are not updated, only roles with unfiltered HTML permissions will take advantage of this functionality.
I think our KSES rules should be updated. URL backgrounds, for example, are accepted, given that's the case, I think gradients should also be accepted. Ultimately what one can do with gradient background one can do with a URL background.

Related block editor issue:

Related block editor PR's:

Attachments (1)

48376.diff (4.4 KB) - added by jorgefilipecosta 17 months ago.

Download all attachments as: .zip

Change History (7)

This ticket was mentioned in Slack in #core-editor by peterwilsoncc. View the logs.

17 months ago

#2 @jorgefilipecosta
17 months ago

As a test case, I did the following:
Logged as a contributor rule.
Opened code editor mode.
Pasted the following content:

<!-- wp:html -->
<div style="width: 100px;height: 100px;background: linear-gradient(red,yellow)"></div>
<!-- /wp:html -->

Submitted the post for review.
Reloaded the editor and verified the gradient was still being applied (without this patch, the gradient is removed).

GitHub PR where we can see the green CI light: https://github.com/WordPress/wordpress-develop/pull/110

#3 @SergeyBiryukov
17 months ago

  • Component changed from General to Formatting
  • Milestone changed from Awaiting Review to 5.3.1

This ticket was mentioned in Slack in #core by audrasjb. View the logs.

16 months ago

#5 @SergeyBiryukov
16 months ago

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

In 46793:

KSES: Add support for gradient backgrounds.

Props jorgefilipecosta.
Fixes #48376.

#6 @SergeyBiryukov
16 months ago

In 46794:

KSES: Add support for gradient backgrounds.

Props jorgefilipecosta.
Merges [46793] to the 5.3 branch.
Fixes #48376.

Note: See TracTickets for help on using tickets.