/_matrix/client/v3/account/whoami returns 404 M_NOT_FOUND instead of 403 M_FORBIDDEN #1195
Labels
No labels
Bug
Cherry-picking
Database
Dependencies
Dependencies/Renovate
Difficulty
Easy
Difficulty
Hard
Difficulty
Medium
Documentation
Enhancement
Good first issue
Help wanted
Inherited
Matrix/Administration
Matrix/Appservices
Matrix/Auth
Matrix/Client
Matrix/Core
Matrix/Federation
Matrix/Hydra
Matrix/MSC
Matrix/Media
Meta
Meta/CI
Meta/Packaging
Priority
Blocking
Priority
High
Priority
Low
Security
Status/Blocked
Status
Confirmed
Status
Duplicate
Status
Invalid
Status
Needs Investigation
Support
To-Merge
Wont fix
old/ci/cd
old/rust
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
continuwuation/continuwuity#1195
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The
whoamiendpoint is apparently not compliant with the current spec.From what I gathered, the server must not differentiate between a user that doesn't exist and a user that is not allowed for the appservice.
For context, this bug is blocking mautrix-telegram because it checks for its bot user at startup before actually registering it and stops as soon as it encounters the 404 instead of a 403 (see mautrix-telgram!999).
Looks like a check just needs implementing here:
Ok(whoami::v3::Response {user_id: body.sender_user().to_owned(),device_id: body.sender_device.clone(),is_guest: services.users.is_deactivated(body.sender_user()).await?&& body.appservice_info.is_none(),})something like
if body.sender_user.is_none() {Err!(Request(Forbidden("...")))}or whatever.Having the check implicit like it is there is very questionable, but this particular affect can be fixed by swapping the condition:
In that case the branch will be short-circuited and appservices will never reach it. Checking if the user exists can happen before that, with
services.users.exists- and appservices (or maybe admin API in future) should be thoe only ones able to reach whoami on unreachable users.