Make WordPress Core

Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#48376 closed enhancement (fixed)

Update kses safecss_filter_attr function to allow gradient backgrounds

Reported by: jorgefilipecosta's profile jorgefilipecosta Owned by: sergeybiryukov's profile 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 4 years ago.

Download all attachments as: .zip

Change History (7)

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

4 years ago

#2 @jorgefilipecosta
4 years 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:

#3 @SergeyBiryukov
4 years 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.

4 years ago

#5 @SergeyBiryukov
3 years 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
3 years 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.