Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#57093 closed defect (bug) (fixed)

Some HTML attributes are missing the esc_attr_e

Reported by: kowsar89 Owned by: SergeyBiryukov
Priority: normal Milestone: 6.2
Component: Administration Version:
Severity: normal Keywords: has-patch changes-requested
Cc: Focuses:

Description

I found two strings inside HTML attributes where escaping is missing. These should be escaped too, since strings inside HTML attributes are escaped everywhere.

wp-admin/nav-menus.php

<input type="button" class="deletion menu-items-delete disabled" value="<?php _e( 'Remove Selected Items' ); ?>">

wp-admin/widgets-form.php:

<input type="submit" name="removewidget" id="removewidget" class="button-link button-link-delete widget-control-remove" value="<?php _e( 'Delete' ); ?>" />

Attachments (2)

3612.patch​ (1.7 KB ) - added by riccardodicurti 4 years ago.
3612.2.diff​ (2.9 KB ) - added by riccardodicurti 4 years ago.

Download all attachments as: .zip

Change History (12)

This ticket was mentioned in ​PR #3612 on ​WordPress/wordpress-develop by ​kowsar89.


4 years ago
#1

  • Keywords has-patch added

#3 @SergeyBiryukov
4 years ago

  • Component General → Administration
  • Milestone Awaiting Review → 6.2

#4 @riccardodicurti
4 years ago

Hi, I have checked kowsar89’s code and uploaded the patch file here. I didn't find any other HTML attributes where escaping is missing.

#5 @SergeyBiryukov
4 years ago

Hi there, welcome back to WordPress Trac! Thanks for the ticket and the patch.

I think you're right, these should be escaped.

I have found one more instance that should be patched, see line 527 in wp-admin/includes/nav-menu.php​.

#6 @audrasjb
4 years ago

  • Keywords changes-requested added

Searching for ="<?php _e in the codebase, I only find 3 occurrences:

  • wp-admin/nav-menus.php: one occurrence, already addressed in PR3612
  • wp-admin/widget-form.php: one occurrence, already addressed in PR3612
  • wp-admin/includes/nav-menu.php: needs to be added to the PR

@riccardodicurti would you like to add a new patch with the missing occurrence? Thanks :)

#7 @kowsar89
4 years ago

I have updated the PR with the fix in file wp-admin/includes/nav-menu.php

#8 @krupalpanchal
4 years ago

  • Summary Some html attributes are missing the esc_attr_e → Some HTML attributes are missing the esc_attr_e

Yes, there are only 3 occurrences in the codebase. And those are updated in [PR 3612]​https://github.com/WordPress/wordpress-develop/pull/3612/.
PR LGTM

#9 @riccardodicurti
4 years ago

I also updated the patch here.

#10 @SergeyBiryukov
4 years ago

  • Owner set to SergeyBiryukov
  • Resolution → fixed
  • Status new → closed

In 54834:

Administration: Add missing escaping for a few strings used as HTML attributes.

Follow-up to [47209], [50997], [51006].

Props kowsar89, riccardodicurti, audrasjb, krupalpanchal, SergeyBiryukov.
Fixes #57093.

​@SergeyBiryukov commented on ​PR #3612:


4 years ago
#11

Thanks for the PR! Merged in r54834.

Note: See TracTickets for help on using tickets.