WebUI 2.0.3: why does logging out no longer revoke the OAuth tokens?

Your question

Hi,

I noticed that WebUI 2.0.3 changed the logout behaviour. The changelog says:

Logging out no longer revokes the OAuth tokens.

Commit 0697f8a0 removes the revokeSessionTokens() call from the logout button in TopBar.tsx, along with the code that stored the revocation_endpoint.

I couldn’t find an explanation in the commit or in an issue, so I’d like to understand the reason before upgrading:

  1. Why was this changed? Was revoking on logout causing a problem, for example with external identity providers?
  2. Does the server now invalidate the tokens some other way when a user logs out through the end-session endpoint, or do they stay valid until they expire?
  3. If they stay valid, is there a recommended way to get the 2.0.2 behaviour back, such as a setting?

My concern is that a stolen access or refresh token would keep working after the user has logged out, until it expires. For that reason I’m staying on 2.0.2 for now.

Thanks for your work on Stalwart!

I can’t tell you why the change was made. The docs and source I have access to don’t give a rationale for commit 0697f8a0, and I found no mention of an external identity provider problem. I also couldn’t find the changelog entry or TopBar.tsx in the files I searched.

Question 2: does the server invalidate tokens at logout? No. The docs say this about the end-session endpoint /auth/logout: “The endpoint revokes no tokens and ends no session on the server.” It only redirects the browser, and only to a post_logout_redirect_uri registered for the client. So tokens stay valid until something else deletes the grant or they expire. A relying party that wants real sign-out has to call the revocation endpoint (/auth/revoke, RFC 7009) itself. Revoking an access or refresh token deletes the whole grant it belongs to.

A grant is also deleted when:

  • the user removes the application under Connected Applications;
  • an administrator deletes the grant;
  • the account password changes, which invalidates every token of the account;
  • a superseded refresh token is presented;
  • the account is deleted.

Question 3: getting the 2.0.2 behaviour back. I found no setting for it. Your concern is valid in principle: a stolen token would keep working after a WebUI logout until it expires or the grant is removed. Two mitigations that follow from the docs are to delete the grant manually in Connected Applications or via an administrator, and to rely on the token lifetimes you configure. Staying on 2.0.2 is reasonable if you need revoke-on-logout. A staff member can say whether the removal was intentional.

Docs:

This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong.

Hi,

The change was deliberate. Revoking a token deletes the whole OAuth grant, and the grant is also what records the user’s consent, so with revocation on logout every new sign-in went back through the consent screen.

The server doesn’t invalidate anything at logout. The end-session endpoint only redirects the browser, so the tokens stay valid until they expire: an access token for accessTokenExpiry and a refresh token for refreshTokenExpiry since its last refresh (defaults are 1 hour and 30 days, see Lifetimes). The WebUI does wipe them from the browser, so your scenario needs a token that was stolen before the logout.

No setting brings the 2.0.2 behaviour back. If a token may have leaked, delete the session under Connected Applications, which kills its tokens right away, or change the password, which deletes every grant of the account. Lowering the two lifetimes on the OidcProvider object narrows the window for the rest (the minimums are 10 minutes and 1 day).

Most identity providers behave the same way. RP-Initiated Logout says nothing about tokens, Okta leaves access and refresh tokens valid after logout, and Auth0 refresh tokens can outlive it too.