NetLogo / HubNet-Webapp

A webapp that manages HubNet activities on a server.
4 stars 1 forks source link

Applet security issue: java.security.AccessControlException: access denied #6

Open lukas-shawford opened 13 years ago

lukas-shawford commented 13 years ago

When launching a new activity, the login dialog freezes for a couple seconds and then this error shows up in the Java console:

Exception in thread "Thread-90" java.security.AccessControlException: access denied (java.net.SocketPermission 228.5.8.80 connect,accept,resolve)
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:374)
    at java.security.AccessController.checkPermission(AccessController.java:546)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
    at java.lang.SecurityManager.checkMulticast(SecurityManager.java:1188)
    at java.net.MulticastSocket.joinGroup(MulticastSocket.java:270)
    at org.nlogo.hubnet.client.DiscoveryListener.run(DiscoveryListener.scala:73)

Solving this issue will require making some changes to NetLogo rather than this project, but it still affects this project.

Some technical notes on this issue from the mailing list:

In the regular HubNet client application, the login dialog includes a "server table" where you can pick an activity that's running on the local network. In the client applet, the server table is actually still there, it just isn't visible (that is, it's not added to the GUI). So it's still trying to scan the local network for any HubNet activities that are running. However, due to the security restrictions imposed on applets, they're not allowed to do that and it results in this exception. It doesn't break anything, but I do suspect that it causes the login dialog to hang for a couple seconds after it opens.

More technical info, partly for my own sake:

ClientApplet creates an instance of LoginDialog LoginDialog creates an instance of ServerTable and then calls serverTable.setActive(true) ServerTable.setActive creates an instance of DiscoveryListener and then calls discoveryListener.start(), which causes DiscoveryListener.run() to be executed DiscoveryListener.run() attempts to join a multicast group by calling MulticastSocket.joinGroup(), which results in the exception.

joshcough commented 13 years ago

I think we can restructure the code here so that DiscoveryListener doesn't run in applets. I'll make a ticket for 5.1 in trac on assembla.

joshcough commented 13 years ago

I created a ticket: https://trac.assembla.com/nlogo/ticket/1389

I hope to eventually get this done, but it seems like a pretty minor problem that isn't causing anything to fail outright. Would you agree?

lukas-shawford commented 13 years ago

Yes, I agree it's a minor problem.