Commit Graph

34 Commits

Author SHA1 Message Date
Fabian @ Blax Software ee04c8c731 BF refuse a broken app key or failed app lookup without stopping the server
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>
2026-11-04 12:25:54 +01:00
Fabian @ Blax Software 0757e6d9f9 I stability 2026-03-21 12:56:50 +01:00
Alexander Blasl 1a5db82c26 Renovation 2025-01-16 08:54:02 +01:00
Marcel Pociot 2e4b2f35f9
Apply fixes from StyleCI (#1190) 2024-02-07 18:30:54 +01:00
Alex Renoki fd1a459047 Added integrations for Redis 2020-09-26 10:30:53 +03:00
Alex Renoki 5cb2ee9fce Run promises one-after-another 2020-09-19 14:16:26 +03:00
Alex Renoki 7a651d78c2 Fixed tests 2020-09-18 12:15:49 +03:00
Alex Renoki 23e8b3db44 Fixed issues with connections being closed within 10 seconds 2020-09-17 13:56:09 +03:00
Alex Renoki 97ab241fa3 Fixing PR #530 2020-09-16 11:02:58 +03:00
Alex Renoki b41f8b7b75 Creating SignedMessage class for testing 2020-09-15 20:46:19 +03:00
Alex Renoki ec47925c71 Added soft closes for connections on SIGTERM/SIGINT 2020-09-12 17:45:07 +03:00
rennokki 341eb9604f
Apply fixes from StyleCI (#518) 2020-09-10 21:59:49 +02:00
Alex Renoki 6f32b89459 wip 2020-09-10 22:59:26 +03:00
Alex Renoki ca4a9a180e Running then() closures as block in tests 2020-09-05 22:40:52 +03:00
Alex Renoki ea9741072b Fixed tests 2020-09-04 21:50:38 +03:00
Alex Renoki e6cfa85472 Replaced blocking Redis instance with non-blocking I/O client 2020-09-04 17:50:49 +03:00
Alex Renoki b9dfecab68 Using separate connection counts for global & local. 2020-09-04 11:34:33 +03:00
rennokki 855646a5a7
Apply fixes from StyleCI (#500) 2020-09-04 08:47:46 +02:00
Alex Renoki a45c0bf9cc Using the Redis non-blocking client. 2020-09-04 09:47:23 +03:00
Alex Renoki e099c46a0d docblocks 2020-08-30 20:00:45 +03:00
Alex Renoki 0c8c5c0d9b Moved the mocks statistics loggers to Mocks/ 2020-08-27 22:13:30 +03:00
Alex Renoki ce652bbbcb Mocked message expects array 2020-08-22 20:53:33 +03:00
Alex Renoki 04ff39d75e wip 2020-08-17 11:47:50 +03:00
rennokki 5c3e87ecca
Apply fixes from StyleCI (#461) 2020-08-14 14:36:00 +02:00
Alex Renoki 25694c7146 wip 2020-08-14 15:35:36 +03:00
Freek Van der Herten fa0bd1c9ef
Apply fixes from StyleCI (#329) 2020-03-04 10:58:39 +01:00
Marcel Pociot 9ce2cc3ff7
Apply fixes from StyleCI (#3) 2018-12-04 22:22:33 +01:00
Marcel Pociot 9c2ac54322 More tests 2018-12-03 10:21:35 +01:00
freek 6103f7ea1b add ping test 2018-11-28 23:59:58 +01:00
Marcel Pociot f4c356ba02 wip 2018-11-27 22:26:29 +01:00
freek 9fc7747b1d implement close on mock 2018-11-27 00:00:26 +01:00
Marcel Pociot 1e5b8994df wip 2018-11-26 00:20:18 +01:00
Marcel Pociot fb71f41e05 wip 2018-11-26 00:14:50 +01:00
Marcel Pociot c822ea15a5 wip 2018-11-25 23:43:43 +01:00