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

* origin/topic/bbannier/issue-4594:
  Align WebSocket error in cluster with one in Broker

(cherry picked from commit b1157e4e03)
This commit is contained in:
Arne Welzel 2025-06-22 15:49:11 +02:00 committed by Tim Wojtulewicz
parent 7cdbbec44c
commit 886fdd7c3a
6 changed files with 25 additions and 10 deletions

15
CHANGES
View file

@ -1,3 +1,18 @@
7.2.1-7 | 2025-07-14 14:32:04 -0700
* 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.
(cherry picked from commit b1157e4e03b38560ddbb5df3e4760ca24b0319b4)
7.2.1-6 | 2025-07-14 14:30:44 -0700
* cluster/zeromq: Short-circuit DoPublishLogWrite() when not initialized (Arne Welzel, Corelight)

View file

@ -1 +1 @@
7.2.1-6
7.2.1-7

View file

@ -145,7 +145,7 @@ WebSocketClient::SendInfo WebSocketClient::SendError(std::string_view tag, std::
*out++ = ',';
broker::format::json::v1::append_field("code", tag, out);
*out++ = ',';
broker::format::json::v1::append_field("message", message, out);
broker::format::json::v1::append_field("context", message, out);
*out++ = '}';
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.
Connected!
err1 {'type': 'error', 'code': 'deserialization_failed', 'message': 'failed to decode JSON object'}
err2 {'type': 'error', 'code': 'deserialization_failed', 'message': 'failed to create Zeek event'}
err3 {'type': 'error', 'code': 'deserialization_failed', 'message': 'failed to create Zeek event'}
err1 {'type': 'error', 'code': 'deserialization_failed', 'context': 'failed to decode JSON object'}
err2 {'type': 'error', 'code': 'deserialization_failed', 'context': '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}]}
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.
broken array response {'type': 'error', 'code': 'deserialization_failed', 'message': 'subscriptions not an array'}
non string error {'type': 'error', 'code': 'deserialization_failed', 'message': 'individual subscription not a string'}
mix error {'type': 'error', 'code': 'deserialization_failed', 'message': 'individual subscription not a string'}
broken array response {'type': 'error', 'code': 'deserialization_failed', 'context': 'subscriptions not an array'}
non string error {'type': 'error', 'code': 'deserialization_failed', 'context': 'individual subscription not a string'}
mix error {'type': 'error', 'code': 'deserialization_failed', 'context': 'individual subscription not a string'}
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.
Connected ws_good!
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'}