jdk/src/java.base/share/classes/java/lang/RuntimePermission.java
author rriggs
Fri, 29 May 2015 14:04:12 -0400
changeset 30899 d2408e757489
parent 30378 c631cf59315d
child 32033 bf24e33c7919
permissions -rw-r--r--
8077350: JEP 102 Process API Updates Implementation Reviewed-by: chegar, plevart, psandoz, darcy, martin, alanb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
30899
d2408e757489 8077350: JEP 102 Process API Updates Implementation
rriggs
parents: 30378
diff changeset
     2
 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1940
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1940
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1940
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1940
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1940
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.lang;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.security.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.util.Enumeration;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.util.Hashtable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.util.StringTokenizer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * This class is for runtime permissions. A RuntimePermission
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * contains a name (also referred to as a "target name") but
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * no actions list; you either have the named permission
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * or you don't.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * The target name is the name of the runtime permission (see below). The
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * naming convention follows the  hierarchical property naming convention.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * Also, an asterisk
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * may appear at the end of the name, following a ".", or by itself, to
14667
6862285acf46 7167056: Clarify that BasicPermission names that contain non-wildcard asterisks are not invalid
mullan
parents: 5506
diff changeset
    44
 * signify a wildcard match. For example: "loadLibrary.*" and "*" signify a
6862285acf46 7167056: Clarify that BasicPermission names that contain non-wildcard asterisks are not invalid
mullan
parents: 5506
diff changeset
    45
 * wildcard match, while "*loadLibrary" and "a*b" do not.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * The following table lists all the possible RuntimePermission target names,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * and for each provides a description of what the permission allows
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * and a discussion of the risks of granting code the permission.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * <table border=1 cellpadding=5 summary="permission target name,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 *  what the target allows,and associated risks">
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * <th>Permission Target Name</th>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * <th>What the Permission Allows</th>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * <th>Risks of Allowing this Permission</th>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 *   <td>createClassLoader</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 *   <td>Creation of a class loader</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 *   <td>This is an extremely dangerous permission to grant.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * Malicious applications that can instantiate their own class
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * loaders could then load their own rogue classes into the system.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * These newly loaded classes could be placed into any protection
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * domain by the class loader, thereby automatically granting the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * classes the permissions for that domain.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 *   <td>getClassLoader</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 *   <td>Retrieval of a class loader (e.g., the class loader for the calling
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 * class)</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 *   <td>This would grant an attacker permission to get the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * class loader for a particular class. This is dangerous because
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * having access to a class's class loader allows the attacker to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 * load other classes available to that class loader. The attacker
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 * would typically otherwise not have access to those classes.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 *   <td>setContextClassLoader</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 *   <td>Setting of the context class loader used by a thread</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 *   <td>The context class loader is used by system code and extensions
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 * when they need to lookup resources that might not exist in the system
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 * class loader. Granting setContextClassLoader permission would allow
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 * code to change which context class loader is used
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 * for a particular thread, including system threads.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 *   <td>enableContextClassLoaderOverride</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
 *   <td>Subclass implementation of the thread context class loader methods</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
 *   <td>The context class loader is used by system code and extensions
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
 * when they need to lookup resources that might not exist in the system
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
 * class loader. Granting enableContextClassLoaderOverride permission would allow
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
 * a subclass of Thread to override the methods that are used
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
 * to get or set the context class loader for a particular thread.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
 * <tr>
1940
e81514210873 4167874: URL-downloaded jar files can consume all available file descriptors
michaelm
parents: 2
diff changeset
   102
 *   <td>closeClassLoader</td>
e81514210873 4167874: URL-downloaded jar files can consume all available file descriptors
michaelm
parents: 2
diff changeset
   103
 *   <td>Closing of a ClassLoader</td>
e81514210873 4167874: URL-downloaded jar files can consume all available file descriptors
michaelm
parents: 2
diff changeset
   104
 *   <td>Granting this permission allows code to close any URLClassLoader
e81514210873 4167874: URL-downloaded jar files can consume all available file descriptors
michaelm
parents: 2
diff changeset
   105
 * that it has a reference to.</td>
e81514210873 4167874: URL-downloaded jar files can consume all available file descriptors
michaelm
parents: 2
diff changeset
   106
 * </tr>
e81514210873 4167874: URL-downloaded jar files can consume all available file descriptors
michaelm
parents: 2
diff changeset
   107
 *
e81514210873 4167874: URL-downloaded jar files can consume all available file descriptors
michaelm
parents: 2
diff changeset
   108
 * <tr>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
 *   <td>setSecurityManager</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
 *   <td>Setting of the security manager (possibly replacing an existing one)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
 * </td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
 *   <td>The security manager is a class that allows
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
 * applications to implement a security policy. Granting the setSecurityManager
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
 * permission would allow code to change which security manager is used by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
 * installing a different, possibly less restrictive security manager,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
 * thereby bypassing checks that would have been enforced by the original
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
 * security manager.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
 *   <td>createSecurityManager</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
 *   <td>Creation of a new security manager</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
 *   <td>This gives code access to protected, sensitive methods that may
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
 * disclose information about other classes or the execution stack.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
 *   <td>getenv.{variable name}</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
 *   <td>Reading of the value of the specified environment variable</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
 *   <td>This would allow code to read the value, or determine the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
 *       existence, of a particular environment variable.  This is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
 *       dangerous if the variable contains confidential data.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
 *   <td>exitVM.{exit status}</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
 *   <td>Halting of the Java Virtual Machine with the specified exit status</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
 *   <td>This allows an attacker to mount a denial-of-service attack
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
 * by automatically forcing the virtual machine to halt.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
 * Note: The "exitVM.*" permission is automatically granted to all code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
 * loaded from the application class path, thus enabling applications
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
 * to terminate themselves. Also, the "exitVM" permission is equivalent to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
 * "exitVM.*".</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
 *   <td>shutdownHooks</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
 *   <td>Registration and cancellation of virtual-machine shutdown hooks</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
 *   <td>This allows an attacker to register a malicious shutdown
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
 * hook that interferes with the clean shutdown of the virtual machine.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
 *   <td>setFactory</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
 *   <td>Setting of the socket factory used by ServerSocket or Socket,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
 * or of the stream handler factory used by URL</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
 *   <td>This allows code to set the actual implementation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
 * for the socket, server socket, stream handler, or RMI socket factory.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
 * An attacker may set a faulty implementation which mangles the data
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
 * stream.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
 *   <td>setIO</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
 *   <td>Setting of System.out, System.in, and System.err</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
 *   <td>This allows changing the value of the standard system streams.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
 * An attacker may change System.in to monitor and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
 * steal user input, or may set System.err to a "null" OutputStream,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
 * which would hide any error messages sent to System.err. </td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
 *   <td>modifyThread</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
 *   <td>Modification of threads, e.g., via calls to Thread
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
 * <tt>interrupt</tt>, <tt>stop</tt>, <tt>suspend</tt>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
 * <tt>resume</tt>, <tt>setDaemon</tt>, <tt>setPriority</tt>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
 * <tt>setName</tt> and <tt>setUncaughtExceptionHandler</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
 * methods</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
 * <td>This allows an attacker to modify the behaviour of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
 * any thread in the system.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
 *   <td>stopThread</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
 *   <td>Stopping of threads via calls to the Thread <code>stop</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
 * method</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
 *   <td>This allows code to stop any thread in the system provided that it is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
 * already granted permission to access that thread.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
 * This poses as a threat, because that code may corrupt the system by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
 * killing existing threads.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
 *   <td>modifyThreadGroup</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
 *   <td>modification of thread groups, e.g., via calls to ThreadGroup
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
 * <code>destroy</code>, <code>getParent</code>, <code>resume</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
 * <code>setDaemon</code>, <code>setMaxPriority</code>, <code>stop</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
 * and <code>suspend</code> methods</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
 *   <td>This allows an attacker to create thread groups and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
 * set their run priority.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
 *   <td>getProtectionDomain</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
 *   <td>Retrieval of the ProtectionDomain for a class</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
 *   <td>This allows code to obtain policy information
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
 * for a particular code source. While obtaining policy information
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
 * does not compromise the security of the system, it does give
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
 * attackers additional information, such as local file names for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
 * example, to better aim an attack.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
 *   <td>getFileSystemAttributes</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
 *   <td>Retrieval of file system attributes</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
 *   <td>This allows code to obtain file system information such as disk usage
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
 *       or disk space available to the caller.  This is potentially dangerous
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
 *       because it discloses information about the system hardware
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
 *       configuration and some information about the caller's privilege to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
 *       write files.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
 *   <td>readFileDescriptor</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
 *   <td>Reading of file descriptors</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
 *   <td>This would allow code to read the particular file associated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
 *       with the file descriptor read. This is dangerous if the file
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
 *       contains confidential data.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
 *   <td>writeFileDescriptor</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
 *   <td>Writing to file descriptors</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
 *   <td>This allows code to write to a particular file associated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
 *       with the descriptor. This is dangerous because it may allow
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
 *       malicious code to plant viruses or at the very least, fill up
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
 *       your entire disk.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
 *   <td>loadLibrary.{library name}</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
 *   <td>Dynamic linking of the specified library</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
 *   <td>It is dangerous to allow an applet permission to load native code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
 * libraries, because the Java security architecture is not designed to and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
 * does not prevent malicious behavior at the level of native code.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
 *   <td>accessClassInPackage.{package name}</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
 *   <td>Access to the specified package via a class loader's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
 * <code>loadClass</code> method when that class loader calls
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
 * the SecurityManager <code>checkPackageAccess</code> method</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
 *   <td>This gives code access to classes in packages
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
 * to which it normally does not have access. Malicious code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
 * may use these classes to help in its attempt to compromise
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
 * security in the system.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
 *   <td>defineClassInPackage.{package name}</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
 *   <td>Definition of classes in the specified package, via a class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
 * loader's <code>defineClass</code> method when that class loader calls
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
 * the SecurityManager <code>checkPackageDefinition</code> method.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
 *   <td>This grants code permission to define a class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
 * in a particular package. This is dangerous because malicious
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
 * code with this permission may define rogue classes in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
 * trusted packages like <code>java.security</code> or <code>java.lang</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
 * for example.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
 *   <td>accessDeclaredMembers</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
 *   <td>Access to the declared members of a class</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
 *   <td>This grants code permission to query a class for its public,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
 * protected, default (package) access, and private fields and/or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
 * methods. Although the code would have
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
 * access to the private and protected field and method names, it would not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
 * have access to the private/protected field data and would not be able
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
 * to invoke any private methods. Nevertheless, malicious code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
 * may use this information to better aim an attack.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
 * Additionally, it may invoke any public methods and/or access public fields
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
 * in the class.  This could be dangerous if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
 * the code would normally not be able to invoke those methods and/or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
 * access the fields  because
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
 * it can't cast the object to the class/interface with those methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
 * and fields.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
 *   <td>queuePrintJob</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
 *   <td>Initiation of a print job request</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
 *   <td>This could print sensitive information to a printer,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
 * or simply waste paper.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
 *   <td>getStackTrace</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
 *   <td>Retrieval of the stack trace information of another thread.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
 *   <td>This allows retrieval of the stack trace information of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
 * another thread.  This might allow malicious code to monitor the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
 * execution of threads and discover vulnerabilities in applications.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
 *   <td>setDefaultUncaughtExceptionHandler</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
 *   <td>Setting the default handler to be used when a thread
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
 *   terminates abruptly due to an uncaught exception</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
 *   <td>This allows an attacker to register a malicious
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
 *   uncaught exception handler that could interfere with termination
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
 *   of a thread</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
 *   <td>preferences</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
 *   <td>Represents the permission required to get access to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
 *   java.util.prefs.Preferences implementations user or system root
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
 *   which in turn allows retrieval or update operations within the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
 *   Preferences persistent backing store.) </td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
 *   <td>This permission allows the user to read from or write to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
 *   preferences backing store if the user running the code has
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
 *   sufficient OS privileges to read/write to that backing store.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
 *   The actual backing store may reside within a traditional filesystem
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
 *   directory or within a registry depending on the platform OS</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
 *   <td>usePolicy</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
 *   <td>Granting this permission disables the Java Plug-In's default
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
 *   security prompting behavior.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
 *   <td>For more information, refer to Java Plug-In's guides, <a href=
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
 *   "../../../technotes/guides/plugin/developer_guide/security.html">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
 *   Applet Security Basics</a> and <a href=
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
 *   "../../../technotes/guides/plugin/developer_guide/rsa_how.html#use">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
 *   usePolicy Permission</a>.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
 * </tr>
30899
d2408e757489 8077350: JEP 102 Process API Updates Implementation
rriggs
parents: 30378
diff changeset
   336
 * <tr>
d2408e757489 8077350: JEP 102 Process API Updates Implementation
rriggs
parents: 30378
diff changeset
   337
 *   <td>manageProcess</td>
d2408e757489 8077350: JEP 102 Process API Updates Implementation
rriggs
parents: 30378
diff changeset
   338
 *   <td>Native process termination and information about processes
d2408e757489 8077350: JEP 102 Process API Updates Implementation
rriggs
parents: 30378
diff changeset
   339
 *       {@link ProcessHandle}.</td>
d2408e757489 8077350: JEP 102 Process API Updates Implementation
rriggs
parents: 30378
diff changeset
   340
 *   <td>Allows code to identify and terminate processes that it did not create.</td>
d2408e757489 8077350: JEP 102 Process API Updates Implementation
rriggs
parents: 30378
diff changeset
   341
 * </tr>
30378
c631cf59315d 8079186: Add 'localeServiceProvider' target in the class description of RuntimePermission
naoto
parents: 25859
diff changeset
   342
 *
c631cf59315d 8079186: Add 'localeServiceProvider' target in the class description of RuntimePermission
naoto
parents: 25859
diff changeset
   343
 * <tr>
c631cf59315d 8079186: Add 'localeServiceProvider' target in the class description of RuntimePermission
naoto
parents: 25859
diff changeset
   344
 *   <td>localeServiceProvider</td>
c631cf59315d 8079186: Add 'localeServiceProvider' target in the class description of RuntimePermission
naoto
parents: 25859
diff changeset
   345
 *   <td>This {@code RuntimePermission} is required to be granted to
c631cf59315d 8079186: Add 'localeServiceProvider' target in the class description of RuntimePermission
naoto
parents: 25859
diff changeset
   346
 *   classes which subclass and implement
c631cf59315d 8079186: Add 'localeServiceProvider' target in the class description of RuntimePermission
naoto
parents: 25859
diff changeset
   347
 *   {@code java.util.spi.LocaleServiceProvider}. The permission is
c631cf59315d 8079186: Add 'localeServiceProvider' target in the class description of RuntimePermission
naoto
parents: 25859
diff changeset
   348
 *   checked during invocation of the abstract base class constructor.
c631cf59315d 8079186: Add 'localeServiceProvider' target in the class description of RuntimePermission
naoto
parents: 25859
diff changeset
   349
 *   This permission ensures trust in classes which implement this
c631cf59315d 8079186: Add 'localeServiceProvider' target in the class description of RuntimePermission
naoto
parents: 25859
diff changeset
   350
 *   security-sensitive provider mechanism. </td>
c631cf59315d 8079186: Add 'localeServiceProvider' target in the class description of RuntimePermission
naoto
parents: 25859
diff changeset
   351
 *   <td>See <a href= "../util/spi/LocaleServiceProvider.html">
c631cf59315d 8079186: Add 'localeServiceProvider' target in the class description of RuntimePermission
naoto
parents: 25859
diff changeset
   352
 *   {@code java.util.spi.LocaleServiceProvider}</a> for more
c631cf59315d 8079186: Add 'localeServiceProvider' target in the class description of RuntimePermission
naoto
parents: 25859
diff changeset
   353
 *   information.</td>
c631cf59315d 8079186: Add 'localeServiceProvider' target in the class description of RuntimePermission
naoto
parents: 25859
diff changeset
   354
 * </tr>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
 * </table>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
 * @see java.security.BasicPermission
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
 * @see java.security.Permission
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
 * @see java.security.Permissions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
 * @see java.security.PermissionCollection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
 * @see java.lang.SecurityManager
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
 * @author Marianne Mueller
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
 * @author Roland Schemers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
public final class RuntimePermission extends BasicPermission {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
    private static final long serialVersionUID = 7399184964622342223L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
     * Creates a new RuntimePermission with the specified name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
     * The name is the symbolic name of the RuntimePermission, such as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
     * "exit", "setFactory", etc. An asterisk
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
     * may appear at the end of the name, following a ".", or by itself, to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
     * signify a wildcard match.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
     * @param name the name of the RuntimePermission.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
     * @throws NullPointerException if <code>name</code> is <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
     * @throws IllegalArgumentException if <code>name</code> is empty.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
    public RuntimePermission(String name)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
        super(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
     * Creates a new RuntimePermission object with the specified name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
     * The name is the symbolic name of the RuntimePermission, and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
     * actions String is currently unused and should be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
     * @param name the name of the RuntimePermission.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
     * @param actions should be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
     * @throws NullPointerException if <code>name</code> is <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
     * @throws IllegalArgumentException if <code>name</code> is empty.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
    public RuntimePermission(String name, String actions)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
        super(name, actions);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
}