From 9a18911ebae5a97b83b3c55caa6a035bc0085f7f Mon Sep 17 00:00:00 2001 From: Yongtao Huang Date: Mon, 25 Aug 2025 09:28:10 +0800 Subject: [PATCH] Fix auth error handling (#24420) Signed-off-by: Yongtao Huang Co-authored-by: Yongtao Huang <99629139+hyongtao-db@users.noreply.github.com> --- api/controllers/web/app.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/api/controllers/web/app.py b/api/controllers/web/app.py index 5fdc3e8f1..068090363 100644 --- a/api/controllers/web/app.py +++ b/api/controllers/web/app.py @@ -1,3 +1,5 @@ +import logging + from flask import request from flask_restx import Resource, marshal_with, reqparse from werkzeug.exceptions import Unauthorized @@ -87,8 +89,11 @@ class AppWebAuthPermission(Resource): decoded = PassportService().verify(tk) user_id = decoded.get("user_id", "visitor") - except Exception as e: - pass + except Unauthorized: + raise + except Exception: + logging.exception("Unexpected error during auth verification") + raise features = FeatureService.get_system_features() if not features.webapp_auth.enabled: