Skip to content
Snippets Groups Projects
Unverified Commit 4c84c9c4 authored by Erik Johnston's avatar Erik Johnston Committed by GitHub
Browse files

Don't log exceptions for obviously incorrect stream tokens (#18139)


We log incorrect ones as we want to catch bugs where Synapse returns bad
tokens. However, sometimes clients just send tokens that are e.g. empty.

---------

Co-authored-by: default avatarEric Eastwood <erice@element.io>
parent deb09b38
No related branches found
No related tags found
No related merge requests found
Do not log at the exception-level when clients provide empty `since` token to `/sync` API.
......@@ -664,6 +664,11 @@ class RoomStreamToken(AbstractMultiWriterStreamToken):
@classmethod
async def parse(cls, store: "PurgeEventsStore", string: str) -> "RoomStreamToken":
# Check that it looks like a Synapse token first. We do this so that
# we don't log at the exception-level for obviously incorrect tokens.
if not string or string[0] not in ("s", "t", "m"):
raise SynapseError(400, f"Invalid room stream token {string:!r}")
try:
if string[0] == "s":
return cls(topological=None, stream=int(string[1:]))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment