You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Harden WebSocket transport: pending-Future leak + duplicate-ID handshake reject
Two small audit-v2 fixes in src/godot_ai/transport/websocket.py
covering #343 sub-findings #2 and #5. (Sub-finding #4 — errno.EADDRINUSE
portability — landed separately via PR #373.)
- #5 (P2): wrap `send_command`'s `ws.send` + `wait_for` in a
try/finally that always pops `_pending`. Pre-fix, a `ws.send`
raise (ConnectionClosed mid-send, transport error) leaked the
Future entry forever; under churn the dict grew unbounded.
Happy path still pops via the response receiver, so the finally
pop is a no-op there.
- #2 (P1): reject a second handshake whose session_id is already
registered (close code 4001), instead of silently overwriting
the routing map. session_id format is `<slug>@<4hex>` — 16 bits
of suffix is locally guessable, so without this any local peer
could hijack an active session by impersonating its ID.
Legitimate plugin reconnect after `editor_reload_plugin` first
triggers ConnectionClosed -> unregister, so the new connect
still lands cleanly.
Tests:
- tests/integration/test_websocket.py — TestDuplicateHandshake
pins the reject + reconnect-after-clean-disconnect paths;
TestPendingFutureCleanup pins the timeout-pop and
send-failure-pop behaviors.
Live-smoked against a real Godot 4.6 editor: full GDScript suite
1037/1040 passed, duplicate-handshake rejected with close 4001,
original session unaffected.
https://claude.ai/code/session_016ijmCD5S6QfwJGJcc5Wirp
* Apply pending ruff format to test_mcp_tools and test_gdscript_no_adjacent_string_concat
Drive-by: `ruff format --check` was failing on these two test files on beta.
Reformatting them keeps the format-check CI step green for the audit-v2
transport-hardening PR. No behavioral change — purely whitespace /
line-wrapping deltas produced by `ruff format`.
https://claude.ai/code/session_016ijmCD5S6QfwJGJcc5Wirp
---------
Co-authored-by: Claude <noreply@anthropic.com>
0 commit comments