From a8e81d69f2f61d0a66c9b7cc9aa6fdc9d5cbf30f Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Thu, 7 May 2026 15:58:21 -0500 Subject: [PATCH] Add more context --- synapse/notifier.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/synapse/notifier.py b/synapse/notifier.py index dfd2178f93..6a057ac09f 100644 --- a/synapse/notifier.py +++ b/synapse/notifier.py @@ -847,11 +847,18 @@ class Notifier: this function to ensure it's not some invalid future token. We consider a token invalid, if the token has positions ahead of our persisted positions in the database. This is important as we we don't want to wait for the stream to - advance in those cases (as it may never do so). + advance in those cases (as it may never do so) (it's a waste of time for the + user and server). - Previously, we would `bound_future_token(...)` within this function but that - leads to bad patterns upstream where people can continue to use the unbounded - token. + Previously, we would sanitize and `bound_future_token(...)` within this function + but that leads to bad patterns upstream where people can continue to use the + unbounded token. + + While it was possible for older Synapse versions to erroneously give out invalid + future tokens, this is no longer the case and its considered a Synapse + programming error if this ever happens. Validation/sanitization is still + necessary as a user can intentionally mess with numbers in the tokens being + provided. Args: stream_token: The token to wait for. We assume the token has already been