#62273 closed defect (bug) (fixed)
Referrer-Policy header missing in login
| Reported by: | kkmuffme | Owned by: | johnbillion |
|---|---|---|---|
| Priority: | normal | Milestone: | 6.8 |
| Component: | Login and Registration | Version: | 4.9 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
Description (last modified by )
[41741] from #42036 added the Referrer-Policy header on wp-admin and the login page.
However this does not (and from what I can see) has never worked on wp-login.
It's hooked to add_action( 'login_init', 'wp_admin_headers' ); but the wp_admin_headers function is not loaded on the login page, as only gets loaded in wp-admin.
@johnbillion
Attachments (1)
Change History (11)
#2
@
2 years ago
- Component Security → Login and Registration
- Keywords needs-patch added
- Severity critical → normal
#3
@
22 months ago
Hello @SergeyBiryukov , @johnbillion
Upon further investigation, I did find that the file https://github.com/WordPress/wordpress-develop/blob/trunk/src/wp-admin/includes/misc.php is not loaded when wp-login is loaded. So if we try to add the filter to a file that is loaded during wp-login, it would still not work.
I found that that https://github.com/WordPress/wordpress-develop/blob/trunk/src/wp-includes/functions.php gets loaded both for login and admin. We can move the wp_admin_headers() to this file and still have no issues. Then we can call the login_init filter in https://github.com/WordPress/wordpress-develop/blob/trunk/src/wp-includes/default-filters.php to set the headers.
#4
@
21 months ago
@kkmuffme so, are we looking for adding just the Referrer-Policy to login page or load all the admin headers added by wp_admin_headers() ?
#6
@
21 months ago
@aslamdoctor
That is a good question and it might be of interest going forwards. But it seems that this was intended to work as per #42036. So it should load the headers
#9
@
21 months ago
This would hopefully fix another bug:
If no referrer is sent (maybe because of a no-referrer header) the redirect on /wp-login.php?action=postpass does not work correctly. Overwriting the header would fix this. Correct?
#10
@
21 months ago
@zodiac1978 I don't believe this change will affect that behaviour. This referrer policy won't affect how wp-login.php can detect its own referrer, which is what I think you're asking.
If there isn't already a ticket for that bug, could you open one? Seem like it would be easily solved by adding hidden redirect_to field in get_the_password_form().
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
I concur that it looks like this has never worked on the login screen because admin-filters.php isn't loaded there and the
wp_admin_headers()function isn't loaded there either.