Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Do not check for internal account lock for MSC3861 delegated auth #16215

Open
wants to merge 3 commits into
base: release-v1.91
Choose a base branch
from

Conversation

sandhose
Copy link
Member

Turns out #15870 broke the admin token for MSC3861, because MAS is doing the request with a fake user (and it's not synapse's responsibility to know if an account is locked or not)

@sandhose sandhose requested a review from a team as a code owner August 31, 2023 10:10
@sandhose sandhose force-pushed the quenting/hotfix-delegated-auth-admin branch from e9fc985 to 842b43c Compare August 31, 2023 10:18
@sandhose sandhose changed the base branch from develop to release-v1.91 August 31, 2023 10:18
Copy link
Contributor

@MatMaul MatMaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. If you know any RFC that would define locked account in OAuth2 spec, I am interested to have a look so we can convert the token to a proper Matrix response.
I couldn't find anything after a quick search.

Copy link
Member

@hughns hughns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When MSC3861 is enabled then the consequences of the admin API failing are show stopping.

As such, can we add a test for the behaviour associated with the admin_token config option?

@hughns
Copy link
Member

hughns commented Sep 4, 2023

@sandhose I've added some tests. Please can you take a look?

@hughns hughns requested a review from MatMaul September 4, 2023 11:23
Comment on lines -285 to -295
# Deny the request if the user account is locked.
if not allow_locked and await self.store.get_user_locked_status(
requester.user.to_string()
):
raise AuthError(
401,
"User account has been locked",
errcode=Codes.USER_LOCKED,
additional_fields={"soft_logout": True},
)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the same logic remains in auth/internal.py

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before this was removed, I think self.store.get_user_locked_status would raise a 404 error because the dummy user doesn't exist?

@@ -0,0 +1 @@
Fix a bug where admin tokens stopped working with MSC3861 auth delegation was enabled.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this all admin tokens, or just the admin token reserved for the identity provider?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants