2
|
1 |
/*
|
|
2 |
* Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved.
|
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
|
7 |
* published by the Free Software Foundation. Sun designates this
|
|
8 |
* particular file as subject to the "Classpath" exception as provided
|
|
9 |
* by Sun in the LICENSE file that accompanied this code.
|
|
10 |
*
|
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
15 |
* accompanied this code).
|
|
16 |
*
|
|
17 |
* You should have received a copy of the GNU General Public License version
|
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
20 |
*
|
|
21 |
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
22 |
* CA 95054 USA or visit www.sun.com if you need additional information or
|
|
23 |
* have any questions.
|
|
24 |
*/
|
|
25 |
|
|
26 |
package java.io;
|
|
27 |
|
|
28 |
import java.security.*;
|
|
29 |
import java.util.Enumeration;
|
|
30 |
import java.util.Hashtable;
|
|
31 |
import java.util.StringTokenizer;
|
|
32 |
|
|
33 |
/**
|
|
34 |
* This class is for Serializable permissions. A SerializablePermission
|
|
35 |
* contains a name (also referred to as a "target name") but
|
|
36 |
* no actions list; you either have the named permission
|
|
37 |
* or you don't.
|
|
38 |
*
|
|
39 |
* <P>
|
|
40 |
* The target name is the name of the Serializable permission (see below).
|
|
41 |
*
|
|
42 |
* <P>
|
|
43 |
* The following table lists all the possible SerializablePermission target names,
|
|
44 |
* and for each provides a description of what the permission allows
|
|
45 |
* and a discussion of the risks of granting code the permission.
|
|
46 |
* <P>
|
|
47 |
*
|
|
48 |
* <table border=1 cellpadding=5 summary="Permission target name, what the permission allows, and associated risks">
|
|
49 |
* <tr>
|
|
50 |
* <th>Permission Target Name</th>
|
|
51 |
* <th>What the Permission Allows</th>
|
|
52 |
* <th>Risks of Allowing this Permission</th>
|
|
53 |
* </tr>
|
|
54 |
*
|
|
55 |
* <tr>
|
|
56 |
* <td>enableSubclassImplementation</td>
|
|
57 |
* <td>Subclass implementation of ObjectOutputStream or ObjectInputStream
|
|
58 |
* to override the default serialization or deserialization, respectively,
|
|
59 |
* of objects</td>
|
|
60 |
* <td>Code can use this to serialize or
|
|
61 |
* deserialize classes in a purposefully malfeasant manner. For example,
|
|
62 |
* during serialization, malicious code can use this to
|
|
63 |
* purposefully store confidential private field data in a way easily accessible
|
|
64 |
* to attackers. Or, during deserialization it could, for example, deserialize
|
|
65 |
* a class with all its private fields zeroed out.</td>
|
|
66 |
* </tr>
|
|
67 |
*
|
|
68 |
* <tr>
|
|
69 |
* <td>enableSubstitution</td>
|
|
70 |
* <td>Substitution of one object for another during
|
|
71 |
* serialization or deserialization</td>
|
|
72 |
* <td>This is dangerous because malicious code
|
|
73 |
* can replace the actual object with one which has incorrect or
|
|
74 |
* malignant data.</td>
|
|
75 |
* </tr>
|
|
76 |
*
|
|
77 |
* </table>
|
|
78 |
*
|
|
79 |
* @see java.security.BasicPermission
|
|
80 |
* @see java.security.Permission
|
|
81 |
* @see java.security.Permissions
|
|
82 |
* @see java.security.PermissionCollection
|
|
83 |
* @see java.lang.SecurityManager
|
|
84 |
*
|
|
85 |
*
|
|
86 |
* @author Joe Fialli
|
|
87 |
* @since 1.2
|
|
88 |
*/
|
|
89 |
|
|
90 |
/* code was borrowed originally from java.lang.RuntimePermission. */
|
|
91 |
|
|
92 |
public final class SerializablePermission extends BasicPermission {
|
|
93 |
|
|
94 |
private static final long serialVersionUID = 8537212141160296410L;
|
|
95 |
|
|
96 |
/**
|
|
97 |
* @serial
|
|
98 |
*/
|
|
99 |
private String actions;
|
|
100 |
|
|
101 |
/**
|
|
102 |
* Creates a new SerializablePermission with the specified name.
|
|
103 |
* The name is the symbolic name of the SerializablePermission, such as
|
|
104 |
* "enableSubstitution", etc.
|
|
105 |
*
|
|
106 |
* @param name the name of the SerializablePermission.
|
|
107 |
*
|
|
108 |
* @throws NullPointerException if <code>name</code> is <code>null</code>.
|
|
109 |
* @throws IllegalArgumentException if <code>name</code> is empty.
|
|
110 |
*/
|
|
111 |
public SerializablePermission(String name)
|
|
112 |
{
|
|
113 |
super(name);
|
|
114 |
}
|
|
115 |
|
|
116 |
/**
|
|
117 |
* Creates a new SerializablePermission object with the specified name.
|
|
118 |
* The name is the symbolic name of the SerializablePermission, and the
|
|
119 |
* actions String is currently unused and should be null.
|
|
120 |
*
|
|
121 |
* @param name the name of the SerializablePermission.
|
|
122 |
* @param actions currently unused and must be set to null
|
|
123 |
*
|
|
124 |
* @throws NullPointerException if <code>name</code> is <code>null</code>.
|
|
125 |
* @throws IllegalArgumentException if <code>name</code> is empty.
|
|
126 |
*/
|
|
127 |
|
|
128 |
public SerializablePermission(String name, String actions)
|
|
129 |
{
|
|
130 |
super(name, actions);
|
|
131 |
}
|
|
132 |
}
|