How do you forbid users from doing evil things in Groovy Scripts?

后端 未结 4 427
渐次进展
渐次进展 2021-01-22 06:17

I\'m planning to integrate Groovy Script Engine to my game so it will give the game nice moddability but how do you prevent players from writing evil scripts like deleting all f

4条回答
  •  心在旅途
    2021-01-22 06:41

    There's a blog post by Cedric Champeau on customising the Groovy Compilation process, the second part of it shows how to use SecureASTCustomizer and CompilerConfiguration to limit what Scripts can do (and then has examples of defining your own AST checks for System.exit, etc...

提交回复
热议问题