소스 검색

Fix API_KEY_ALLOWED_ENDPOINTS

Juan Calderon-Perez 4 달 전
부모
커밋
1c57e3e02c
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. 5 1
      backend/open_webui/utils/auth.py

+ 5 - 1
backend/open_webui/utils/auth.py

@@ -182,7 +182,11 @@ def get_current_user(
                 ).split(",")
             ]
 
-            if request.url.path not in allowed_paths:
+            # Check if the request path matches any allowed endpoint.
+            if not any(
+                request.url.path == allowed or request.url.path.startswith(allowed + "/")
+                for allowed in allowed_paths
+            ):
                 raise HTTPException(
                     status.HTTP_403_FORBIDDEN, detail=ERROR_MESSAGES.API_KEY_NOT_ALLOWED
                 )