Skip to content

[HD Admin] Type confusion + numerical values in Contributors command field results in error #152

@kittymaya

Description

@kittymaya

Perhaps this repository is outdated, as I'm unable to find the relevant script within it, but I am submitting this issue nonetheless so that it may be seen.

LuaU's base library function tonumber is capable of taking decimal and hexadecimal numbers stored as strings and converting them to the number type. On lines 91 - 93 of ServerStorage.HDAdminServer.Modules.CommandHandler, values within a command's Contributors field are checked to be numerical by calling tonumber, presumably to check if a user ID was provided (rather than a username) before attempting to fetch the corresponding username. The relevant code snippet is shown below:

if infoName == "Contributors" and tonumber(v) then
    v = main.main:GetModule("cf"):GetName(v)
end

This will result in type confusion for usernames containing hexadecimal integers (e.g., "0xDEADBEEF"), as well as those containing purely numerical characters, where the username would be treated as a user ID. Additionally, a typo on line 92 results in the error attempt to index nil with 'GetModule' being thrown. I suggest changing this behavior so that any user ID that is provided must explicitly be a number, alongside fixing the mentioned typo, as demonstrated below:

if infoName == "Contributors" and typeof(v) == "number" then
    v = main:GetModule("cf"):GetName(v)
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions