spring / matrix-synapse-uberserver-xmlrpc

password provider for the springrts matrix homeserver
GNU General Public License v3.0
0 stars 0 forks source link

impossible to login with a lobby account which contains "special" chars #1

Closed abma closed 6 years ago

abma commented 6 years ago

https://springrts.com/phpbb/viewtopic.php?f=1&p=586455

abma commented 6 years ago

"Matrix requires it to be all lowercase, which is strange since i'm pretty sure i'm uppercase in lobby."

abma commented 6 years ago

not sure how to handle [ ]: either lobby accounts must be renamed or it has to be passed through....

the same for upper-case?!

TurBoss commented 6 years ago

I'm taking a look sorry for the delay

TurBoss commented 6 years ago

bad news:

UpperCase usernames: not valid [special]characters: not allowed

Maximus 14:55 Point is: synapse allowed illegal characters: upper case characters. it no longer does and it was phased out in two steps: 1) not allowed to create Matrix ID with them anymore and then 2) disabling access to those accounts

14:56 if you have a backend that has those illegal characters, you can either fix it by using another property that would have the right value always, or by doing things where you'll 95% of the time shoot yourself in the foot

TurBoss commented 6 years ago

how to handle?

I don't know

Ideas?

Thanks

abma commented 6 years ago

we could use the accountid as alternative?!

this would require a small change in the xmlrpc service.

are account names containing numbers only allowed?

if not sth. like springid1234 could be used.

TurBoss commented 6 years ago

we could use the accountid as alternative?!

this looks good

let me investigate

TurBoss commented 6 years ago

I created a branch where the localpart of the matrix user id uses the accountid from uberserver (uberserver allready gives accountid)

https://github.com/TurBoss/matrix-synapser-uberserver-xmlrpc/commit/4327c478e3cf5b128b538f3406131283361858da

the thing will not allow to login with our accounts, like "turboss:springrts.com", "abma:springrts.com"

TurBoss commented 6 years ago

this hack does the trick but requires to modify the source of synapse and break the protocol

# mxid_localpart_allowed_characters = set("_-./=" + string.ascii_lowercase + string.digits)
mxid_localpart_allowed_characters = set("_-./=[]" + string.ascii_letters + string.digits)

not applied yet

abma commented 6 years ago

thats IMHO a very bad idea. this very likely breaks fedaration / has possible many bad side effects. Worst case it opens a security hole.

why was the idea with "id12345" abandoned?

TurBoss commented 6 years ago

yes bad idea I know

not abandoned just can't figure how to do it

I'm still on it

abma commented 6 years ago

add a second function here:

https://github.com/spring/uberserver/blob/master/XmlRpcServer.py#L104

def login_by_id(self, username, password):

which does split the prefix and validates password + db_user.id instead of the username?!

and ideally when doing this try to add functions / extend the existing one to share code :)

TurBoss commented 6 years ago

I'm able to validate the username against uberserver and get the user_id the I'm able to register a new account with the user_id

the problem is that the matrix client still passes the username to its own login

1- check password ok 2 get user_id ok 3 create matrix account ok 4 login with that acount instead of what the user typed (their username) not ok

I'm trying to ask MAxim again

TurBoss commented 6 years ago

ok he toldme that mxisd could do the trick https://github.com/kamax-io/mxisd I'm on it

TurBoss commented 6 years ago

we can implement what he does

abma commented 6 years ago

4 login with that acount instead of what the user typed (their username) not ok

whats wrong with logging in via user id?

IMHO the special chars at uberserver can go when an alternative exists.

TurBoss commented 6 years ago

whats wrong with logging in via user id

auth provider can't replace what user typed on the login box with the user_id but the mxisd could intercept it before is sent to the matrix auth system (i'm reading the docs / source)

TurBoss commented 6 years ago

ok

Finally figured how to use the user_id

its currently implemented so may work

only left to change the display name to the current username

TurBoss commented 6 years ago

Display name should be set on first login, is set to current username

TurBoss commented 6 years ago

I'm closing this as its finally working

Thank You