Ratchet's router merges the query over the route parameters, so
/app/<anything>?appKey[]=x reached verifyAppKey() (and WebSocketsLogger's
onOpen when logging is on) with an array. QueryParameters::get(): string
threw a TypeError, onOpen only caught WebSocketException and Ratchet's
IoServer only catches \Exception, so the Error left the event loop and the
daemon exited. Anyone could do this before authenticating.
- QueryParameters::get() reads a non-string parameter as '', so the key
becomes an unknown key: websocket.error 4001 and a closed socket.
- onOpen catches any other Throwable, logs it with the trace, sends
websocket.error "Internal server error" (1011) and closes with 1011.
- verifyAppKey() settles the findByKey() promise in place instead of
await(). await() on a pending promise would run the server's own loop
again from a fiber inside onOpen. A rejected lookup is rethrown, a
pending one is refused; the AppManager contract now says findByKey()
must settle synchronously. ConfigAppManager already does.
- A refused connection (4001 unknown key, 4009 origin) closes with that
code instead of 1000. 4000-4099 tells Pusher-style clients not to
reconnect. ConnectionLogger::close() passes the code on.
- The refusal is logged at warning level without a trace, and the
client-supplied key goes into the JSON-encoded context, not the log line.
Tests: the array key with and without the logger, QueryParameters on an
array, an app manager that rejects, one that never settles and one that
throws an Error, the close codes of the 4001/4009 refusals, and the server
test now checks the 4001 close code.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>