[wp-trac] [WordPress Trac] #58251: Escaping issue found while echoing attribute's dynamic value in html attribute.

WordPress Trac noreply at wordpress.org
Tue May 9 16:27:46 UTC 2023


#58251: Escaping issue found while echoing attribute's dynamic value in html
attribute.
---------------------------+-------------------------------
 Reporter:  madhusudandev  |       Owner:  (none)
     Type:  defect (bug)   |      Status:  new
 Priority:  normal         |   Milestone:  6.3
Component:  Toolbar        |     Version:
 Severity:  normal         |  Resolution:
 Keywords:  has-patch      |     Focuses:  coding-standards
---------------------------+-------------------------------
Changes (by sabernhardt):

 * keywords:  has-patch close => has-patch
 * milestone:  Awaiting Review => 6.3


Comment:

 Even if no functions are added, this will still need an update to the
 documentation.

 For the `id` attributes, `trim()` may not be very helpful on its own.
 Plugins are probably more likely to add a space in the middle of the
 string than at either end. I would consider having spaces //doing it
 wrong//, but the `add_node()` documentation does not (yet) explain any
 character restrictions for the ID string.

 I found two rather popular plugins that could benefit from
 `sanitize_title( trim( $node->id ) ) )`. Both use the `add_menu()` alias
 of `add_node()`, one using a
 [https://github.com/VisualComposer/builder/blob/e4a742181fd9f58d8a1eced28f1fc32d4befecbe/visualcomposer/Modules/Editors/EditPostLinks/Controller.php#L115
 translatable string] (which they already
 [https://github.com/VisualComposer/builder/pull/2243/files replaced on
 GitHub]) and the other [https://wordpress.org/support/topic/admin-toolbar-
 link-id-attribute/ starting with the hash character]. Checking dozens of
 other plugin search results, I did not find any additional plugins
 following either the
 [https://wpdirectory.net/search/01GZYYHDGRKRPBTJQ13J1VE6B4 translatable
 string pattern] or the
 [https://wpdirectory.net/search/01GZZ82P9SRT8YW2QBEK3JHT26 hash character
 pattern] for a toolbar link.

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


More information about the wp-trac mailing list