The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(whatsapp_cloud): keep a null app secret unset instead of keying HMAC with "None"
kshitijk4poor53f84cc71682
diff --git a/gateway/platforms/whatsapp_cloud.py b/gateway/platforms/whatsapp_cloud.pyindex e8ba02a6635..36d2d85f859 100644--- a/gateway/platforms/whatsapp_cloud.py+++ b/gateway/platforms/whatsapp_cloud.py@@ -172,8 +172,9 @@ class WhatsAppCloudAdapter(WhatsAppBehaviorMixin, BasePlatformAdapter):def __init__(self, config: PlatformConfig):super().__init__(config, Platform.WHATSAPP_CLOUD)extra = config.extra or {}+ # `or ""`: an empty YAML value (null) is unset, not the guessable HMAC key "None".self._phone_number_id, self._access_token, self._app_id, self._app_secret, self._waba_id, self._verify_token = (- str(extra.get(key, "")).strip()+ str(extra.get(key) or "").strip()for key in ("phone_number_id", "access_token", "app_id", "app_secret", "waba_id", "verify_token"))# Falsy host (None/"") collapses to the dual-stack default.diff --git a/tests/gateway/test_whatsapp_cloud.py b/tests/gateway/test_whatsapp_cloud.pyindex 71549b4fdf9..80d228b946c 100644--- a/tests/gateway/test_whatsapp_cloud.py+++ b/tests/gateway/test_whatsapp_cloud.py@@ -390,6 +390,13 @@ class TestWebhookSignature:assert response.status == 503adapter._dispatch_payload.assert_not_called()+ def test_null_yaml_app_secret_is_unset_not_the_string_none(self):+ from gateway.config import PlatformConfig+ from gateway.platforms.whatsapp_cloud import WhatsAppCloudAdapter++ adapter = WhatsAppCloudAdapter(PlatformConfig(enabled=True, extra={"app_secret": None, "verify_token": None}))+ assert adapter._app_secret == "" and adapter._verify_token == ""+class TestWebhookReplay:"""wamid dedup — Meta retries failed deliveries up to 7 days."""