Skip to content

Commit a1440ae

Browse files
committed
Security: Remove use of innerHTML in the the_block_template_skip_link() function.
There is no need to support HTML in this string and switching to `innerText` helps facilitate a more restrictive Content Security Policy. Props micromadness, sabernhardt Fixes #58765 git-svn-id: https://develop.svn.wordpress.org/trunk@59831 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 315cd6d commit a1440ae

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/wp-includes/theme-templates.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ function wp_enqueue_block_template_skip_link() {
205205
skipLink.classList.add( 'skip-link', 'screen-reader-text' );
206206
skipLink.id = 'wp-skip-link';
207207
skipLink.href = '#' + skipLinkTargetID;
208-
skipLink.innerHTML = '<?php /* translators: Hidden accessibility text. */ esc_html_e( 'Skip to content' ); ?>';
208+
skipLink.innerText = '<?php /* translators: Hidden accessibility text. Do not use HTML entities (&nbsp;, etc.). */ esc_html_e( 'Skip to content' ); ?>';
209209

210210
// Inject the skip link.
211211
sibling.parentElement.insertBefore( skipLink, sibling );

0 commit comments

Comments
 (0)