security problem with Java ScriptEngine

前端 未结 3 1540
醉酒成梦
醉酒成梦 2020-12-11 03:18

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 withou

相关标签:
3条回答
  • 2020-12-11 03:46

    I solved this by putting "importPackage = null" on the top of all scripts, it seems to work but Im not sure if this hack can be avoided.

    0 讨论(0)
  • 2020-12-11 03:53

    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.

    0 讨论(0)
  • 2020-12-11 04:04

    Use the Java Security Manager. Refer this answer for an example.

    0 讨论(0)
提交回复
热议问题