【问题标题】:Remove additional function from Rhino shell从 Rhino shell 中移除附加功能
【发布时间】:2011-06-22 00:51:39
【问题描述】:

我想使用 Rhino 作为沙箱在服务器上运行用户提供的脚本。我想从不再有 Java 绑定的 PHP 中做到这一点,所以我必须使用命令行界面(Rhino shell)。

不幸的是,Rhino shell 在环境中添加了一些破坏沙盒字符的内在函数,例如文件访问和允许在系统上运行任意命令的runCommand()

有没有办法禁用它们?

【问题讨论】:

    标签: rhino rhino-security


    【解决方案1】:

    我发现我可以用 null 覆盖它们或删除它们:

    runCommand = null;
    delete runCommand;
    

    可以通过Global的getting all properties找出有哪些全局函数和对象,存储在this中:

    Object.getOwnPropertyNames(this);
    

    【讨论】:

      猜你喜欢
      • 2011-04-25
      • 2014-06-27
      • 2020-04-12
      • 2015-12-31
      • 2016-09-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多