fix: guard SQLite int(sub) against large OAuth subs (closes #29048) - #29056
Closed
lesbass wants to merge 1 commit into
Closed
fix: guard SQLite int(sub) against large OAuth subs (closes #29048)#29056lesbass wants to merge 1 commit into
lesbass wants to merge 1 commit into
Conversation
…i#29048) Google's 21-digit sub overflows SQLite's signed 64-bit INTEGER when SQLAlchemy binds int(sub). Add a len(sub) <= 18 guard so the int comparison path is only used for subs that fit in 64 bits. Small numeric subs (e.g. GitHub IDs) still get the int path; Postgres is unaffected.
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Google OAuth login fails on SQLite with
Python int too large to convert to SQLite INTEGERbecause Google's 21-digitsubclaim exceeds SQLite's signed 64-bit INTEGER range (~9.2e18). Theget_user_by_oauth_sub()method unconditionally callsint(sub)for any decimal SQLite sub, causing anOverflowErrorduring SQLAlchemy query binding.Fix
Added a
len(sub) <= 18guard to the SQLiteint(sub)path inbackend/open_webui/models/users.py:369. This ensures:int()conversionint()comparison for type-matching against stored JSON numericsVerification
Related
Changelog Entry
Fixed
subclaimContributor License Agreement