-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(settings): define a 'heartbeat' route, so SecurityHeaders can handle redirected root #45228
Conversation
…dle redirected root Signed-off-by: Steve Mokris <steve@kosada.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to add a test to the setup checks that validates that the check now works.
TBH I've never seen this warning on my local dev instance, can you tell me how to reproduce it? |
I cannot tell if adding a route like this is the right fix for this. The heartbeat short circuits a lot of things so it cannot be put in a controller. |
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! |
Hello,
Applying this change fixed the issue. Setup to reproduce: run the docker image as mentioned in the docs with version 29, and go to the page /settings/admin/overview |
Added a link to issue #44234 since this is a potential fix for that. |
Co-authored-by: Kate <26026535+provokateurin@users.noreply.github.com> Signed-off-by: Côme Chilliet <91878298+come-nc@users.noreply.github.com>
/backport to stable29 |
/backport to stable28 |
Thanks for your first pull request and welcome to the community! Feel free to keep them coming! If you are looking for issues to tackle then have a look at this selection: https://github.com/nextcloud/server/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22 |
I've upgraded to 29.0.3 and I still see the error in the log: "Unable to generate a URL for the named route "heartbeat" as such route does not exist." |
That's because it's scheduled for the upcoming maintenance release via #45956 |
Problem
On sites where the root (
/
) path is redirected (e.g. when using the Social login plugin), the Admin Overview page incorrectly shows errors about security headers not being set:Analysis
In
lib/base.php
, the request path/heartbeat
is handled specially by returning early, but no formal route is defined for it.OCA\Settings\SetupChecks\SecurityHeaders
callsURLGenerator::linkToRoute('heartbeat')
, but the generated URL is emptystring, since there's no route defined by that name.It then performs a request on the root (
/
) path (instead of the expected/heartbeat
path). On sites where the root path redirects,SecurityHeaders
then incorrectly analyzes the headers of the redirect, instead of analyzing the headers of the Nextcloud heartbeat page.Proposed solution
Define a
heartbeat
route, so thatURLGenerator::linkToRoute('heartbeat')
returns/heartbeat
as theSecurityHeaders
test seems to expect.Checklist