[wp-trac] [WordPress Trac] #33121: wp_kses_attr_check fails to process html data-* attributes

WordPress Trac noreply at wordpress.org
Thu Oct 11 03:29:56 UTC 2018


#33121: wp_kses_attr_check fails to process html data-* attributes
--------------------------------------+-----------------------
 Reporter:  isoftware                 |       Owner:  (none)
     Type:  defect (bug)              |      Status:  reopened
 Priority:  normal                    |   Milestone:  5.0
Component:  Editor                    |     Version:  4.2.3
 Severity:  major                     |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+-----------------------
Changes (by peterwilsoncc):

 * keywords:  needs-unit-tests has-patch => has-patch has-unit-tests


Comment:

 In [attachment:"33121.3.diff"] I've taken a quite different approach:

 * Removed hard coding of `data-` prefix, any wildcard can be added in
 `_wp_add_global_attributes()`.
 * Wildcard checks are only run if the full attribute doesn't exist in
 `$allowed_attr`
 * Added in a couple of unit tests
 * Regardless of approach, `test_wp_kses_attr_data_attribute_is_allowed()`
 should be a valid test.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/33121#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list