- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2.1k
Do not check for internal account lock for MSC3861 delegated auth #16215
base: release-v1.91
Are you sure you want to change the base?
Conversation
e9fc985    to
    842b43c      
    Compare
  
    There was a problem hiding this 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.
There was a problem hiding this 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?
1b9bd10    to
    b54983d      
    Compare
  
    01597b8    to
    10b4e12      
    Compare
  
    | @sandhose I've added some tests. Please can you take a look? | 
| # 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}, | ||
| ) | ||
|  | 
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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. No newline at end of file | |||
There was a problem hiding this comment.
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?
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)