-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Incorrect HTTP Status returned on unknown/invalid access token #2602
Comments
I believe I've found a comment in the code which refers to this:
I'm not sure what should be done, but I assume this is the reason for the bug. |
I was curious, and as far as I can tell, this has been fixed:
Same if the token is missing. |
It's still not. Without access token:
With invalid access token:
|
So here's what I've been able to discover about this issue and why it only affects some endpoints: There used to be two versions: v1 and v2_alpha, which were later merged into r0, however they are still separate in the synapse code. Any endpoints that are identical to the original v1 spec are served by the v1 code path (which returns 403), while anything else is served by the v2_alpha code path (which returns 401). This causes the mix between the two behaviours. The solution would be to simply move the v1 endpoints to the new behaviour. This might possibly break the old angular client, which is deprecated anyway. |
i suspect when we fixed this on the v2 servlets we forgot to fix the v1 servlets, and it'd be fine to apply the same fix there (and hope that no clients are relying on the incorrect behaviour....) |
@ara4n hope is good, but client authors should be notified ahead of time in case anyone is relying on it. |
As per latest stable and unstable spec,
401
must be returned but403
is returned instead.This leads to further spec breakage down the line for endpoints that are supposed to return 403 for another error, like (not complete list):
/_matrix/client/r0/rooms/{roomId}/state/{eventType}/{stateKey}
/_matrix/client/r0/rooms/{roomId}/state/{eventType}
/_matrix/client/r0/rooms/{roomId}/state
/_matrix/client/r0/rooms/{roomId}/members
/_matrix/client/r0/rooms/{roomId}/joined_members
/_matrix/client/r0/rooms/{roomId}/messages
/_matrix/client/r0/rooms/{roomId}/invite
On some of those endpoints, the client would be expected to behave differently, depending if the token is invalid or if authorization to perform the call was lacking (invalidate session & re-login VS give up specific action).
The text was updated successfully, but these errors were encountered: