Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spaces in Usernames #263

Closed
bundabrg opened this issue Apr 3, 2020 · 16 comments
Closed

Spaces in Usernames #263

bundabrg opened this issue Apr 3, 2020 · 16 comments
Labels
Confirmed Bug The bug reported is confirmed and able to be replicated. Priority: Medium

Comments

@bundabrg
Copy link
Collaborator

bundabrg commented Apr 3, 2020

Describe the bug
I'm not sure whether to class this as a bug or feature because to my surprise Bedrock allows spaces in the username whilst Java edition does not like them (it breaks lots of things).

My suggestion is to remap the space to an underscore before passing it through to the next hop. I'm happy to create a PR for it but can anyone comment on if there will be unintended consequences on things like floodgate etc?

To Reproduce
Steps to reproduce the behavior:

  1. Have a username with a space in it in a bedrock client
  2. Join server
  3. See the chaos (Authme will block it, but if you add space to its regex then other plugins will have some real issues)

Server version
1.15.2

Geyser version
Inventory branch build 2020-04-03

Bedrock version
1.14 I think

@Heath123
Copy link
Contributor

Heath123 commented Apr 3, 2020

Username clashes could happen
This could be a good chance to add something that stores usernames and tweaks them (adds a 1 to the end maybe?) so that a clash is impossible

@bundabrg
Copy link
Collaborator Author

bundabrg commented Apr 3, 2020

That just moved the goal posts though. Now someone can log in with user1 instead to either server.

I can't think of any easy way except for just treating them the same so that you can never have both users logged in at the same time. It does open a security hole for users with spaces or underscores though.

Only other option is to see if java edition allows some character that you cant use normally and use that char instead to map but this may cause other issues.

@SupremeMortal
Copy link
Member

I can't confirm this but I'm sure I remember testing that Xbox doesn't allow you to register the same name if the space or underscore is already taken. Could anyone check this to see if it's true or just something I dreamt up. 😄

@SlyWeirdoshep
Copy link

yeah, that's true

bundabrg added a commit to bundabrg/Geyser that referenced this issue Apr 3, 2020
@Preloading
Copy link

The issue probably comes from java not meant to have spaces if you have spaces you cannot run commands which gives problems

@Redned235 Redned235 added Confirmed Bug The bug reported is confirmed and able to be replicated. Priority: Medium labels Apr 3, 2020
@bundabrg
Copy link
Collaborator Author

bundabrg commented Apr 4, 2020

It also breaks many json strings so lots of output breaks if you have a space. It does make me wonder how you run commands on bedrock with a space unless it uses quotes?

@alissonlauffer
Copy link
Contributor

alissonlauffer commented Apr 4, 2020

I can't confirm this but I'm sure I remember testing that Xbox doesn't allow you to register the same name if the space or underscore is already taken. Could anyone check this to see if it's true or just something I dreamt up. smile

Minecraft Bedrock and Xbox doesn't allow nicknames with underscores (When you try to add an underscore to your nickname, it will fail).

@alissonlauffer
Copy link
Contributor

alissonlauffer commented Apr 4, 2020

I think there's no issue replacing spaces with underscores for server side, because you can't have the same nickname with spaces and underscores (because underscores are not supported by bedrock), unless you are using some custom Bedrock client that allow you to use nicknames with underscores (That vulnerability could be fixed by asserting if the bedrock nickname has forbidden characters. If forbidden characters are found, the player will not be able to login).

@Heath123
Copy link
Contributor

Heath123 commented Apr 4, 2020

That just moved the goal posts though. Now someone can log in with user1 instead to either server.

I can't think of any easy way except for just treating them the same so that you can never have both users logged in at the same time. It does open a security hole for users with spaces or underscores though.

Only other option is to see if java edition allows some character that you cant use normally and use that char instead to map but this may cause other issues.

Then call them user2 or user12

@bundabrg
Copy link
Collaborator Author

bundabrg commented Apr 5, 2020

The vulnerability is this:

  1. Lets say "User Name" logs in via bedrock, and gets assigned a new name "user1"
  2. Another user can then log in via Java Client as "user1" and be the same user.

There is no way to prevent the above apart from renaming the players to names that are invalid to register with mojang for java minecraft but are still accepted to log in. I'm talking online servers with a whitelist rather than offline since offline can just use another authentication plugin.

It's not a huge issue since admins/ops can be required to rename their accounts to ones that can't possibly be collided with or forbid login as them from a particular client.

@rtm516
Copy link
Member

rtm516 commented Apr 5, 2020

The default config adds a star to the front of the Xbox username, which is something you cannot have in a Java username so doesn't that fix the duplicate names issue?

@Heath123
Copy link
Contributor

Heath123 commented Apr 5, 2020

The default config adds a star to the front of the Xbox username, which is something you cannot have in a Java username so doesn't that fix the duplicate names issue?

We were talking about 2 Bedrock accounts having the same name

@yeenbean
Copy link

yeenbean commented Mar 3, 2021

Forgive me, I'm not sure if I should open a new issue or not.

Another unintended side effect of gamer tags with spaces is the inability to link Java and Bedrock accounts with Floodgate. I did try replacing the space with an underscore, but it does not work. Is there a possible workaround for this?

@jackson-57
Copy link
Member

Have you tried wrapping the bedrock username in quotes?

@yeenbean
Copy link

yeenbean commented Mar 3, 2021

Yes. The command returns usage instructions, so I guess it doesn't understand the input that way.

@Redned235
Copy link
Member

This is a toggle within Floodgate now. Only setup where this would really benefit is offline mode which we don't support. Thanks for reporting this though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Confirmed Bug The bug reported is confirmed and able to be replicated. Priority: Medium
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants