#54277 closed defect (bug) (fixed)
values within loop should be escaped properly before echo `wp-admin/theme-install.php`
| Reported by: | sabbirshouvo | Owned by: | SergeyBiryukov |
|---|---|---|---|
| Priority: | normal | Milestone: | 5.9 |
| Component: | Themes | Version: | |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: | coding-standards |
Description
In wp-admin/theme-install.php line 232 $feature_name is not escaped properly before echo the value. It should be escaped. In a similar scenario in file wp-admin/includes/theme-install.php same variable is escaped with esc_html( )
Attachments (3)
Change History (12)
#2
in reply to: ↑ 1
@
5 years ago
Replying to afragen:
Since it’s a variable, shouldn’t that be
esc_attr()?
I've used wp-admin/includes/theme-install.php line 149 as a reference.
#3
@
5 years ago
- Version trunk
Using esc_html() would be appropriate for the label text; the category name's variable is escaped the same way for the legend tag on line 226.
Side note: I got confused by both variables named $feature_name because the first foreach loop refers to the feature category name. Could we change that variable to $category_name (or something similar)?
#4
@
5 years ago
Can we use escaped value directly instead of set variable for the escape value then use for print?
$feature_category = esc_html( $feature_category ); echo '<legend>' . $feature_category . '</legend>';
Should be
echo '<legend>' . esc_html( $feature_category ) . '</legend>';
#5
@
5 years ago
Actually, my original patch is for the next two variables. The variable $feature_name was not properly escaped. And your suggestion looks good too. Should I make changes to my patch? @mukesh27
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
escape
$feature_nameusingesc_html()