The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(line): keep a null channel secret unset instead of keying HMAC with "None"
kshitijk4poorc5caff330d64
diff --git a/plugins/platforms/line/adapter.py b/plugins/platforms/line/adapter.pyindex a3749a593ec..43b273a2613 100644--- a/plugins/platforms/line/adapter.py+++ b/plugins/platforms/line/adapter.py@@ -344,8 +344,8 @@ def _credentials(config) -> Tuple[str, str]:extra = getattr(config, "extra", {}) or {}# Stripped: a whitespace-only secret must read as unset, not key the HMAC with blanks.return (- str(_get_scoped_secret("LINE_CHANNEL_ACCESS_TOKEN") or extra.get("channel_access_token", "")).strip(),- str(_get_scoped_secret("LINE_CHANNEL_SECRET") or extra.get("channel_secret", "")).strip())+ str(_get_scoped_secret("LINE_CHANNEL_ACCESS_TOKEN") or extra.get("channel_access_token") or "").strip(),+ str(_get_scoped_secret("LINE_CHANNEL_SECRET") or extra.get("channel_secret") or "").strip())def _coerce(cast: Callable[[Any], Any], value: Any, default: Any) -> Any:@@ -895,7 +895,7 @@ def _unlink_quietly(path: str) -> None:def _env_credentials_present() -> bool:- return bool(_get_scoped_secret("LINE_CHANNEL_ACCESS_TOKEN") and _get_scoped_secret("LINE_CHANNEL_SECRET"))+ return all(str(_get_scoped_secret(k) or "").strip() for k in ("LINE_CHANNEL_ACCESS_TOKEN", "LINE_CHANNEL_SECRET"))def check_requirements() -> bool:diff --git a/tests/gateway/test_line_plugin.py b/tests/gateway/test_line_plugin.pyindex 5333daf7d0d..68bd6de5970 100644--- a/tests/gateway/test_line_plugin.py+++ b/tests/gateway/test_line_plugin.py@@ -416,8 +416,10 @@ class TestAdapterInit:assert ad.channel_access_token == "tok"assert ad.channel_secret == "sec"# A whitespace-only secret reads as unset, so connect fails closed instead of keying HMAC with blanks.- assert LineAdapter(PlatformConfig(enabled=True, extra={"channel_access_token": "tok",- "channel_secret": " "})).channel_secret == ""+ # So does an explicit null (an empty YAML value), which must not become the string "None".+ for blank in (" ", None):+ assert LineAdapter(PlatformConfig(enabled=True, extra={"channel_access_token": "tok",+ "channel_secret": blank})).channel_secret == ""assert ad.webhook_port == 7777assert ad.public_base_url == "https://x.example.com"assert ad.allowed_users == {"U1", "U2"}