1 /*
2  * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Distribution License v. 1.0, which is available at
6  * http://www.eclipse.org/org/documents/edl-v10.php.
7  *
8  * SPDX-License-Identifier: BSD-3-Clause
9  */

10
11 package javax.xml.bind;
12
13 import java.security.BasicPermission;
14
15 /**
16  * This class is for JAXB permissions. A {@code JAXBPermission}
17  * contains a name (also referred to as a "target name") but
18  * no actions list; you either have the named permission
19  * or you don't.
20  *
21  * <P>
22  * The target name is the name of the JAXB permission (see below).
23  *
24  * <P>
25  * The following table lists all the possible {@code JAXBPermission} target names,
26  * and for each provides a description of what the permission allows
27  * and a discussion of the risks of granting code the permission.
28  *
29  * <table class="striped">
30  * <caption style="display:none">Permission target name, what the permission allows, and associated risks"</caption>
31  * <thead>
32  * <tr>
33  * <th scope="col">Permission Target Name</th>
34  * <th scope="col">What the Permission Allows</th>
35  * <th scope="col">Risks of Allowing this Permission</th>
36  * </tr>
37  * </thead>
38  *
39  * <tbody style="text-align:left">
40  * <tr>
41  *   <th scope="row">setDatatypeConverter</th>
42  *   <td>
43  *     Allows the code to set VM-wide {@link DatatypeConverterInterface}
44  *     via {@link DatatypeConverter#setDatatypeConverter(DatatypeConverterInterface) the setDatatypeConverter method}
45  *     that all the methods on {@link DatatypeConverter} uses.
46  *   </td>
47  *   <td>
48  *     Malicious code can set {@link DatatypeConverterInterface}, which has
49  *     VM-wide singleton semantics,  before a genuine JAXB implementation sets one.
50  *     This allows malicious code to gain access to objects that it may otherwise
51  *     not have access to, such as {@link java.awt.Frame#getFrames()} that belongs to
52  *     another application running in the same JVM.
53  *   </td>
54  * </tr>
55  * </tbody>
56  * </table>
57  *
58  * @see java.security.BasicPermission
59  * @see java.security.Permission
60  * @see java.security.Permissions
61  * @see java.security.PermissionCollection
62  * @see java.lang.SecurityManager
63  *
64  * @author Joe Fialli
65  * @since 1.7, JAXB 2.2
66  */

67
68 /* code was borrowed originally from java.lang.RuntimePermission. */
69 public final class JAXBPermission extends BasicPermission {
70     /**
71      * Creates a new JAXBPermission with the specified name.
72      *
73      * @param name
74      * The name of the JAXBPermission. As of 2.2 only "setDatatypeConverter"
75      * is defined.
76      */

77     public JAXBPermission(String name) {
78         super(name);
79     }
80
81     private static final long serialVersionUID = 1L;
82 }
83