Jump to content
  • New id system through the console using Class: ClientInfoCollection and Method: GetForNameOrId


    Obsessive Compulsive

    Summary: This is code related. Running a player name through the console can create issue if their name has an underscore in it

     

    Game Version: A20 experimental

    Platform: PC

    OS/Version: Windows

    CPU Model: AMD Ryzen 5 3600

    System Memory: 16 GB

    GPU Model and VRAM: AMD 5500xt 4gig

    Screen Resolution: 1920x1080

    Video Settings: High

    Game mode: Client on dedi

     

    Did you wipe old saves? Yes

    Did you start a new game? Yes

    Did you validate your files? No

    Are you using any mods? Yes

    EAC on or off? On

     

    Status: NEW

     

    Bug Description: Console commands will trigger an error if a player name with an underscore is used. Example: givexp O_C 1000

     

    Detailed steps to reproduce the bug: 

     

    1) Run a console command against a player name that has an underscore in it

    2) 

    3) 

     

    Actual result: Console commands are passed through the ConsoleHelper.GetForNameOrId() to collect the Client Info it is to be used on. Console commands that trigger this are running the class: ClientInfoCollection and method: GetForNameOrId in the assembly code. This tries to collect the Platform Identifier using their name due to the underscore which causes an error

     

    Expected result: No error when running console commands against player names with underscores by adjusting the method to check against their name before attempting to ascertain whether it is a platform id. This method currently checks if it is an entity id, then if it a platform id and then a player name. If you run the player name before the platform id, it will fix this


    User Feedback

    Recommended Comments

    Sorry the fix is a bit more complicated than just the switch that I mentioned in the code. You need to check if the parameter contains one of the platform identifiers such as Local_  Steam_  or  XBL_  before running it as a potential id because a player name with an underscore will trigger an error in it. Any improper identifier likely triggers this

    Link to comment
    Share on other sites

    This is affecting console commands AI Director Spawn Scouts, Buff Player, Debuff Player, Teleport Player, White List.
    Also console commands Admin, Ban, Kick.

    Maybe the more important thing is Net Package Game Event Request which is used for the twitch integration I believe. This is using this class and method to grab the Client Info which would cause an error if their name has an underscore in it.

    One other thing I noticed is that due to checking the param as a possible player name last, it allows them to mimic another player by using their platform id or crossplatform id as the name. For example, if I changed my steam name to EOS_1a3b5c7a9b1c3a5b7c9a1b3c5a7b9c. I could then pretend to be someone else because it runs the platform id and crossplatform id check before the name check. The name should be checked against first and then the platform id.

    In certain circumstances some server managers such as botman, csmm can also be calling on this as a short cut to grab client info but run in to this error if using a player name with an underscore in it.

    Link to comment
    Share on other sites

    I have seen some changes in this method with experimental but it did not solve the issue.

    I am just going to copy pasta my fix for you.

    ClientInfo clientInfo = null;
                int entityId;
                if (int.TryParse(_nameOrId, out entityId))
                {
                    clientInfo = SingletonMonoBehaviour<ConnectionManager>.Instance.Clients.ForEntityId(_entityId);
                    if (clientInfo != null)
                    {
                        return clientInfo;
                    }
                }
                clientInfo = SingletonMonoBehaviour<ConnectionManager>.Instance.Clients.GetForPlayerName(_name);
                if (clientInfo != null)
                {
                    return clientInfo;
                }
                if (_nameOrId.Contains("Local_") || _nameOrId.Contains("EOS_") || _nameOrId.Contains("Steam_") || _nameOrId.Contains("XBL_") || _nameOrId.Contains("PSN_") || _nameOrId.Contains("EGS_"))
                {
                    PlatformUserIdentifierAbs userIdentifier;
                    if (PlatformUserIdentifierAbs.TryFromCombinedString(_nameOrId, out userIdentifier))
                    {
                        clientInfo = PersistentOperations.GetClientInfoFromUId(userIdentifier);
                        if (clientInfo != null)
                        {
                            return clientInfo;
                        }
                    }
                }

    Link to comment
    Share on other sites

    Did make a ticket a little while back about the underscore part, I will be looking into the secondary issue mentioned soon.

     

    When I checked that out only underscores had any effect on it, and although errors were thrown all the commands ran correctly. If you're having any issues with server manager/other command mods check back with those after it gets fixed and see if they run correctly.

    Link to comment
    Share on other sites

    On 12/22/2021 at 11:22 AM, Obsessive Compulsive said:

    One other thing I noticed is that due to checking the param as a possible player name last, it allows them to mimic another player by using their platform id or crossplatform id as the name. For example, if I changed my steam name to EOS_1a3b5c7a9b1c3a5b7c9a1b3c5a7b9c. I could then pretend to be someone else because it runs the platform id and crossplatform id check before the name check. The name should be checked against first and then the platform id.

     

    Hey, is there anyway you've bypassed Steam's character limit to do that if you tested it? The 32 char limit was hit unless I chopped off EOS_ which did not allow me to impersonate another user

    Link to comment
    Share on other sites



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...