fix: Return M_UNKNOWN_DEVICE for unknown masqueraded appservice devices

When an appservice masqueraded as a device_id that does not exist for
the user, we returned 403 M_FORBIDDEN. The spec requires 400
M_UNKNOWN_DEVICE.
This commit is contained in:
Bardi Harborow authored and Ellis Git committed 2026-11-04 19:32:17 +00:00
1 parent 4d0ccd998f
commit 219e8d2e1e
2 files changed
+2 -4

No files matched your search

+1
View File
@@ -0,0 +1 @@
Appservices masquerading as a device that does not exist now receive 400 `M_UNKNOWN_DEVICE` as required by the spec, instead of 403 `M_FORBIDDEN`.
+1 -4
View File
@@ -379,10 +379,7 @@ async fn check_access_token(
.await
.is_err()
{
return Err!(Request(Forbidden(
"Device does not exist for user or appservice cannot masquerade as this \
device."
)));
return Err!(Request(UnknownDevice("Device does not exist for this user.")));
}
Some(device_id.to_owned())