Skip to content

Commit 2adec31

Browse files
committed
Security: Set the HttpOnly flag for the test cookie and the wp_lang cookie on the login screen.
These cookies are only accessed server-side and don't need to be exposed to JavaScript in the browser. Props earthman100, kevinlearynet Fixes #61322 git-svn-id: https://develop.svn.wordpress.org/trunk@59671 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 4b89ebe commit 2adec31

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/wp-login.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -528,14 +528,14 @@ function wp_login_viewport_meta() {
528528

529529
// Set a cookie now to see if they are supported by the browser.
530530
$secure = ( 'https' === parse_url( wp_login_url(), PHP_URL_SCHEME ) );
531-
setcookie( TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN, $secure );
531+
setcookie( TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN, $secure, true );
532532

533533
if ( SITECOOKIEPATH !== COOKIEPATH ) {
534-
setcookie( TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN, $secure );
534+
setcookie( TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN, $secure, true );
535535
}
536536

537537
if ( isset( $_GET['wp_lang'] ) ) {
538-
setcookie( 'wp_lang', sanitize_text_field( $_GET['wp_lang'] ), 0, COOKIEPATH, COOKIE_DOMAIN, $secure );
538+
setcookie( 'wp_lang', sanitize_text_field( $_GET['wp_lang'] ), 0, COOKIEPATH, COOKIE_DOMAIN, $secure, true );
539539
}
540540

541541
/**

0 commit comments

Comments
 (0)