Prevent env autofill from overwriting OKX API keys when saving hedge settings.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Vendored
+4
@@ -275,6 +275,10 @@ def validate_env_updates(groups: list[dict], updates: dict[str, str]) -> tuple[d
|
||||
val = str(value).strip()
|
||||
if allowed[key].get("sensitive") and (val == "" or (val.startswith("****") and len(val) <= 8)):
|
||||
continue
|
||||
# API Key 被密码管理器/自动填充成登录密码时通常很短;OKX Key 一般为 36 位
|
||||
if key.endswith("_API_KEY") and 0 < len(val) < 16:
|
||||
errors.append(f"{key} 长度异常,疑似自动填充;留空则不修改已有密钥")
|
||||
continue
|
||||
ftype = allowed[key].get("type")
|
||||
if ftype == "bool":
|
||||
low = val.lower()
|
||||
|
||||
Reference in New Issue
Block a user