author | jboes |
Tue, 24 Sep 2019 09:43:43 +0100 | |
changeset 58288 | 48e480e56aad |
parent 57956 | e0b8b019d2f5 |
child 58679 | 9c3209ff7550 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
57956
e0b8b019d2f5
8229997: Apply java.io.Serial annotations in java.base
darcy
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. |
2 | 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 |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 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 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 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> |
|
41230 | 43 |
* The following table lists the standard {@code SerializablePermission} target names, |
2 | 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 |
* |
|
45124
144479e89cdb
8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents:
41230
diff
changeset
|
47 |
* <table class="striped"> |
144479e89cdb
8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents:
41230
diff
changeset
|
48 |
* <caption style="display:none">Permission target name, what the permission allows, and associated risks</caption> |
144479e89cdb
8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents:
41230
diff
changeset
|
49 |
* <thead> |
2 | 50 |
* <tr> |
45881
aaec0fbe17ae
8184208: update class="striped" tables for accessibility
jjg
parents:
45124
diff
changeset
|
51 |
* <th scope="col">Permission Target Name</th> |
aaec0fbe17ae
8184208: update class="striped" tables for accessibility
jjg
parents:
45124
diff
changeset
|
52 |
* <th scope="col">What the Permission Allows</th> |
aaec0fbe17ae
8184208: update class="striped" tables for accessibility
jjg
parents:
45124
diff
changeset
|
53 |
* <th scope="col">Risks of Allowing this Permission</th> |
2 | 54 |
* </tr> |
45124
144479e89cdb
8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents:
41230
diff
changeset
|
55 |
* </thead> |
144479e89cdb
8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents:
41230
diff
changeset
|
56 |
* <tbody> |
2 | 57 |
* |
58 |
* <tr> |
|
45881
aaec0fbe17ae
8184208: update class="striped" tables for accessibility
jjg
parents:
45124
diff
changeset
|
59 |
* <th scope="row">enableSubclassImplementation</th> |
2 | 60 |
* <td>Subclass implementation of ObjectOutputStream or ObjectInputStream |
61 |
* to override the default serialization or deserialization, respectively, |
|
62 |
* of objects</td> |
|
63 |
* <td>Code can use this to serialize or |
|
64 |
* deserialize classes in a purposefully malfeasant manner. For example, |
|
65 |
* during serialization, malicious code can use this to |
|
66 |
* purposefully store confidential private field data in a way easily accessible |
|
67 |
* to attackers. Or, during deserialization it could, for example, deserialize |
|
68 |
* a class with all its private fields zeroed out.</td> |
|
69 |
* </tr> |
|
70 |
* |
|
71 |
* <tr> |
|
45881
aaec0fbe17ae
8184208: update class="striped" tables for accessibility
jjg
parents:
45124
diff
changeset
|
72 |
* <th scope="row">enableSubstitution</th> |
2 | 73 |
* <td>Substitution of one object for another during |
74 |
* serialization or deserialization</td> |
|
75 |
* <td>This is dangerous because malicious code |
|
76 |
* can replace the actual object with one which has incorrect or |
|
77 |
* malignant data.</td> |
|
78 |
* </tr> |
|
79 |
* |
|
41230 | 80 |
* <tr> |
45881
aaec0fbe17ae
8184208: update class="striped" tables for accessibility
jjg
parents:
45124
diff
changeset
|
81 |
* <th scope="row">serialFilter</th> |
41230 | 82 |
* <td>Setting a filter for ObjectInputStreams.</td> |
83 |
* <td>Code could remove a configured filter and remove protections |
|
84 |
* already established.</td> |
|
85 |
* </tr> |
|
45124
144479e89cdb
8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents:
41230
diff
changeset
|
86 |
* </tbody> |
2 | 87 |
* </table> |
88 |
* |
|
89 |
* @see java.security.BasicPermission |
|
90 |
* @see java.security.Permission |
|
91 |
* @see java.security.Permissions |
|
92 |
* @see java.security.PermissionCollection |
|
93 |
* @see java.lang.SecurityManager |
|
94 |
* |
|
95 |
* |
|
96 |
* @author Joe Fialli |
|
97 |
* @since 1.2 |
|
98 |
*/ |
|
99 |
||
100 |
/* code was borrowed originally from java.lang.RuntimePermission. */ |
|
101 |
||
102 |
public final class SerializablePermission extends BasicPermission { |
|
103 |
||
57956
e0b8b019d2f5
8229997: Apply java.io.Serial annotations in java.base
darcy
parents:
47216
diff
changeset
|
104 |
@java.io.Serial |
2 | 105 |
private static final long serialVersionUID = 8537212141160296410L; |
106 |
||
107 |
/** |
|
108 |
* @serial |
|
109 |
*/ |
|
110 |
private String actions; |
|
111 |
||
112 |
/** |
|
113 |
* Creates a new SerializablePermission with the specified name. |
|
114 |
* The name is the symbolic name of the SerializablePermission, such as |
|
115 |
* "enableSubstitution", etc. |
|
116 |
* |
|
117 |
* @param name the name of the SerializablePermission. |
|
118 |
* |
|
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
57956
diff
changeset
|
119 |
* @throws NullPointerException if {@code name} is {@code null}. |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
57956
diff
changeset
|
120 |
* @throws IllegalArgumentException if {@code name} is empty. |
2 | 121 |
*/ |
122 |
public SerializablePermission(String name) |
|
123 |
{ |
|
124 |
super(name); |
|
125 |
} |
|
126 |
||
127 |
/** |
|
128 |
* Creates a new SerializablePermission object with the specified name. |
|
129 |
* The name is the symbolic name of the SerializablePermission, and the |
|
130 |
* actions String is currently unused and should be null. |
|
131 |
* |
|
132 |
* @param name the name of the SerializablePermission. |
|
133 |
* @param actions currently unused and must be set to null |
|
134 |
* |
|
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
57956
diff
changeset
|
135 |
* @throws NullPointerException if {@code name} is {@code null}. |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
57956
diff
changeset
|
136 |
* @throws IllegalArgumentException if {@code name} is empty. |
2 | 137 |
*/ |
138 |
||
139 |
public SerializablePermission(String name, String actions) |
|
140 |
{ |
|
141 |
super(name, actions); |
|
142 |
} |
|
143 |
} |