Title: [2216] trunk: Add permissions for Java, CGLIB and Hibernate proxies.
Revision
2216
Author
joehni
Date
2014-01-19 06:07:15 -0600 (Sun, 19 Jan 2014)

Log Message

Add permissions for Java, CGLIB and Hibernate proxies.

Modified Paths


Added Paths

Diff

Added: trunk/xstream/src/java/com/thoughtworks/xstream/security/CGLIBProxyTypePermission.java (0 => 2216)


--- trunk/xstream/src/java/com/thoughtworks/xstream/security/CGLIBProxyTypePermission.java	                        (rev 0)
+++ trunk/xstream/src/java/com/thoughtworks/xstream/security/CGLIBProxyTypePermission.java	2014-01-19 12:07:15 UTC (rev 2216)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2014 XStream Committers.
+ * All rights reserved.
+ *
+ * Created on 19. January 2014 by Joerg Schaible
+ */
+package com.thoughtworks.xstream.security;
+
+import net.sf.cglib.proxy.Proxy;
+
+
+/**
+ * Permission for any array type.
+ * 
+ * @author Jörg Schaible
+ * @since upcoming
+ */
+public class CGLIBProxyTypePermission implements TypePermission {
+    /**
+     * @since upcoming
+     */
+    public static final TypePermission PROXIES = new CGLIBProxyTypePermission();
+
+    @Override
+    public boolean allows(final Class<?> type) {
+        return type != null && Proxy.isProxyClass(type);
+    }
+
+    @Override
+    public int hashCode() {
+        return 19;
+    }
+
+    @Override
+    public boolean equals(final Object obj) {
+        return obj != null && obj.getClass() == CGLIBProxyTypePermission.class;
+    }
+}
Property changes on: trunk/xstream/src/java/com/thoughtworks/xstream/security/CGLIBProxyTypePermission.java
___________________________________________________________________

Added: svn:keywords

Added: svn:eol-style

Added: trunk/xstream/src/java/com/thoughtworks/xstream/security/ProxyTypePermission.java (0 => 2216)


--- trunk/xstream/src/java/com/thoughtworks/xstream/security/ProxyTypePermission.java	                        (rev 0)
+++ trunk/xstream/src/java/com/thoughtworks/xstream/security/ProxyTypePermission.java	2014-01-19 12:07:15 UTC (rev 2216)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2014 XStream Committers.
+ * All rights reserved.
+ *
+ * Created on 19. January 2014 by Joerg Schaible
+ */
+package com.thoughtworks.xstream.security;
+
+import java.lang.reflect.Proxy;
+
+
+/**
+ * Permission for any array type.
+ * 
+ * @author J&ouml;rg Schaible
+ * @since upcoming
+ */
+public class ProxyTypePermission implements TypePermission {
+    /**
+     * @since upcoming
+     */
+    public static final TypePermission PROXIES = new ProxyTypePermission();
+
+    @Override
+    public boolean allows(final Class<?> type) {
+        return type != null && Proxy.isProxyClass(type);
+    }
+
+    @Override
+    public int hashCode() {
+        return 17;
+    }
+
+    @Override
+    public boolean equals(final Object obj) {
+        return obj != null && obj.getClass() == ProxyTypePermission.class;
+    }
+}
Property changes on: trunk/xstream/src/java/com/thoughtworks/xstream/security/ProxyTypePermission.java
___________________________________________________________________

Added: svn:keywords

Added: svn:eol-style

Modified: trunk/xstream-distribution/src/content/security.html (2215 => 2216)


--- trunk/xstream-distribution/src/content/security.html	2014-01-18 21:55:17 UTC (rev 2215)
+++ trunk/xstream-distribution/src/content/security.html	2014-01-19 12:07:15 UTC (rev 2216)
@@ -158,11 +158,21 @@
 	    <td>&nbsp;</td>
 	</tr>
 	<tr>
+	    <td><a href=""
+	    <td>Allow any CGLIB proxy type.</td>
+	    <td>&nbsp;</td>
+	</tr>
+	<tr>
 	    <td><a href=""
 	    <td>Allow types explicitly by name.</td>
 	    <td>&nbsp;</td>
 	</tr>
 	<tr>
+	    <td><a href=""
+	    <td>Allow any Hibernate proxy type. Implementation is located in XStream's Hibernate extension.</td>
+	    <td>&nbsp;</td>
+	</tr>
+	<tr>
 	    <td><a href=""
 	    <td>Invert any other permission.  Instances of this type are used by XStream in the deny methods.</td>
 	    <td class="example">&nbsp;</td>
@@ -178,6 +188,11 @@
 	    <td>&nbsp;</td>
 	</tr>
 	<tr>
+	    <td><a href=""
+	    <td>Allow any Java proxy type.</td>
+	    <td>&nbsp;</td>
+	</tr>
+	<tr>
 	    <td><a href=""
 	    <td>Allow any type that matches with its name a regular _expression_.</td>
 	    <td class="example">.*\\.core\\..*<br/>[^$]+</td>
@@ -187,5 +202,6 @@
 	    <td>Allow any type that matches with its name a wildcard _expression_.</td>
 	    <td class="example">java.lang.*<br/>java.util.**</td>
 	</tr>
+    </table>
   </body>
  </html>

Added: trunk/xstream-hibernate/src/java/com/thoughtworks/xstream/hibernate/security/HibernateProxyTypePermission.java (0 => 2216)


--- trunk/xstream-hibernate/src/java/com/thoughtworks/xstream/hibernate/security/HibernateProxyTypePermission.java	                        (rev 0)
+++ trunk/xstream-hibernate/src/java/com/thoughtworks/xstream/hibernate/security/HibernateProxyTypePermission.java	2014-01-19 12:07:15 UTC (rev 2216)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2014 XStream Committers.
+ * All rights reserved.
+ *
+ * Created on 19. January 2014 by Joerg Schaible
+ */
+package com.thoughtworks.xstream.hibernate.security;
+
+import org.hibernate.proxy.HibernateProxy;
+
+import com.thoughtworks.xstream.security.TypePermission;
+
+
+/**
+ * Permission for any array type.
+ * 
+ * @author J&ouml;rg Schaible
+ * @since upcoming
+ */
+public class HibernateProxyTypePermission implements TypePermission {
+    /**
+     * @since upcoming
+     */
+    public static final TypePermission PROXIES = new HibernateProxyTypePermission();
+
+    @Override
+    public boolean allows(final Class<?> type) {
+        return type != null && HibernateProxy.class.isAssignableFrom(type);
+    }
+
+    @Override
+    public int hashCode() {
+        return 31;
+    }
+
+    @Override
+    public boolean equals(final Object obj) {
+        return obj != null && obj.getClass() == HibernateProxyTypePermission.class;
+    }
+}
Property changes on: trunk/xstream-hibernate/src/java/com/thoughtworks/xstream/hibernate/security/HibernateProxyTypePermission.java
___________________________________________________________________

Added: svn:keywords

Added: svn:eol-style


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to