server : reject non-object session updates (#31714)

Prevent malformed realtime session updates from throwing an uncaught
exception and terminating the server

Signed-off-by: Adrien Gallouët <angt@huggingface.co>
This commit is contained in:
Adrien Gallouët authored and GitHub committed 2026-11-05 09:38:08 +01:00
1 parent 2c192444c9
commit c55b094880
1 file changed
+4
+4
View File
@@ -569,6 +569,10 @@ struct realtime_conversation {
void on_session_update(const json & ev) {
const json session = ev.value("session", json::object());
if (!session.is_object()) {
send_error("session.update: session must be an object");
return;
}
if (session.contains("type") && session["type"].is_string() && session["type"] != type) {
const std::string t = session["type"];
if (t != "realtime" && t != "transcription") {