1 /*
   2  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. 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.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle 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 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.
  24  */
  25 
  26 package javax.xml.bind;
  27 
  28 import java.security.BasicPermission;
  29 
  30 /**
  31  * This class is for JAXB permissions. A {@code JAXBPermission}
  32  * contains a name (also referred to as a "target name") but
  33  * no actions list; you either have the named permission
  34  * or you don't.
  35  *
  36  * <P>
  37  * The target name is the name of the JAXB permission (see below).
  38  *
  39  * <P>
  40  * The following table lists all the possible {@code JAXBPermission} target names,
  41  * and for each provides a description of what the permission allows
  42  * and a discussion of the risks of granting code the permission.
  43  * <P>
  44  *
  45  * <table border=1 cellpadding=5 summary="Permission target name, what the permission allows, and associated risks">
  46  * <tr>
  47  * <th>Permission Target Name</th>
  48  * <th>What the Permission Allows</th>
  49  * <th>Risks of Allowing this Permission</th>
  50  * </tr>
  51  *
  52  * <tr>
  53  *   <td>setDatatypeConverter</td>
  54  *   <td>
  55  *     Allows the code to set VM-wide {@link DatatypeConverterInterface}
  56  *     via {@link DatatypeConverter#setDatatypeConverter(DatatypeConverterInterface) the setDatatypeConverter method}
  57  *     that all the methods on {@link DatatypeConverter} uses.
  58  *   </td>
  59  *   <td>
  60  *     Malicious code can set {@link DatatypeConverterInterface}, which has
  61  *     VM-wide singleton semantics,  before a genuine JAXB implementation sets one.
  62  *     This allows malicious code to gain access to objects that it may otherwise
  63  *     not have access to, such as {@link java.awt.Frame#getFrames()} that belongs to
  64  *     another application running in the same JVM.
  65  *   </td>
  66  * </tr>
  67  * </table>
  68  *
  69  * @see java.security.BasicPermission
  70  * @see java.security.Permission
  71  * @see java.security.Permissions
  72  * @see java.security.PermissionCollection
  73  * @see java.lang.SecurityManager
  74  *
  75  * @author Joe Fialli
  76  * @since JAXB 2.2
  77  */
  78 
  79 /* code was borrowed originally from java.lang.RuntimePermission. */
  80 public final class JAXBPermission extends BasicPermission {
  81     /**
  82      * Creates a new JAXBPermission with the specified name.
  83      *
  84      * @param name
  85      * The name of the JAXBPermission. As of 2.2 only "setDatatypeConverter"
  86      * is defined.
  87      */
  88     public JAXBPermission(String name) {
  89         super(name);
  90     }
  91 
  92     private static final long serialVersionUID = 1L;
  93 }