- Stuff about doPrivileged and passing null as second option
- System.setSecurityManager(null);
Issues caused because of not checking for null, leading to compromise.
Noncompliant Code Example
AccessController.doPrivileged(new PrivilegedAction<Void>() { public Void run() { ... } }, acc);
Compliant Solution
if (acc == null) { throw new SecurityException("Missing AccessControlContext"); } AccessController.doPrivileged(new PrivilegedAction<Void>() { public Void run() { ... } }, acc);
Noncompliant Code Example
System.setSecurityManager(null);