Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: now code would compile

...

Code Block
class MaliciousCallBack implements CallBack {
  public void callMethod() {
    // Code here gets executed with elevated privileges
  }

  public static void main(String[] args) {
    CallBack callBack = new MaliciousCallBack();
    CallBackAction action = new CallBackAction(callBack);
    action.perform(); // Executes malicious code
  }
}

Compliant Solution 

According to Oracle's secure coding guidelines [SCG 2010]:

...