core icon indicating copy to clipboard operation
core copied to clipboard

Better runtime guards

Open Fireboltofdeath opened this issue 2 years ago • 3 comments

Switch from @rbxts/t to a more powerful custom system which can include richer errors (e.g explaining what fields were incorrect), allowing recursive guards (but not cyclic) and including debug information (such as type names) (check plans)

This should also support incremental instance tracking so that modules like @flamework/components don't have to do full type checks.

Should incorporate with #28

Fireboltofdeath avatar Dec 19 '22 17:12 Fireboltofdeath

Should also make it so the server type guards are only accessible on the server because it makes it significantly easier for exploiters to reverse engineer the code.

Found by @TheGreatSageEqualToHeaven.

howmanysmall avatar Mar 22 '23 18:03 howmanysmall

because it makes it significantly easier for exploiters to reverse engineer the code.

Out of curiosity, what reverse engineering are you concerned exploiters will do? The type guards shouldn't really expose much valuable information on their own.

Fireboltofdeath avatar Mar 23 '23 01:03 Fireboltofdeath

what reverse engineering are you concerned exploiters will do?

Aside from just knowing what arguments you can pass which helps reverse the game, it stores every remote that you could possibly fire and their associated arguments, and it can also be used to leak in-development updates that are not publicly known.

In HowManySmall's game the events are obfuscated (actual event name hidden as to not get an angry message) and can be easily reversed using the events module either by matching the specific types or by lazily matching constants, if the events were shuffled then the lazy matching would not work however matching the types would work aside from a few that would have the same types but that can be accounted for by matching them from scripts where they are used, if server guards were only accessible on the server then matching them from actual scripts would be the only way to find them and you wouldn't have any information on how to use them apart from looking at the decompiled script. (example below)

image image

local constants = debug.getconstants(getscriptfunction(ReplicatedStorage.TS.events))
local DeobfuscatedNames = {}
DeobfuscatedNames["redacted"] = constants[64]