Disable browser PKCE mint by default.
User does not want web/browser casting; HTTP-only unless cpa_allow_browser_fallback is explicitly re-enabled.
This commit is contained in:
1 parent
0417fa3218
commit
d74d14d3f4
3 files changed
+9
-9
No files matched your search
+1
-1
@@ -41,7 +41,7 @@
|
||||
"cpa_prefer_sso_oauth": true,
|
||||
"cpa_require_referrer": true,
|
||||
"cpa_prefer_browser_mint": false,
|
||||
"cpa_allow_browser_fallback": true,
|
||||
"cpa_allow_browser_fallback": false,
|
||||
"cpa_browser_mint_timeout_sec": 90,
|
||||
"cpa_allow_device_fallback": false,
|
||||
"mint_proxy": "",
|
||||
|
||||
+5
-5
@@ -72,11 +72,11 @@ def _mint_tokens(
|
||||
log: Callable[[str], None],
|
||||
proxy: str | None,
|
||||
) -> dict[str, Any]:
|
||||
"""铸造策略(默认 HTTP 优先,浏览器作兜底,避免拖慢吞吐):
|
||||
"""铸造策略(仅 HTTP;浏览器/设备码默认关):
|
||||
|
||||
1. 仅当 cpa_prefer_browser_mint=true 且有 page:先浏览器 PKCE
|
||||
2. HTTP SSO→OAuth(curl_cffi,短超时)— 默认主路径
|
||||
3. HTTP 失败且有 page + cpa_allow_browser_fallback:浏览器 PKCE
|
||||
2. HTTP SSO→OAuth(curl_cffi,短超时)— 默认唯一主路径
|
||||
3. 仅当 cpa_allow_browser_fallback=true 且 HTTP 失败:浏览器 PKCE
|
||||
4. 可选设备码(通常无 referrer,默认关)
|
||||
"""
|
||||
from oidc_mint.oauth_code import (
|
||||
@@ -89,8 +89,8 @@ def _mint_tokens(
|
||||
|
||||
sso_token = normalize_sso_cookie(sso or "")
|
||||
prefer_sso = bool(cfg.get("cpa_prefer_sso_oauth", True))
|
||||
allow_browser = bool(cfg.get("cpa_allow_browser_fallback", True))
|
||||
# 默认 False:先 HTTP(快);浏览器只在 HTTP 失败时兜底
|
||||
allow_browser = bool(cfg.get("cpa_allow_browser_fallback", False))
|
||||
# 默认 False:不走浏览器优先
|
||||
prefer_browser = bool(cfg.get("cpa_prefer_browser_mint", False))
|
||||
allow_device = bool(cfg.get("cpa_allow_device_fallback", False))
|
||||
timeout = float(cfg.get("mint_timeout_sec", 300) or 300)
|
||||
|
||||
@@ -85,9 +85,9 @@ DEFAULT_CONFIG = {
|
||||
# OIDC:优先 SSO→Authorization Code + referrer=grok-build
|
||||
"cpa_prefer_sso_oauth": True, # True=用 sso cookie 走 PKCE(必须带 referrer)
|
||||
"cpa_require_referrer": True, # True=access_token 无 referrer=grok-build 则失败
|
||||
"cpa_prefer_browser_mint": False, # True=有 page 时先浏览器(慢);默认 False=先 HTTP,失败再浏览器
|
||||
"cpa_allow_browser_fallback": True, # True=HTTP 铸造失败时用注册浏览器走 PKCE
|
||||
"cpa_browser_mint_timeout_sec": 90, # 浏览器 PKCE 最长等待(兜底路径)
|
||||
"cpa_prefer_browser_mint": False, # True=有 page 时先浏览器(慢);默认关
|
||||
"cpa_allow_browser_fallback": False, # True=HTTP 失败再用浏览器 PKCE;默认关(不要网页铸造)
|
||||
"cpa_browser_mint_timeout_sec": 90, # 浏览器 PKCE 最长等待(仅 fallback 开启时)
|
||||
"cpa_allow_device_fallback": False, # True=SSO 失败时回退设备码(通常不可用)
|
||||
# OIDC 铸造代理/超时
|
||||
"mint_proxy": "", # 铸造专用代理;空=复用 proxy
|
||||
|
||||
Reference in new issue
Block a user