mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 10:36:06 -04:00
Improve error checking for OIDC/SAML mapping providers (#8774)
Checks that the localpart returned by mapping providers for SAML and OIDC are valid before registering new users. Extends the OIDC tests for existing users and invalid data.
This commit is contained in:
parent
53a6f5ddf0
commit
79bfe966e0
7 changed files with 137 additions and 29 deletions
|
@ -317,14 +317,14 @@ mxid_localpart_allowed_characters = set(
|
|||
)
|
||||
|
||||
|
||||
def contains_invalid_mxid_characters(localpart):
|
||||
def contains_invalid_mxid_characters(localpart: str) -> bool:
|
||||
"""Check for characters not allowed in an mxid or groupid localpart
|
||||
|
||||
Args:
|
||||
localpart (basestring): the localpart to be checked
|
||||
localpart: the localpart to be checked
|
||||
|
||||
Returns:
|
||||
bool: True if there are any naughty characters
|
||||
True if there are any naughty characters
|
||||
"""
|
||||
return any(c not in mxid_localpart_allowed_characters for c in localpart)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue