Merge remote-tracking branch 'origin/topic/bbannier/issue-4594'

* origin/topic/bbannier/issue-4594:
  Align WebSocket error in cluster with one in Broker
This commit is contained in:
Arne Welzel 2025-06-22 15:49:11 +02:00
commit b1157e4e03
6 changed files with 23 additions and 10 deletions

13
CHANGES
View file

@ -1,3 +1,16 @@
8.0.0-dev.447 | 2025-06-22 15:49:11 +0200
* GH-4594: Align WebSocket error in cluster with one in Broker (Benjamin Bannier, Corelight)
The schema of cluster WebSocket error messages deviated from the
existing one in Broker which breaks seamless migration from the Broker
WebSocket bindings.
This patch aligns the serialization in cluster with the one in Broker.
This is technically a breaking change of the cluster schema, but since
it never worked like documented and is still experimental this is
probably fine.
8.0.0-dev.445 | 2025-06-22 15:48:21 +0200 8.0.0-dev.445 | 2025-06-22 15:48:21 +0200
* GH-4571: broker: Handle Broker::publish() with non Broker::Event (Arne Welzel, Corelight) * GH-4571: broker: Handle Broker::publish() with non Broker::Event (Arne Welzel, Corelight)

View file

@ -1 +1 @@
8.0.0-dev.445 8.0.0-dev.447

View file

@ -144,7 +144,7 @@ WebSocketClient::SendInfo WebSocketClient::SendError(std::string_view tag, std::
*out++ = ','; *out++ = ',';
broker::format::json::v1::append_field("code", tag, out); broker::format::json::v1::append_field("code", tag, out);
*out++ = ','; *out++ = ',';
broker::format::json::v1::append_field("message", message, out); broker::format::json::v1::append_field("context", message, out);
*out++ = '}'; *out++ = '}';
return SendText(buf); return SendText(buf);
} }

View file

@ -1,7 +1,7 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
Connected! Connected!
err1 {'type': 'error', 'code': 'deserialization_failed', 'message': 'failed to decode JSON object'} err1 {'type': 'error', 'code': 'deserialization_failed', 'context': 'failed to decode JSON object'}
err2 {'type': 'error', 'code': 'deserialization_failed', 'message': 'failed to create Zeek event'} err2 {'type': 'error', 'code': 'deserialization_failed', 'context': 'failed to create Zeek event'}
err3 {'type': 'error', 'code': 'deserialization_failed', 'message': 'failed to create Zeek event'} err3 {'type': 'error', 'code': 'deserialization_failed', 'context': 'failed to create Zeek event'}
pong {'@data-type': 'string', 'data': 'pong'} {'@data-type': 'vector', 'data': [{'@data-type': 'string', 'data': 'Hello'}, {'@data-type': 'count', 'data': 42}]} pong {'@data-type': 'string', 'data': 'pong'} {'@data-type': 'vector', 'data': [{'@data-type': 'string', 'data': 'Hello'}, {'@data-type': 'count', 'data': 42}]}
err4 {'type': 'error', 'code': 'deserialization_failed', 'message': 'failed to decode JSON object'} err4 {'type': 'error', 'code': 'deserialization_failed', 'context': 'failed to decode JSON object'}

View file

@ -1,5 +1,5 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
broken array response {'type': 'error', 'code': 'deserialization_failed', 'message': 'subscriptions not an array'} broken array response {'type': 'error', 'code': 'deserialization_failed', 'context': 'subscriptions not an array'}
non string error {'type': 'error', 'code': 'deserialization_failed', 'message': 'individual subscription not a string'} non string error {'type': 'error', 'code': 'deserialization_failed', 'context': 'individual subscription not a string'}
mix error {'type': 'error', 'code': 'deserialization_failed', 'message': 'individual subscription not a string'} mix error {'type': 'error', 'code': 'deserialization_failed', 'context': 'individual subscription not a string'}
ack True ack True

View file

@ -1,4 +1,4 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
Connected ws_good! Connected ws_good!
Connected ws_bad! Connected ws_bad!
Error for ws_bad {'type': 'error', 'code': 'invalid_uri', 'message': 'Invalid URI - use /v1/messages/json'} Error for ws_bad {'type': 'error', 'code': 'invalid_uri', 'context': 'Invalid URI - use /v1/messages/json'}