-
-
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(session): Set last-password-confirm for token logins #43034
fix(session): Set last-password-confirm for token logins #43034
Conversation
/backport to stable28 |
/backport to stable27 |
/backport to stable26 |
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.
Honestly not sure if this is what password confirmation protected endpoints were designed for.
Is there anything preventing session tokens to be used as app passwords to work around password confirmation?
If you only have session cookies then you are missing the Authorization header and the method will return false before running the added line. |
I mean someone intentionally sending the session token as auth header to bypass password protection when they acquired a user session but don't know the password |
Hm, I didn't know you could do that. @nickvergessen do you have an idea if this is a problem? |
How does Github handle it with their sudo mode? Are operations protected by that accessible via API? |
Using an app password is completely fine, since you can already workaround this limitation by using basic auth with the app password as the password (and if you don't know the username you can get it from an endpoint that doesn't require password auth. |
We might want to move the cookie check before the token check and always early return if the cookie is set so the token login is never tried: Lines 1145 to 1153 in 5940161
|
https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/sudo-mode is what I'm referring to. I am not sure if an app password or session token qualifies as enough proof for sensitive operations that require the user password in a web session. |
I somewhat agree, but as I said it is already possible to workaround this limitation, even if you only have an app password. |
how? |
I don't know, but I know it works because I've used it already many times. |
I've tested using a new app token for bearer auth against a controller method protected with {"message":"Password confirmation is required"}
it is only bypassable on this branch, not on master. |
Signed-off-by: provokateurin <[email protected]>
8af28c0
to
7815741
Compare
I always thought this behavior was intended since we already get a lot of requests from clients who are afraid to use app_password. Imagine the situation: You create an application password for the file sync client and you are an administrator. Do you have any thoughts on this @nickvergessen as you already accepted it? |
I see your point. I was talking to @ChristophWurst the other day and brought up the idea again that it should just be possible to do the actual password confirmation when you only have an app password: #43000 |
Yeah I think that makes sense. I missed somehow that you only have an app password and not the real password. |
Closing in favor of #43000 |
Summary
This allows using app passwords for endpoints which require password confirmation. Unlike previous investigations suggested this fixes it regardless of the cookies.
For history: #43000
Checklist