[PR #23622] [CLOSED] fix: add DB-backed token revocation fallback when Redis is absent #130947

Closed
opened 2026-05-21 15:47:29 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/23622
Author: @Classic298
Created: 4/12/2026
Status: Closed

Base: devHead: fix/token-revocation-without-redis


📝 Commits (1)

  • b87aae3 fix: add DB-backed token revocation fallback when Redis is absent

📊 Changes

5 files changed (+95 additions, -11 deletions)

View changed files

backend/open_webui/migrations/versions/c66045cb0f67_add_user_token_version_column.py (+29 -0)
📝 backend/open_webui/models/users.py (+19 -0)
📝 backend/open_webui/routers/auths.py (+12 -3)
📝 backend/open_webui/utils/auth.py (+26 -2)
📝 backend/open_webui/utils/oauth.py (+9 -6)

📄 Description

Add a token_version counter to the User model that gets embedded in JWTs and checked on every request. When Redis is not configured, sign-out and password change now increment token_version in the DB, causing all previously issued tokens to be rejected.

Changes:

  • User model: add token_version column (BigInteger, default 0)
  • auth.py: is_valid_token checks token_version against DB when no Redis
  • auth.py: invalidate_token increments token_version when no Redis
  • auths.py: embed token_version in JWT at all token creation points
  • auths.py: password change now invalidates prior tokens
  • oauth.py: embed token_version in OAuth callback JWT
  • oauth.py: back-channel logout uses token_version when no Redis
  • Migration: add token_version column to user table

Contributor License Agreement

Note

Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/23622 **Author:** [@Classic298](https://github.com/Classic298) **Created:** 4/12/2026 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `fix/token-revocation-without-redis` --- ### 📝 Commits (1) - [`b87aae3`](https://github.com/open-webui/open-webui/commit/b87aae361b4fba7ed4b2b0638336fdf21b5d1153) fix: add DB-backed token revocation fallback when Redis is absent ### 📊 Changes **5 files changed** (+95 additions, -11 deletions) <details> <summary>View changed files</summary> ➕ `backend/open_webui/migrations/versions/c66045cb0f67_add_user_token_version_column.py` (+29 -0) 📝 `backend/open_webui/models/users.py` (+19 -0) 📝 `backend/open_webui/routers/auths.py` (+12 -3) 📝 `backend/open_webui/utils/auth.py` (+26 -2) 📝 `backend/open_webui/utils/oauth.py` (+9 -6) </details> ### 📄 Description Add a token_version counter to the User model that gets embedded in JWTs and checked on every request. When Redis is not configured, sign-out and password change now increment token_version in the DB, causing all previously issued tokens to be rejected. Changes: - User model: add token_version column (BigInteger, default 0) - auth.py: is_valid_token checks token_version against DB when no Redis - auth.py: invalidate_token increments token_version when no Redis - auths.py: embed token_version in JWT at all token creation points - auths.py: password change now invalidates prior tokens - oauth.py: embed token_version in OAuth callback JWT - oauth.py: back-channel logout uses token_version when no Redis - Migration: add token_version column to user table ### Contributor License Agreement <!-- 🚨 DO NOT DELETE THE TEXT BELOW 🚨 Keep the "Contributor License Agreement" confirmation text intact. Deleting it will trigger the CLA-Bot to INVALIDATE your PR. Your PR will NOT be reviewed or merged until you check the box below confirming that you have read and agree to the terms of the CLA. --> - [X] By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. > [!NOTE] > Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-21 15:47:29 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#130947