This rule is Obsolete | |
Synopsis: | Don't return an internal array directly. |
Language: | Java |
Severity Level: | 2 |
Category: | SecurityCodeGuidelines |
Description: |
Exposing internal arrays directly allows the user to modify some code that could be critical.
It is safer to return a copy of the array.public class SecureSystem { UserData [] ud; public UserData [] getUserData() { // Don't return directly the internal array, return a copy return ud; } } |