Java ScriptEngine的安全问题 [英] security problem with Java ScriptEngine
问题描述
我刚刚开始使用Java ScriptEngine对我的应用程序进行一些扩展,然后我注意到我可以导入脚本中的所有java类并且无限制地使用它们。有没有办法指定脚本可以使用哪些类?我不希望他们做像 java.lang.System.exit(1);
I just started to use the Java ScriptEngine to do little extensions to my Application then i noticed that i can import all the java classes in the script and use them without restrictions. Is there a way to specify what classes a script can use? I dont want them to do things like java.lang.System.exit(1);
推荐答案
好吧,您似乎需要了解Java SecurityManager。这是一个非常大的主题,您可能想要阅读它,然后发布一个更具体的问题,如果您无法为它工作。
Well, you seem to need to learn about the Java SecurityManager. That's a pretty large topic, you might want to read up on it and then post a more specific question if you have trouble making it work for you.
这篇关于Java ScriptEngine的安全问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!