WordPress.org

Make WordPress Core

Opened 7 weeks ago

Closed 10 days ago

Last modified 10 days 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:
PR Number:

Description

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:
https://github.com/WordPress/gutenberg/issues/17938

Related block editor PR's:
https://github.com/WordPress/gutenberg/pull/17603
https://github.com/WordPress/gutenberg/pull/18001

Attachments (1)

48376.diff (4.4 KB) - added by jorgefilipecosta 7 weeks ago.

Download all attachments as: .zip

Change History (7)

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


7 weeks ago

#2 @jorgefilipecosta
7 weeks 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
7 weeks 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.


2 weeks ago

#5 @SergeyBiryukov
10 days 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
10 days 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.