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
* start new dev branch; add audit file
* Fix RawSocket TransportLost leak on failed opening handshake (#1850)
The Twisted WampRawSocketProtocol.abort() guarded on isOpen(), which
requires an attached WAMP session. During the opening handshake no
session exists yet, so a handshake failure (invalid magic byte from a
port scanner / service probe, or no suitable serializer) made abort()
take the else-branch and raise TransportLost. That exception escaped
through dataReceived into the Twisted reactor and was logged as an
"Unhandled Error" with a full stack trace, while the TCP connection
stayed open.
Fix:
- abort() now guards on `self.transport is not None` instead of
isOpen(): aborting a transport does not require an open WAMP session,
only a transport. A genuinely missing transport still raises
TransportLost. Post-handshake callers (stringReceived error paths,
_on_handshake_complete) are unaffected, since an open session always
has a transport.
- The four handshake-failure sites (server/client x bad-magic/
no-serializer) now `return` after abort(). Previously they relied on
abort() raising to stop processing; without the return they would
fall through and continue the handshake (e.g. write a reply and start
a session) on an aborted connection.
The asyncio backend already handled this correctly (parse_handshake
raises HandshakeError, caught in data_received -> protocol_error closes
the transport and returns). Added cross-backend regression tests for
both Twisted and asyncio, server and client.
Fixes#1850.
Note: abort() is part of ITransport; this changes its behavior in the
pre-session state from raising TransportLost to closing the transport.
Flagging for careful human review per AI_POLICY.md.
Note: This work was completed with AI assistance (Claude Code).
-[ ] I did **not** use any AI-assistance tools to help create this pull request.
2
+
-[x] I **did** use AI-assistance tools to *help* create this pull request.
3
+
-[x] I have read, understood and followed the projects' [AI Policy](https://github.com/crossbario/autobahn-python/blob/main/AI_POLICY.md) when creating code, documentation etc. for this pull request.
Copy file name to clipboardExpand all lines: docs/changelog.rst
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,10 @@ Changelog
8
8
26.6.1
9
9
------
10
10
11
+
**WAMP RawSocket**
12
+
13
+
* Fix the Twisted ``WampRawSocketProtocol`` raising ``TransportLost`` out of ``dataReceived`` when the opening handshake fails before a WAMP session is attached (e.g. an invalid magic byte from a port scanner). ``abort()`` now tears down the transport whenever a transport is present - rather than only when a session is open - so a failed handshake closes the connection cleanly with a single warning instead of an "Unhandled Error" stack trace, and handshake processing stops instead of continuing past the abort. The asyncio backend already behaved correctly; cross-backend regression tests were added for both. Thanks to @karel-un for the report (#1850)
14
+
11
15
**WAMP Serialization**
12
16
13
17
* ``py-ubjson`` (unmaintained, sdist-only) is no longer an unconditional dependency. A base ``pip install autobahn`` — and the wheels-only / cross-arch case from #1849 (``pip download --only-binary :all: --platform ...``) — now resolves entirely from binary wheels (#1849)
0 commit comments