XStream 1.4.10 警告: Security framework of XStream not initialized, XStream is probably vulnerable

参考:www.fengyunxiao.cn

 

XStream 1.4.10 出现警告:Security framework of XStream not initialized, XStream is probably vulnerable.

意思是:xstream 的安全框架没有初始化,xstream 容易受攻击。

解决方法:xStream对象设置默认安全防护,同时设置允许的类

 

XStream xStream = new XStream();
XStream.setupDefaultSecurity(xStream);
xStream.allowTypes(new Class[]{Test.class, Test2.class}); // 要关联的类

该警告应该只有新版的XStream会出现,感觉这种设计并不好。

参考:www.fengyunxiao.cn

原文地址:https://www.cnblogs.com/zscc/p/8321723.html