From 062a251ffe1ee5954e9372f8612b0cb66754a622 Mon Sep 17 00:00:00 2001 From: Sean Quah Date: Fri, 4 Nov 2022 15:25:20 +0000 Subject: [PATCH] Do not reject `/sync` requests with unrecognised filter fields For forward compatibility, Synapse needs to ignore fields it does not recognise instead of raising an error. Fixes #14365. Signed-off-by: Sean Quah --- changelog.d/14369.bugfix | 1 + synapse/api/filtering.py | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 changelog.d/14369.bugfix diff --git a/changelog.d/14369.bugfix b/changelog.d/14369.bugfix new file mode 100644 index 000000000000..e6709f4eecda --- /dev/null +++ b/changelog.d/14369.bugfix @@ -0,0 +1 @@ +Fix a long-standing bug where Synapse would raise an error when encountering an unrecognised field in a `/sync` filter, instead of ignoring it for forward compatibility. diff --git a/synapse/api/filtering.py b/synapse/api/filtering.py index 26be377d0334..7cd4b2df611c 100644 --- a/synapse/api/filtering.py +++ b/synapse/api/filtering.py @@ -43,7 +43,7 @@ from synapse.server import HomeServer FILTER_SCHEMA = { - "additionalProperties": False, + "additionalProperties": True, "type": "object", "properties": { "limit": {"type": "number"}, @@ -63,7 +63,7 @@ } ROOM_FILTER_SCHEMA = { - "additionalProperties": False, + "additionalProperties": True, "type": "object", "properties": { "not_rooms": {"$ref": "#/definitions/room_id_array"}, @@ -77,7 +77,7 @@ } ROOM_EVENT_FILTER_SCHEMA = { - "additionalProperties": False, + "additionalProperties": True, "type": "object", "properties": { "limit": {"type": "number"}, @@ -143,7 +143,7 @@ }, }, }, - "additionalProperties": False, + "additionalProperties": True, }