Configure XStream security and resolve itest bundles (#8663)
* Configures XStream security to prevent "Security framework of XStream not initialized, XStream is probably vulnerable" warnings. * Resolves the itest bundles for the upgrade to XStream 1.4.13 Related to openhab/openhab-core#1688 Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
@@ -64,6 +64,8 @@ public class CcuGateway extends AbstractHomematicGateway {
|
||||
HttpClient httpClient) {
|
||||
super(id, config, gatewayAdapter, httpClient);
|
||||
|
||||
XStream.setupDefaultSecurity(xStream);
|
||||
xStream.allowTypesByWildcard(new String[] { HmDevice.class.getPackageName() + ".**" });
|
||||
xStream.setClassLoader(CcuGateway.class.getClassLoader());
|
||||
xStream.autodetectAnnotations(true);
|
||||
xStream.alias("scripts", TclScriptList.class);
|
||||
|
||||
@@ -148,6 +148,8 @@ public class LcnPchkDiscoveryService extends AbstractDiscoveryService {
|
||||
|
||||
ServicesResponse xmlToServiceResponse(String response) {
|
||||
XStream xstream = new XStream(new StaxDriver());
|
||||
XStream.setupDefaultSecurity(xstream);
|
||||
xstream.allowTypesByWildcard(new String[] { ServicesResponse.class.getPackageName() + ".**" });
|
||||
xstream.setClassLoader(getClass().getClassLoader());
|
||||
xstream.autodetectAnnotations(true);
|
||||
xstream.alias("ServicesResponse", ServicesResponse.class);
|
||||
|
||||
@@ -49,15 +49,21 @@ public class DbXmlInfoReader {
|
||||
|
||||
xstream = new XStream(driver);
|
||||
|
||||
configureSecurity(xstream);
|
||||
setClassLoader(Project.class.getClassLoader());
|
||||
registerAliases(this.xstream);
|
||||
registerAliases(xstream);
|
||||
}
|
||||
|
||||
public void setClassLoader(ClassLoader classLoader) {
|
||||
private void configureSecurity(XStream xstream) {
|
||||
XStream.setupDefaultSecurity(xstream);
|
||||
xstream.allowTypesByWildcard(new String[] { Project.class.getPackageName() + ".**" });
|
||||
}
|
||||
|
||||
private void setClassLoader(ClassLoader classLoader) {
|
||||
xstream.setClassLoader(classLoader);
|
||||
}
|
||||
|
||||
public void registerAliases(XStream xstream) {
|
||||
private void registerAliases(XStream xstream) {
|
||||
xstream.alias("Project", Project.class);
|
||||
xstream.aliasField("AppVer", Project.class, "appVersion");
|
||||
xstream.aliasField("XMLVer", Project.class, "xmlVersion");
|
||||
|
||||
Reference in New Issue
Block a user