Warning | ||
---|---|---|
| ||
This guideline has been labeled void and designated for future elimination from the Cert Oracle Secure Coding Standard for Java. This guideline has not been erased yet in case it contains information that might still be useful. |
...
Code Block | ||
---|---|---|
| ||
public static final SomeType [] SOMETHINGS = { ... }; |
With this declaration, {{ Wiki Markup SOMETHINGS
\[1
\]
}}, etc. can be modified by clients of the code.
Compliant Solution
One approach is to have a private array and a public method that returns a copy of the array:
...
Search for vulnerabilities resulting from the violation of this guideline on the CERT website.
References
\[[JLS 2006|AA. References#JLS 06] \] Section 6.6, Access Control
\[ Wiki Markup
[Bloch 2008|AA. References#Bloch 08]\] Item 13: Minimize the accessibility of classes and members
...
SEC36-J. Ensure that the bytecode verifier is applied to all involved code upon any modification 09. Platform Security (SEC) 01. Declarations and Initialization (DCL)