mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-30 17:11:20 -05:00
[GH-ISSUE #9211] /api/config route is open to the public exposing google client and api keys #118732
Reference in New Issue
Block a user
Originally created by @jamie1911 on GitHub (Feb 1, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/9211
Bug Report
Installation Method
Environment
Open WebUI Version: 0.5.7
Operating System: Ubuntu 24.04
Confirmation:
Expected Behavior:
If you curl the sites configuration while being an unauthenticated anonymous user, you get denied:
Actual Behavior:
Using an unauthenticated curl call, the sites configuration is dumped, specifically, the Google API client Id and API key:
Description
Bug Summary:
Looking at https://github.com/open-webui/open-webui/pull/7900 it seems the lines of code where this is introduced: https://github.com/open-webui/open-webui/blob/main/backend/open_webui/main.py#L1010-L1012
I'm wondering if a mistake was made and it should have been placed within the lines of: https://github.com/open-webui/open-webui/blob/main/backend/open_webui/main.py#L995-L1008
@tjbck commented on GitHub (Feb 1, 2025):
@taylorwilsdon
@taylorwilsdon commented on GitHub (Feb 3, 2025):
👀 let me take a look today!
@taylorwilsdon commented on GitHub (Feb 3, 2025):
Sorry about that, yeah it's basically as simple as just moving it into the authenticated block. For what it's worth, these are secrets in the loosest sense of the term - an oauth client ID & the key that allows the picker API to be invoked, but they're not providing access to any particular resource. The user must complete their own oauth flow and authorize the application to view their own files before access is in play.
developer-key(the "API_KEY" value here) is required for the picker API component and Google considers it acceptable to expose to non-admin users in the frontend so long as you strictly scope and restrict it in the Google Cloud console (for example, limiting allowed referrers to your domain and permitting access only to the specific API). This ensures that even if someone manages to extract the key, it won’t be usable outside your approved domains and services. PR to move inside authenticated block, I verified it continues to work as expected.https://github.com/open-webui/open-webui/pull/9287
@taylorwilsdon commented on GitHub (Feb 3, 2025):
PR #9287 will ensure only authenticated users can retrieve the Drive config items when merged
@jamie1911 commented on GitHub (Feb 3, 2025):
Thanks, that makes sense! While these are client-side secrets/keys, it does make sense to logically put them in the updated location as your https://github.com/open-webui/open-webui/pull/9287 has it.
@jamie1911 commented on GitHub (Feb 3, 2025):
I think some frontend code will need to be tweaked to support this, specifically from my glance at the code, https://github.com/taylorwilsdon/open-webui/blob/main/src/lib/utils/google-drive-picker.ts#L7-L13 . I believe the json path would now be different.
@taylorwilsdon commented on GitHub (Feb 3, 2025):
@jamie1911 no it's still returned in the same payload with the same key to access it, just doesn't get returned if you're not signed in now.
@jamie1911 commented on GitHub (Feb 3, 2025):
You're right, thanks!!