-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Labels
Milestone
Description
Just trying to create a script engine:
ScriptEngine engine = new JRubyEngineFactory().getScriptEngine();
fails with an AccessControlException in JRuby 9.0.0.0 on Windows:
java.security.AccessControlException: access denied ("java.io.FilePermission" "uri:classloader:\META-INF\jruby.home" "read")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:457)
at java.security.AccessController.checkPermission(AccessController.java:884)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at java.lang.SecurityManager.checkRead(SecurityManager.java:888)
at java.io.File.exists(File.java:814)
at org.jruby.RubyInstanceConfig.setupEnvironment(RubyInstanceConfig.java:674)
at org.jruby.RubyInstanceConfig.<init>(RubyInstanceConfig.java:123)
at org.jruby.embed.internal.AbstractLocalContextProvider.getGlobalRuntimeConfigOrNew(AbstractLocalContextProvider.java:95)
at org.jruby.embed.internal.SingletonLocalContextProvider.initLocalContext(SingletonLocalContextProvider.java:56)
at org.jruby.embed.internal.SingletonLocalContextProvider.getProvider(SingletonLocalContextProvider.java:49)
at org.jruby.embed.ScriptingContainer.getProviderInstance(ScriptingContainer.java:267)
at org.jruby.embed.ScriptingContainer.<init>(ScriptingContainer.java:245)
at org.jruby.embed.jsr223.JRubyEngineFactory.getScriptEngine(JRubyEngineFactory.java:170)
RubyInstanceConfig#setupEnvironment is calling File#exists but fails to catch the potential exception from this method:
private void setupEnvironment(String jrubyHome) {
if (!new File(jrubyHome).exists() && !environment.containsKey("RUBY")) {
...
}
}
But in this situation, jrubyHome isn't even a file path, it's a URI.
I could add a quick check here that the path doesn't start with "uri:", but it isn't clear what the correct behaviour should be in this situation. Should the code be properly checking that the URI exists?
Reactions are currently unavailable