Repository navigation
fix(login): log when a login flow has expired - #1538
technophile77 wants to merge 1 commit into
Conversation
An expired login flow returns a generic "Access forbidden" page and writes nothing at all to the log - there is no logger call anywhere in this branch. An administrator therefore cannot distinguish an expired flow from any other cause of the same page, and the failure is invisible even at debug level. Log it at warning, reporting both the age of the flow and the timeout it exceeded, so it is clear whether users are genuinely running out of time at the identity provider - a slow sign-in, a password reset, two-factor - or LOGIN_FLOW_TIMEOUT is simply too short for the deployment. Behaviour is otherwise unchanged: same status, same message, same cleanup. Signed-off-by: Alex Cresswell <alex@cresswell.org>
|
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! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
Problem
When a login flow exceeds
LOGIN_FLOW_TIMEOUT,LoginController::code()returns a generic "Access forbidden" page and writes nothing at all to the log:There is no
->warning(), no->debug()— no logger call in the branch at all. The failure is therefore invisible even with the log level turned all the way down, and an administrator has no way to tell an expired flow apart from any other cause of the same page.Why it matters
The 300-second budget has to cover the user's entire interaction with the identity provider, not just a redirect round trip. A user who needs to reset a password, complete two-factor, or is simply interrupted can exceed it — and all they get is "Access forbidden", with nothing on the server to explain it.
Verified on a production instance. I armed a login flow, let it age past the timeout, then completed the callback:
Zero log lines, before and after. As a control, the identical request with the identical (bogus) code at age 0s instead produced
Failed to contact the OIDC provider token endpoint— so the only variable is elapsed time, and it silently changes which branch you land in.The change
Log at
warning, reporting both the age of the flow and the timeout it exceeded:Reporting both numbers is deliberate. It answers the question an administrator actually has when they see this: are my users genuinely running out of time at the IdP, or is
LOGIN_FLOW_TIMEOUTtoo short for my deployment? An age of 305s means something very different from an age of 4000s, and neither is distinguishable today.Behaviour is otherwise unchanged — same status, same message, same cleanup, no new configuration.
$loginFlowAgeis extracted only so the value can be logged without recomputing it.warningrather thandebugbecause this is a failed authentication attempt that the user sees, and it should be visible at the default log level.