有谁知道如何实现类似于Google App Engine的白名单类访问方法?
我正在编写一个容器框架,它可以在容器中动态部署包含用户开发的类的 Jar 文件,然后使用 Web 界面执行 Jar 文件中的某些类。
其他一切都设置良好,包括验证。但是,要求仅允许从用户开发的类访问某些 JDK 和其他库类。显然,这是因为容器需要确保有人(有意或无意)最终运行了一段导致“不良”行为的 Java 代码。
一般来说,我可以在 Google 上找到几乎所有主题的内容。在这种情况下,我就是不能:(
I am writing a container framework that can dynamically deploy a Jar file containing user developed classes in the container, and then using a web interface execute certain classes from the Jar file.
Everything else is well set, including the validations. However, a requirement is to only allow access to certain JDK and other library classes from the user developed class. Clearly, this is due to the fact that the container will need an assurance that someone (intentionally or otherwise) ends up running a piece of Java code that results in a "bad" behavior.
Generally, I find stuff on Google on almost all topics. In this case, I just could not :(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请参阅我可以拒绝访问通过配置 java.policy 文件来创建 jvm 类?
它建议使用自定义类加载器
see Can i deny access to a jvm class by configuring java.policy file?
it suggests using a custom classloader
请注意,自定义类加载器不足以抵御恶意人员 - 他/她可以访问父类加载器并通过它加载受限制的类。除了自定义类加载器之外,您还应该设置 安全管理器并撤销
getClassLoader
权限(也许还有其他一些权限)。Note that a custom classloader is not enough against a malicious person - he/she can access a parent classloader and load the restricted classes through it. In addition to a custom classloader, you should set a security manager and revoke the
getClassLoader
permission (and, perhaps, some other permissions too).