...
Code Block | ||||
---|---|---|---|---|
| ||||
if (accessControlContext == null) { throw new SecurityException("Missing AccessControlContext"); } AccessController.doPrivileged(new PrivilegedAction<Void>() { public Void run() { // ... } }, accessControlContext); |
Noncompliant Code Example
This noncompliant code example ...
Code Block | ||||
---|---|---|---|---|
| ||||
System.setSecurityManager(null); |
Compliant Solution
This compliant solution ...
Code Block | ||||
---|---|---|---|---|
| ||||
System.setSecurityManager(new SecurityManager()); |
...
Applicability
Security-sensitive methods must be thoroughly understood and their parameters validated (to prevent null arguments for instance) in order to prevent corner cases with unexpected argument values. If unexpected argument values are passed to security-sensitive methods, arbitrary code execution becomes possible and privilege escalation becomes likely.
Bibliography
[TODO] | https://www.cigital.com/justice-league-blog/2009/08/14/proper-use-of-javas-securerandom/ |
[API 2011] |
|
...