<span id="cookie语言与部署边界"></span>

# Cookies, languages, and deployment boundaries

<span id="cookie条件"></span>

## Cookie conditions

| Object | Secure branch | Nonsecure branch |
| --- | --- | --- |
| Session | __Host-aistudio_session | aistudio_session |
| CSRF | __Host-aistudio_csrf | aistudio_csrf |
| Login binding prefix | __Host-aistudio_login_ | aistudio_login_ |
| Old fixed binding name | __Host-aistudio_login_binding | aistudio_login_binding |

Current composition selects the secure branch when configured browser.callback_url uses https, not from a test receiver's HTTP or observations of the current proxy. All Cookies use Path=/ and SameSite=Lax, without Domain. Session/login binding are HttpOnly=true; CSRF is false. Session/CSRF have no explicit Max-Age; binding Max-Age follows StateTTL. Clearing uses negative MaxAge. Origins, callback schemes, proxy TLS, and same-site rules require testing in each environment.

Concurrent current and alternate session/CSRF names invalidate SessionCredential; duplicate corresponding Cookies also invalidate it. GET /auth/me permits a missing CSRF Cookie and writes one. POST /auth/logout requires its value to match session storage. Ordinary protected product writes read X-CSRF-Token from the header. Handle mixed credentials per entry point. A bare session handler's rule is not the whole product security contract.

<span id="三种语言输入"></span>

## Three language inputs

| Input | Location | Purpose |
| --- | --- | --- |
| lang | Login query | Account login UI language; six exact supported values. |
| locale | Logout body | Account logout/relogin UI language; the same six values, validated after trimming. |
| locale / Accept-Language | General query/header | Product API language negotiation, supporting en-US/zh-CN; not a substitute for the preceding parameters. |

A nonempty Accept-Language takes priority for negotiation; unmatched values fall back to en-US. Only without this header is nonempty query locale validated exactly. Unsupported values return 400 ErrUnsupportedLocale before routing. Login lang=fr-FR does not make query locale=fr-FR valid. Browser error msg currently uses HTTP status text directly. Content-Language alone does not guarantee localized messages.

<span id="前端部署模式"></span>

## Frontend deployment modes

In AUTH_MODE=sso, product UserMenu calls product BFF logout and navigates to logout_url. Other modes clear local state and use a CloudSigma bridge or /login. In sso mode, the account site's LogoutPage reads/ends the UC session and replaces navigation with '/login'. Only non-sso mode hands off through product /auth/me, POST /auth/logout, and logout_url. If the current UC session already returns 401, the account logout helper treats it as logged out and sends no further logout write.

If product UC account queries fail, an authenticated product identity may still display profile information, without implying UC administrator privileges. TTL is parsed from configuration and must be positive. Test values of ten minutes or an hour do not establish product defaults.

<span id="证据状态"></span>

## Evidence status

No new public navigation was added.
