Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: formatted code

...

Code Block
public interface CallBack {
  void callMethod();
}
 
class CallBackImpl implements CallBack {
    public void callMethod() {
        System.out.println("Callback called");
    }
}
 
class Client {
    public void register(CallBack callback) {
        callback.callMethod();
    }

    public static void main(String[] args) {
        Client client = new Client();
        CallBack callBack = new CallBackImpl();
        client.register(callBack);
    }
} 

Frequently, callback methods are given full privileges which can make them attractive targets. If these methods accept arguments from untrusted code, privilege escalation may occur.

...