MovingBlocks / Terasology

Terasology - open source voxel world
http://terasology.org
Apache License 2.0
3.67k stars 1.34k forks source link

parameter passing by reference is performant bug might be insecure. #5176

Open soloturn opened 10 months ago

soloturn commented 10 months ago

parameter passing by reference

on a number of locations in the code static code analysis tools like pmd warn that data structures passed are stored and returned directly. while java has no pointers, this behaviour is similar, passing by reference. so an outside actor can change the contents of the structure. such a parameter passing may be a security leak especially in public APIs. see for example here for an explanation

for games, this is more a performance feature than a security leak.

keywords: MethodReturnsInternalArray, ArrayIsStoredDirectly,

Proposal

@jdrueckert wishes a more thorough discussion about the issue, and suggested to suppress the warning at the moment and link to this ticket, in a TODO.

jdrueckert commented 10 months ago

Associated Secure Code Guidelines: https://www.ing.iac.es//~docs/external/java/pmd/rules/sunsecure.html

While I agree that the code was likely written the way it was because the main focus was on performance, personally coming from a security point of view, I'm hesitant to just accept this as "likely not a problem in game development" without a proper criticality assessment of this security flaw - in particular as the respective PMD findings occurred in type handler code which is exposed enough to be of concern, especially in a multiplayer setup.