Skip to content

Commit

Permalink
Merge pull request open-webui#8131 from open-webui/dev
Browse files Browse the repository at this point in the history
fix: api key restrictions
  • Loading branch information
tjbck authored Dec 27, 2024
2 parents 4e4e279 + 99386bf commit 2299f48
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions backend/open_webui/utils/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,12 @@ def get_current_user(
status.HTTP_403_FORBIDDEN, detail=ERROR_MESSAGES.API_KEY_NOT_ALLOWED
)

if request.app.state.ENABLE_API_KEY_ENDPOINT_RESTRICTIONS:
if request.app.state.config.ENABLE_API_KEY_ENDPOINT_RESTRICTIONS:
allowed_paths = [
path.strip()
for path in str(request.app.state.API_KEY_ALLOWED_PATHS).split(",")
for path in str(request.app.state.config.API_KEY_ALLOWED_PATHS).split(
","
)
]

if request.url.path not in allowed_paths:
Expand Down

0 comments on commit 2299f48

Please sign in to comment.