Simple Permission Problem

bmpcardoso

New Member
Dear Terasology community,

First of all, congratulations on the Terasology project. From what I've seen so far, it's an awesome project with a lot of potential!

Now, I'll start my SOS request with a disclaimer: I've been away from the world of Java development for some time now so forgive me if I didn't fully get the docs regarding Terasology's sandboxing and security... I'm currently trying to request my server for aditional info when generating the world in my module's BaseFacetedWorldGenerator subclass. I'm using OkHttp library, imported through gradle. However, I'm getting an access denied exception.

OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder().url(URL).build();
try {
Response response = client.newCall(request).execute();
}
catch (Exception e) {
logger.info(e.toString());
}

>>> java.security.AccessControlException: access denied ("java.net.NetPermission" "getProxySelector")

Though this works by adding entries in the engine's whitelist, I wonder if there is a way to add request permissions from the code of a Terasology module?

Thanks!
 
Last edited:

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
Hey there :)

Currently permissions have to be requested in the engine. The underlying gestalt-module system including the sandbox & security stuff *does* have some support for allowing modules to request permissions, but that support hasn't been extended to Terasology yet, if that makes sense. It has come up a few times (thus the support in gestalt-module) but nobody has taken it to the next step yet with an implementation on the Terasology side

An alternative to having a module worry about HTTP like that there is an entire web facade you can put in front of the game server then query via API. See https://gianluca-nitti.github.io/GSoC-2017-devlog for an overview. Some more work may happen on it over this summer via GSOC again.
 
Top