首页
App
&
Coffee
文档
项目
分享
反馈
俱乐部
登录
注册
如果允许用户自己上传Template,需要注意哪些安全问题
Dull
2018-05-20 09:24
如果用户自己上传模板(Template Engine),要注意哪些安全问题?比如session、会不会执行服务端脚本的漏洞,或者把这部分隐藏在压缩的js代码里?
项目:
JFinal
1
评论区
JFinal
2018-05-20 16:34
jfinal enjoy 默认已经处理了安全问题,对于绝大部分场景都很安全,通过 com.jfinal.template.expr.ast.MethodKit.java 代码可以看到下面的安全保护:
1:禁止访问的类
System.class, Runtime.class, Thread.class,
Class.class, ClassLoader.class, File.class,
Compiler.class, InheritableThreadLocal.class,
Package.class, Process.class, RuntimePermission.class,
SecurityManager.class, ThreadGroup.class, ThreadLocal.class
2:禁止访问的方法名
"getClass", "getDeclaringClass", "forName", "newInstance", "getClassLoader",
"getMethod", "getMethods", "getField", "getFields",
"notify", "notifyAll", "wait",
"load", "exit", "loadLibrary", "halt",
"stop", "suspend", "resume", "setDaemon", "setPriority"
如果你的模板中出现上述被禁止访问的类和方法名,enjoy 会自动探测到并抛出异常
回复
发送
我要反馈
热门反馈
扫码入社
1:禁止访问的类
System.class, Runtime.class, Thread.class,
Class.class, ClassLoader.class, File.class,
Compiler.class, InheritableThreadLocal.class,
Package.class, Process.class, RuntimePermission.class,
SecurityManager.class, ThreadGroup.class, ThreadLocal.class
2:禁止访问的方法名
"getClass", "getDeclaringClass", "forName", "newInstance", "getClassLoader",
"getMethod", "getMethods", "getField", "getFields",
"notify", "notifyAll", "wait",
"load", "exit", "loadLibrary", "halt",
"stop", "suspend", "resume", "setDaemon", "setPriority"
如果你的模板中出现上述被禁止访问的类和方法名,enjoy 会自动探测到并抛出异常