Harden provider key env management

This commit is contained in:
2026-05-11 19:16:24 +08:00
parent c78f112685
commit dedd2bf5d3
2 changed files with 2 additions and 0 deletions

View File

@@ -1252,6 +1252,7 @@ def handle_provider_keys_delete(path: str, headers: dict[str, str]) -> tuple[int
raw_key = urllib.parse.unquote(path[len("/feishu/provider-keys/") :].strip("/"))
key = validate_provider_env_key(raw_key)
write_env_removals(Config.env_file, {key})
os.environ.pop(key, None)
reload_config_from_env_file()
logging.info("removed provider env key %s", key)
return 200, {"code": 0, "msg": "ok", "key": {"key": key, "present": False}}