1 /*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 *
4 * Copyright (c) 2007-2017 Oracle and/or its affiliates. All rights reserved.
5 *
6 * The contents of this file are subject to the terms of either the GNU
7 * General Public License Version 2 only ("GPL") or the Common Development
8 * and Distribution License("CDDL") (collectively, the "License"). You
9 * may not use this file except in compliance with the License. You can
10 * obtain a copy of the License at
11 * https://oss.oracle.com/licenses/CDDL+GPL-1.1
12 * or LICENSE.txt. See the License for the specific
13 * language governing permissions and limitations under the License.
14 *
15 * When distributing the software, include this License Header Notice in each
16 * file and include the License file at LICENSE.txt.
17 *
18 * GPL Classpath Exception:
19 * Oracle designates this particular file as subject to the "Classpath"
20 * exception as provided by Oracle in the GPL Version 2 section of the License
21 * file that accompanied this code.
22 *
23 * Modifications:
24 * If applicable, add the following below the License Header, with the fields
25 * enclosed by brackets [] replaced by your own identifying information:
26 * "Portions Copyright [year] [name of copyright owner]"
27 *
28 * Contributor(s):
29 * If you wish your version of this file to be governed by only the CDDL or
30 * only the GPL Version 2, indicate your decision by adding "[Contributor]
31 * elects to include this software in this distribution under the [CDDL or GPL
32 * Version 2] license." If you don't indicate a single choice of license, a
33 * recipient has the option to distribute your version of this file under
34 * either the CDDL, the GPL Version 2 or to extend the choice of license to
35 * its licensees as provided above. However, if you add GPL Version 2 code
36 * and therefore, elected the GPL Version 2 license, then the option applies
37 * only if the new code is made subject to such option by the copyright
38 * holder.
39 */
40
41 package javax.xml.bind;
42
43 import java.security.BasicPermission;
44
45 /**
46 * This class is for JAXB permissions. A {@code JAXBPermission}
47 * contains a name (also referred to as a "target name") but
48 * no actions list; you either have the named permission
49 * or you don't.
50 *
51 * <P>
52 * The target name is the name of the JAXB permission (see below).
53 *
54 * <P>
55 * The following table lists all the possible {@code JAXBPermission} target names,
56 * and for each provides a description of what the permission allows
57 * and a discussion of the risks of granting code the permission.
58 *
59 * <table class="striped">
60 * <caption style="display:none">Permission target name, what the permission allows, and associated risks"</caption>
61 * <thead>
62 * <tr>
63 * <th scope="col">Permission Target Name</th>
64 * <th scope="col">What the Permission Allows</th>
65 * <th scope="col">Risks of Allowing this Permission</th>
66 * </tr>
67 * </thead>
68 *
69 * <tbody style="text-align:left">
70 * <tr>
71 * <th scope="row">setDatatypeConverter</th>
72 * <td>
73 * Allows the code to set VM-wide {@link DatatypeConverterInterface}
74 * via {@link DatatypeConverter#setDatatypeConverter(DatatypeConverterInterface) the setDatatypeConverter method}
75 * that all the methods on {@link DatatypeConverter} uses.
76 * </td>
77 * <td>
78 * Malicious code can set {@link DatatypeConverterInterface}, which has
79 * VM-wide singleton semantics, before a genuine JAXB implementation sets one.
80 * This allows malicious code to gain access to objects that it may otherwise
81 * not have access to, such as {@link java.awt.Frame#getFrames()} that belongs to
82 * another application running in the same JVM.
83 * </td>
84 * </tr>
85 * </tbody>
86 * </table>
87 *
88 * @see java.security.BasicPermission
89 * @see java.security.Permission
90 * @see java.security.Permissions
91 * @see java.security.PermissionCollection
92 * @see java.lang.SecurityManager
93 *
94 * @author Joe Fialli
95 * @since 1.7, JAXB 2.2
96 */
97
98 /* code was borrowed originally from java.lang.RuntimePermission. */
99 public final class JAXBPermission extends BasicPermission {
100 /**
101 * Creates a new JAXBPermission with the specified name.
102 *
103 * @param name
104 * The name of the JAXBPermission. As of 2.2 only "setDatatypeConverter"
105 * is defined.
106 */
107 public JAXBPermission(String name) {
108 super(name);
109 }
110
111 private static final long serialVersionUID = 1L;
112 }
113