diff options
author | Erik Johnston <erikj@element.io> | 2024-05-31 11:27:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-31 11:27:56 +0100 |
commit | 64f5a4a3534672778cc995cee8b4805db26a9e0c (patch) | |
tree | 60b409f66650f93ac7bdbb056cf8506af447dbfb | |
parent | Fix sentry default tags (#17251) (diff) | |
download | synapse-64f5a4a3534672778cc995cee8b4805db26a9e0c.tar.xz |
Fix logging errors when receiving invalid User ID for key querys (#17250)
-rw-r--r-- | changelog.d/17250.misc | 1 | ||||
-rw-r--r-- | synapse/handlers/e2e_keys.py | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/changelog.d/17250.misc b/changelog.d/17250.misc new file mode 100644 index 0000000000..49834e83ba --- /dev/null +++ b/changelog.d/17250.misc @@ -0,0 +1 @@ +Stop logging errors when receiving invalid User IDs in key querys requests. diff --git a/synapse/handlers/e2e_keys.py b/synapse/handlers/e2e_keys.py index 4f40e9ffd6..560530a7b3 100644 --- a/synapse/handlers/e2e_keys.py +++ b/synapse/handlers/e2e_keys.py @@ -149,6 +149,11 @@ class E2eKeysHandler: remote_queries = {} for user_id, device_ids in device_keys_query.items(): + if not UserID.is_valid(user_id): + # Ignore invalid user IDs, which is the same behaviour as if + # the user existed but had no keys. + continue + # we use UserID.from_string to catch invalid user ids if self.is_mine(UserID.from_string(user_id)): local_query[user_id] = device_ids |