Log Message
Merge TypeHierarchyPermission from trunk.
Modified Paths
- branches/v-1.4.x/xstream/src/java/com/thoughtworks/xstream/security/CGLIBProxyTypePermission.java
- branches/v-1.4.x/xstream/src/java/com/thoughtworks/xstream/security/ProxyTypePermission.java
- branches/v-1.4.x/xstream-distribution/src/content/security.html
Added Paths
Diff
Modified: branches/v-1.4.x/xstream/src/java/com/thoughtworks/xstream/security/CGLIBProxyTypePermission.java (2226 => 2227)
--- branches/v-1.4.x/xstream/src/java/com/thoughtworks/xstream/security/CGLIBProxyTypePermission.java 2014-01-24 23:20:49 UTC (rev 2226)
+++ branches/v-1.4.x/xstream/src/java/com/thoughtworks/xstream/security/CGLIBProxyTypePermission.java 2014-01-24 23:24:22 UTC (rev 2227)
@@ -22,7 +22,8 @@
public static final TypePermission PROXIES = new CGLIBProxyTypePermission();
public boolean allows(final Class type) {
- return type != null && Proxy.isProxyClass(type);
+ return type != null
+ && (Proxy.isProxyClass(type) || type.getName().startsWith(Proxy.class.getPackage().getName() + "."));
}
public int hashCode() {
Modified: branches/v-1.4.x/xstream/src/java/com/thoughtworks/xstream/security/ProxyTypePermission.java (2226 => 2227)
--- branches/v-1.4.x/xstream/src/java/com/thoughtworks/xstream/security/ProxyTypePermission.java 2014-01-24 23:20:49 UTC (rev 2226)
+++ branches/v-1.4.x/xstream/src/java/com/thoughtworks/xstream/security/ProxyTypePermission.java 2014-01-24 23:24:22 UTC (rev 2227)
@@ -8,7 +8,9 @@
import java.lang.reflect.Proxy;
+import com.thoughtworks.xstream.mapper.DynamicProxyMapper;
+
/**
* Permission for any array type.
*
@@ -22,7 +24,7 @@
public static final TypePermission PROXIES = new ProxyTypePermission();
public boolean allows(final Class type) {
- return type != null && Proxy.isProxyClass(type);
+ return type != null && (Proxy.isProxyClass(type) || type == DynamicProxyMapper.DynamicProxy.class);
}
public int hashCode() {
Copied: branches/v-1.4.x/xstream/src/java/com/thoughtworks/xstream/security/TypeHierarchyPermission.java (from rev 2226, trunk/xstream/src/java/com/thoughtworks/xstream/security/TypeHierarchyPermission.java) (0 => 2227)
--- branches/v-1.4.x/xstream/src/java/com/thoughtworks/xstream/security/TypeHierarchyPermission.java (rev 0)
+++ branches/v-1.4.x/xstream/src/java/com/thoughtworks/xstream/security/TypeHierarchyPermission.java 2014-01-24 23:24:22 UTC (rev 2227)
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2014 XStream Committers.
+ * All rights reserved.
+ *
+ * Created on 23. January 2014 by Joerg Schaible
+ */
+package com.thoughtworks.xstream.security;
+
+/**
+ * Permission for a type hierarchy with a name matching one in the provided list.
+ *
+ * @author Jörg Schaible
+ * @since upcoming
+ */
+public class TypeHierarchyPermission implements TypePermission {
+
+ private Class<?> type;
+
+ /**
+ * @since upcoming
+ */
+ public TypeHierarchyPermission(Class type) {
+ this.type = type;
+ }
+
+ public boolean allows(Class type) {
+ if (type == null)
+ return false;
+ return this.type.isAssignableFrom(type);
+ }
+
+}
Modified: branches/v-1.4.x/xstream-distribution/src/content/security.html (2226 => 2227)
--- branches/v-1.4.x/xstream-distribution/src/content/security.html 2014-01-24 23:20:49 UTC (rev 2226)
+++ branches/v-1.4.x/xstream-distribution/src/content/security.html 2014-01-24 23:24:22 UTC (rev 2227)
@@ -197,6 +197,11 @@
<td class="example">.*\\.core\\..*<br/>[^$]+</td>
</tr>
<tr>
+ <td><a href=""
+ <td>Allow types of a hierarchy.</td>
+ <td> </td>
+ </tr>
+ <tr>
<td><a href=""
<td>Allow any type that matches with its name a wildcard _expression_.</td>
<td class="example">java.lang.*<br/>java.util.**</td>
To unsubscribe from this list please visit:
