Yellow-Dog-Man / Resonite-Issues

Issue repository for Resonite.
https://resonite.com
137 stars 2 forks source link

Certain usernames can not be looked up using the resonite API #3085

Open Marshall-vak opened 3 days ago

Marshall-vak commented 3 days ago

Describe the bug?

Certain usernames can not be looked up using the resonite API. This prevents users from getting default permissions on headless.

To Reproduce

First, get a username with a backslash in it #3084

Then create a headless and set yourself to have permissions on it by default. Be sure to escape the quotes and the backslash you have ended up getting in your username. In this case "šŸ¦"\ being my account and "New Name"\ being the test account created in the name change issue.

{
    "$schema": "https://raw.githubusercontent.com/Yellow-Dog-Man/JSONSchemas/main/schemas/HeadlessConfig.schema.json",
    "loginCredential": "",
    "loginPassword": "",
    "startWorlds": [
        {
            "isEnabled": true,
            "loadWorldPresetName": "Grid",
            "defaultUserRoles": {
                "\"šŸ¦\"\\": "Admin",
                "\"New Name\"\\": "Builder",
            },
            "autoInviteUsernames": ["\"šŸ¦\"\\", "\"New Name\"\\"],
        }
    ]
}

Tada, it fails to give you permissions! But succeeds to invite the usernames to the session. Let's try looking up this username in the API to see if it exists: https://api.resonite.com/users/"šŸ¦"\?byUsername=true https://api.resonite.com/users/"New Name"\?byUsername=true

This returns

{"type":"https://tools.ietf.org/html/rfc9110#section-15.5.5","title":"Not Found","status":404,"traceId":"00-fc824330f92294dafc75a72fa4a1e915-8fef271860f7b68e-00"}

Expected behavior

The username should be able to be looked up using the API therefore should be able to get default permissions on a headless.

Screenshots

Image

Resonite Version Number

2024.10.8.1349

What Platforms does this occur on?

Linux, Windows

What headset if any do you use?

Headless

Log Files

Log was generated on a fresh installed headless with no mods using the following config file (credentials removed): Config.json

2e1e73f5-f2e8-4bcd-ac21-926d95b246ad - 2024.10.8.1349 - 2024-10-16 19_32_11.log

Additional Context

Although you can not lookup these usernames using: https://api.resonite.com/users/"šŸ¦"\?byUsername=true https://api.resonite.com/users/"New Name"\?byUsername=true

You can look them up using: https://api.resonite.com/users/?name="šŸ¦"\ https://api.resonite.com/users/?name="New Name"\

Reporters

Marshall_vak (mvak) NepuShiro (NepuShiro)

shiftyscales commented 3 days ago

Per your other issue, you should be able to resolve this by using another set of quotation marks wrapping the full name. E.g. ""New Name"/" and ""šŸ¦"/" Does that not work?

Marshall-vak commented 3 days ago

Simply adding quotes doesn't work in this context: https://api.resonite.com/users/""šŸ¦"\"?byUsername=true https://api.resonite.com/users/""New Name"\"?byUsername=true

Adding them to the other request makes that one not respond with anything aswell: https://api.resonite.com/users/?name=""šŸ¦"\" https://api.resonite.com/users/?name=""New Name"\"

Tested Config

The quotes being the added need to be escaped to make a valid JSON.

{
    "$schema": "https://raw.githubusercontent.com/Yellow-Dog-Man/JSONSchemas/main/schemas/HeadlessConfig.schema.json",
    "loginCredential": "",
    "loginPassword": "",
    "startWorlds": [
        {
            "isEnabled": true,
            "loadWorldPresetName": "Grid",
            "defaultUserRoles": {
                "\"\"šŸ¦\"\\\"": "Admin",
                "\"\"New Name\"\\\"": "Builder"
            },
            "autoInviteUsernames": ["\"šŸ¦\"\\", "\"New Name\"\\"]
        }
    ]
}

Log Files

I am providing the full log but I will save you some time as it does not work. User ""New Name"\" not found: NotFound

2e1e73f5-f2e8-4bcd-ac21-926d95b246ad - 2024.10.8.1349 - 2024-10-17 02_15_00.log