feat(dnfs): delegate Token verification to gateway /whoami

Replace the insecure local base64 decode (with FIXME comment about
missing signature verification) with proper remote RSA signature
verification through gateway's /whoami endpoint:

- Add [gateway] config section (url, timeout) to dnfs.ini with defaults.
- Support GATEWAY_URL environment variable override for Docker.
- decode_token() now POSTs to gateway /whoami with Authorization: Bearer
  <token>; gateway verifies RSA signature and expiry, returns login/user/
  is_admin. Network/gateway errors fail-closed with 503.
- Add @_handle_exp decorators to delete_note() and update_note() which
  were missing exception handling wrappers (consistent with other routes).
- docker-compose.yml: add GATEWAY_URL, CONFS_HOST, CONFS_PORT env vars
  plus host.docker.internal extra_hosts so dnfs container can reach
  host-side gateway and confs services.
This commit is contained in:
qing committed 2026-08-01 13:42:59 +08:00
1 parent 7d6ba6de93
commit e7a2877422
3 files changed
+58 -11

No files matched your search

+4
View File
@@ -10,3 +10,7 @@ timeout = 10
[ai_review]
url = http://127.0.0.1:8007/review
timeout = 10
[gateway]
url = http://127.0.0.1:8443/whoami
timeout = 5