The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(raft): a null or blank bridge token is unset, not a guessable inbound token
kshitijk4poord28c51390433
diff --git a/plugins/platforms/raft/adapter.py b/plugins/platforms/raft/adapter.pyindex 941ef6375c1..0260873e82d 100644--- a/plugins/platforms/raft/adapter.py+++ b/plugins/platforms/raft/adapter.py@@ -313,7 +313,8 @@ class RaftAdapter(BasePlatformAdapter):self._port: int = int(extra.get("port", DEFAULT_PORT))path = str(extra.get("path", DEFAULT_PATH) or DEFAULT_PATH).strip() or DEFAULT_PATHself._path: str = path if path.startswith("/") else f"/{path}"- self._bridge_token: str = str(extra.get("bridge_token", ""))+ # `or ""`: a null YAML value must reach connect()'s auto-generated token, not become "None".+ self._bridge_token: str = str(extra.get("bridge_token") or "").strip()self._runtime_session: str = str(extra.get("runtime_session", DEFAULT_RUNTIME_SESSION) or DEFAULT_RUNTIME_SESSION)self._max_body_bytes: int = int(extra.get("max_body_bytes", DEFAULT_MAX_BODY_BYTES))self._runner = Nonediff --git a/tests/gateway/test_raft_adapter.py b/tests/gateway/test_raft_adapter.pyindex 64cd9e1b711..4405438e5f8 100644--- a/tests/gateway/test_raft_adapter.py+++ b/tests/gateway/test_raft_adapter.py@@ -96,6 +96,14 @@ class TestRaftWakeHttp:adapter.handle_message.assert_not_called()+ @pytest.mark.parametrize("blank", [None, " "])+ def test_unset_bridge_token_is_unset_not_a_guessable_token(self, blank):+ """A null/blank YAML token must reach connect()'s auto-generated one, never authorize "None"."""+ adapter = _make_adapter(bridge_token=blank)+ assert adapter._bridge_token == ""+ assert not adapter._authorized(SimpleNamespace(headers={BRIDGE_TOKEN_HEADER: str(blank)}))++class TestRaftActivityHttp:@pytest.mark.asyncioasync def test_activity_endpoint_auth_validation_and_drain(self):