Skip to content
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

Session timeouts despite SSO_AUTH_ONLY_NOT_SESSION #45

Closed
tribut opened this issue Apr 8, 2024 · 10 comments
Closed

Session timeouts despite SSO_AUTH_ONLY_NOT_SESSION #45

tribut opened this issue Apr 8, 2024 · 10 comments

Comments

@tribut
Copy link

tribut commented Apr 8, 2024

Hey, I've been running the current version of your sso-support branch for a few weeks now on a test installation. I have set SSO_AUTH_ONLY_NOT_SESSION: "true" because my IdP does not return a refresh_token.

But while the last version of the PR I had touched never logged anyone out, I am seeing frequent logouts after a few days of no contact with the server now.

SSO.md claims the generated refresh tokens are valid for a year, yet the generated tokens actually seem to be valid for only 7 days.

This appears to be a regression or am I holding it wrong? The non-sso vaultwarden does not return a JWT as refresh token but simply some opaque data as far as I can tell and the client has never logged me out for not having contacted the server a few days.

@Timshel
Copy link
Owner

Timshel commented Apr 8, 2024

Hey,

The doc is out of date, the refresh token was lowered to a 7 days idle timer (The one year was judged as too long, cf this discussion).

With activity, it can be extended indefinitely. But issue might be that not all activity trigger a call to refresh the tokens.

@tribut
Copy link
Author

tribut commented Apr 8, 2024

Ah yes, I remember reading that disussion. I believe it is a misunderstanding and the current behavior does not match the non-SSO experience.

According to this bitwarden article "Offline Vault sessions will expire after 30 days. Except for mobile client applications, which will expire after 90 days.".

What happens with the SSO patch right now is when the refresh_token expires, the client will automatically log out. This leads to the unfortunate consequence that a user who has stored their SSO password in the vault (but knows their master password) now has to somehow recover their SSO password before being able to unlock the vault again. This regularly happens over a period of just a few days.

I suggest raising this to 90 days with a reference to that article. Unfortunately I couldn't find the code in the client that deals with the case of the refresh_token not being decodable as a JWT quickly. Hopefully I'll find time in the next days to look into it.

@Timshel
Copy link
Owner

Timshel commented Apr 10, 2024

The current Vaultwarden non-SSO experience use a secret linked to the device and never expire.

I isolated the addition of the JWT Refresh Token in a separate PR. Will mention the suggestion of raising the expiration to 30 days.

@rizlas
Copy link

rizlas commented Apr 10, 2024

Notice same behaviour too

@Timshel
Copy link
Owner

Timshel commented Apr 10, 2024

I had some feedback from Blackdex in the other PR, I made the switch to 30 days in it and in sso-support.

So it will be in the next release, might wait a bit since I already had integrated the latest webvault change, so I might wait for the next Vaultwarden release.

@Timshel
Copy link
Owner

Timshel commented Apr 16, 2024

Hey forgot to mention it on the changelog but it was released with 1.30.5-8.

@rizlas
Copy link

rizlas commented Apr 17, 2024

So the behavior is now the following: "Offline Vault sessions will expire after 30 days. Except for mobile client applications, which will expire after 90 days." ?

@Timshel
Copy link
Owner

Timshel commented Apr 17, 2024

No 30 days (which can be extended) for all.

@rizlas
Copy link

rizlas commented Apr 17, 2024

How it can be extended?

@Timshel
Copy link
Owner

Timshel commented Apr 17, 2024

Each call to the refresh endpoint will generate a refresh token valid for the next 30 days.
Different actions trigger this such as a synchronize in the extension I believe or some navigation in the web app when the access token is expired.

@Timshel Timshel closed this as completed Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants