-
-
Notifications
You must be signed in to change notification settings - Fork 650
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
fix: getstorage talkaction #3200
base: main
Are you sure you want to change the base?
Conversation
@dudantas please have a look 🤭 |
Quality Gate passedIssues Measures |
Using loadstring here introduces potential security and performance risks, especially if the input (split[2]) is user-provided or not sanitized. A safer and more efficient approach would be to directly attempt converting the value to a number or treating it as a string key if the conversion fails. This would eliminate the need for dynamically executed code and improve both the safety and clarity of the implementation. Example alternative: local storageKey = tonumber(split[2]) or split[2]
local storageValue = target:getStorageValue(storageKey)
self:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The storage with id: " .. split[1] .. " is: " .. storageValue .. ".") This ensures the same functionality without the risks associated with loadstring. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Address what I said in the previous comment, as it is very critical.
Description
Fix the getstorage talkaction used by server admins, which helps imensely with quest debugging.
Behaviour
Actual
Whenever the talkaction /getstorage Player, storagename is called, the server receives a string (storage name) or a number (storage key) as parameters, the key works fine, but the name should not be a string, it should be converted to the actual global storage variable type.
Expected
Given the admin prepares the /getstorage talkaction to be sent;
When the admin sends the storage parameter as a string e.g (/getstorage GOD, Storage.Quest.U8_0.TheIceIslands.Questline);
Then the /getstorage talkaction accepts the string parameter correctly.
Type of change
Please delete options that are not relevant.
How Has This Been Tested
Test Configuration:
Checklist