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
This commit is contained in:
1 parent
e7a2877422
commit
de58c0487a
1 file changed
+2
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user