Skip to content

Commit 0479ab3

Browse files
committed
HTML API: Run URL attributes through esc_url().
Props dmsnell, xknown, jorbin, gziolo. git-svn-id: https://develop.svn.wordpress.org/trunk@58472 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 5f269d3 commit 0479ab3

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/wp-includes/html-api/class-wp-html-tag-processor.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2972,8 +2972,16 @@ public function set_attribute( $name, $value ) {
29722972
if ( true === $value ) {
29732973
$updated_attribute = $name;
29742974
} else {
2975+
$tag_name = $this->get_tag();
2976+
$comparable_name = strtolower( $name );
2977+
2978+
/*
2979+
* Escape URL attributes.
2980+
*
2981+
* @see https://html.spec.whatwg.org/#attributes-3
2982+
*/
29752983
$escaped_new_value = esc_attr( $value );
2976-
$updated_attribute = "{$name}=\"{$escaped_new_value}\"";
2984+
$updated_attribute = wp_kses_one_attr( "{$comparable_name}=\"{$escaped_new_value}\"", $tag_name );
29772985
}
29782986

29792987
/*

0 commit comments

Comments
 (0)