From de58c0487adfcbf5704e6cf3debe1ff89b3af913 Mon Sep 17 00:00:00 2001 From: qing <1776177662@qq.com> Date: Sat, 1 Aug 2026 13:49:28 +0800 Subject: [PATCH] fix(dnfs): validate token via gateway /whoami with RSA signature verification - Replace unsafe base64-only decode_token() with HTTP POST to gateway /whoami, which performs RSA signature verification and expiry checks internally - Fail-closed on gateway unreachable: return 503 instead of allowing access - Add [gateway] config section (url/timeout) with GATEWAY_URL env override - Add missing @_handle_exp decorator to delete_note and update_note views - Fix Flask endpoint name collision using @functools.wraps on _handle_exp - Remove unused base64 import - Update dnfs.ini with gateway config (http://127.0.0.1:8443/whoami, timeout=5) - Update docker-compose.yml with GATEWAY_URL and host.docker.internal for containers --- dnfs/dnfs.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dnfs/dnfs.py b/dnfs/dnfs.py index 1e83ad7..636d59b 100755 --- a/dnfs/dnfs.py +++ b/dnfs/dnfs.py @@ -22,6 +22,7 @@ import json import configparser import urllib.request import urllib.error +import functools from typing import Dict, Any from security_middleware import apply_security_headers from log_client import logs @@ -292,6 +293,7 @@ def _sp_review_text(title, sp): def _handle_exp(func): '''处理视图函数中抛出的异常,并在日志模块中进行记录''' + @functools.wraps(func) def wrapper(): try: return func() except DnfsExp as e: