merge: integrate feat/auth into develop

This commit is contained in:
Winnie
2026-08-03 17:44:00 +08:00
38 changed files with 2590 additions and 796 deletions
+28
View File
@@ -43,6 +43,18 @@ server {
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# Explicitly forward the session cookie set by
# POST /api/v1/auth/login. nginx forwards it by default, but
# spelling it out keeps the auth contract visible.
proxy_set_header Cookie $http_cookie;
# Defense in depth: blank out the legacy identity headers so a
# malicious client cannot bypass the cookie-based auth flow
# by stuffing X-User-ID / X-Workspace-ID into the request.
# The backend's RequestContext no longer reads them (it
# derives identity from the access_token cookie), so this is
# belt-and-suspenders against a future regression.
proxy_set_header X-User-ID "";
proxy_set_header X-Workspace-ID "";
}
# =========================================================================
@@ -104,6 +116,15 @@ server {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# Defense in depth: do not let the browser-supplied identity
# headers leak past the auth subrequest. The auth subrequest
# only forwards the Cookie + Authorization it cares about;
# the actual Jupyter upstream is fully trusted (the address
# comes from the backend's runtime registry), so a leaked
# X-User-ID here would not matter for the proxy target but
# could pollute audit logs.
proxy_set_header X-User-ID "";
proxy_set_header X-Workspace-ID "";
}
# 2. 内部 Auth 子请求 location
@@ -123,6 +144,13 @@ server {
proxy_set_header Cookie $http_cookie;
proxy_set_header Authorization $http_authorization;
# Defense in depth: the auth subrequest reads the session
# cookie / Authorization header, not the legacy identity
# headers. Blank them out so a poisoned client header cannot
# be confused for an authenticated identity if the backend
# code is ever refactored to read them again.
proxy_set_header X-User-ID "";
proxy_set_header X-Workspace-ID "";
}
# 拒绝其余非法路径