revoltchat / backend

Monorepo for Revolt backend services.
https://developers.revolt.chat/api/
Other
1.09k stars 123 forks source link

bug: Sending malformed `Authenticate` events via Bonfire does not seem to produce an Error response #289

Closed QuantumToasted closed 4 weeks ago

QuantumToasted commented 7 months ago

What happened?

Due to an oversight in my original JSON serialization techniques, I was sending events over the websocket with their type values incorrectly serialized as integer values instead of string values (e.g. {"type": 0, "token": "..."} instead of {"type": "Authenticate", "token": "..."}. I expected the server to return an Error event indicating that an invalid event was recieved or that authentication was not complete/failed, but instead I never received anything at all.

If this is just the current behavior and not necessarily intended, I believe the websocket should return an Error model indicating the problem, perhaps adding a new error value? Alternatively, Bonfire could simply send an Unauthorized error value for any sent events while not currently authenticated. Whatever works, works, but I think the current behavior is not ideal.