-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
redirect to admin login page when forward fails #2886
redirect to admin login page when forward fails #2886
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
039f36d
to
44ad2bc
Compare
I'm not sure if this will work as nicely. Maybe the Request Guard should be change somehow, or we need to add extra functions which do not contain the The Now, I don't know if we are able to extract the registered routes, and match that within one single function, and based upon that either redirect to the admin login page, or return a 404. I haven't looked into it. |
Also, something that just popped up into my mind. Maybe, we could just show the login page on the |
This comment was marked as resolved.
This comment was marked as resolved.
ec261a8
to
857246d
Compare
857246d
to
3caf30c
Compare
This comment was marked as resolved.
This comment was marked as resolved.
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.
I haven't tested this my self yet.
So, no clue how this is working out, and if there are other ways on handling this.
But using a _
for a variable as a parameter is not that nice i think, only because Rust will complain if you are not using it, i think there is an other way, but not from the top of my head.
fbdc849
to
24f30dc
Compare
While cleaning up my commit I noticed that the statement Lines 121 to 123 in 7a76731
URI-references and thus also relative URIs in the Location header.
As explained by this rejected errata the use of relative URIs is intended and "accurately reflects real-world usage" so I think it's fine to go back to using |
MDN Also indicates the same: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location |
f4e84d2
to
dade9cb
Compare
Okay, I've squashed everything into a single commit because I think I'm done. |
Hmm, this will break scripts which use the admin to modify users and orgs etc.. I'm playing with it my self right now, and I think i have a nice solution. But unfortunately no time left today to continue working it out. Basically, it kinda reverts almost everything, except the |
currently, if the admin guard fails the user will get a 404 page. and when the session times out after 20 minutes post methods will give the reason "undefined" as a response while generating the support string will fail without any user feedback. this commit changes the error handling on admin pages * by removing the reliance on Rockets forwarding and making the login page an explicit route that can be redirected to from all admin pages * by removing the obsolete and mostly unused Referer struct we can redirect the user back to the requested admin page directley * by providing an error message for json requests the `get_diagnostics_config` and all post methods can return a more comprehensible message and the user can be alerted * the `admin_url()` function can be simplified because rfc2616 has been obsoleted by rfc7231 in 2014 (and also by the recently released rfc9110) which allows relative urls in the Location header. c.f. https://www.rfc-editor.org/rfc/rfc7231#section-7.1.2 and https://www.rfc-editor.org/rfc/rfc9110#section-10.2.2
dade9cb
to
635e8e6
Compare
revert some changes and also rename catcher to `admin_login` to make its function clearer Co-authored-by: BlackDex <black.dex@gmail.com>
635e8e6
to
0aa33a2
Compare
Currently, if the admin guard fails the user will get a 404 page instead of being forwarded to the login page.
This change addresses issues like #2880 and #2883 by implementing a default forward catcher for all admin pages so this comment is correct:
vaultwarden/src/api/admin.rs
Line 656 in f60a692