Make WordPress Core

Opened 3 months ago

Last modified 3 months ago

#62798 new defect (bug)

Twenty Seventeen: sanitize output of twentyseventeen_custom_colors_css()

Reported by: viralsampat's profile viralsampat Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Bundled Theme Keywords: dev-feedback needs-testing has-patch
Focuses: coding-standards Cc:

Description

Hello Team,

I have checked WordPress fork and found PHPCS Warning in functions.php file for "TwentySeventeen" theme.

i.e

All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found 'twentyseventeen_custom_colors_css'.

<style type="text/css" id="custom-theme-colors" <?php echo $customize_preview_data_hue; ?>>
	<?php echo twentyseventeen_custom_colors_css(); ?>
</style>

Note: I have checked the core trac and found the similar issue. #62787

Thanks,

Change History (3)

#1 @viralsampat
3 months ago

Hello Team,

I have added its PR, Please review it: PRhttps://github.com/WordPress/wordpress-develop/pull/8108

Thanks,

This ticket was mentioned in PR #8108 on WordPress/wordpress-develop by @mdviralsampat.


3 months ago
#2

  • Keywords has-patch added

Trac ticket: https://core.trac.wordpress.org/ticket/62798

This PR adds proper sanitization to the custom colors CSS output in the Twenty Seventeen theme. The twentyseventeen_custom_colors_css() function's output is filterable and currently outputs unsanitized content.

The PR wraps outputs with wp_strip_all_tags() to ensure only CSS is included, preventing potential injection of unwanted HTML through filters.

Thanks,

This ticket was mentioned in PR #8115 on WordPress/wordpress-develop by @mdviralsampat.


3 months ago
#3

Trac ticket: https://core.trac.wordpress.org/ticket/62798

This PR adds proper sanitization to the custom colors CSS output in the Twenty Seventeen theme. The twentyseventeen_custom_colors_css() function's output is filterable and currently outputs unsanitized content.

The PR wraps outputs with wp_strip_all_tags() to ensure only CSS is included, preventing potential injection of unwanted HTML through filters.

Thanks,

Note: See TracTickets for help on using tickets.