jdk/src/share/classes/java/lang/RuntimePermission.java
author ohair
Tue, 25 May 2010 15:58:33 -0700
changeset 5506 202f599c92aa
parent 1940 e81514210873
child 14667 6862285acf46
permissions -rw-r--r--
6943119: Rebrand source copyright notices Reviewed-by: darcy, weijun
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1940
diff changeset
     2
 * Copyright (c) 1997, 2005, 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
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * signify a wildcard match. For example: "loadLibrary.*" or "*" is valid,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * "*loadLibrary" or "a*b" is not valid.
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
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * <table border=1 cellpadding=5 summary="permission target name,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 *  what the target allows,and associated risks">
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * <th>Permission Target Name</th>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * <th>What the Permission Allows</th>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * <th>Risks of Allowing this Permission</th>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 *   <td>createClassLoader</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 *   <td>Creation of a class loader</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 *   <td>This is an extremely dangerous permission to grant.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * Malicious applications that can instantiate their own class
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * loaders could then load their own rogue classes into the system.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * These newly loaded classes could be placed into any protection
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * domain by the class loader, thereby automatically granting the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * classes the permissions for that domain.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 *   <td>getClassLoader</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 *   <td>Retrieval of a class loader (e.g., the class loader for the calling
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 * class)</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 *   <td>This would grant an attacker permission to get the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * class loader for a particular class. This is dangerous because
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 * having access to a class's class loader allows the attacker to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 * load other classes available to that class loader. The attacker
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 * would typically otherwise not have access to those classes.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 *   <td>setContextClassLoader</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 *   <td>Setting of the context class loader used by a thread</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 *   <td>The context class loader is used by system code and extensions
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 * when they need to lookup resources that might not exist in the system
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 * class loader. Granting setContextClassLoader permission would allow
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 * code to change which context class loader is used
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 * for a particular thread, including system threads.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
 *   <td>enableContextClassLoaderOverride</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
 *   <td>Subclass implementation of the thread context class loader methods</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
 *   <td>The context class loader is used by system code and extensions
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
 * when they need to lookup resources that might not exist in the system
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
 * class loader. Granting enableContextClassLoaderOverride permission would allow
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
 * a subclass of Thread to override the methods that are used
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
 * to get or set the context class loader for a particular thread.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
 * <tr>
1940
e81514210873 4167874: URL-downloaded jar files can consume all available file descriptors
michaelm
parents: 2
diff changeset
   103
 *   <td>closeClassLoader</td>
e81514210873 4167874: URL-downloaded jar files can consume all available file descriptors
michaelm
parents: 2
diff changeset
   104
 *   <td>Closing of a ClassLoader</td>
e81514210873 4167874: URL-downloaded jar files can consume all available file descriptors
michaelm
parents: 2
diff changeset
   105
 *   <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
   106
 * that it has a reference to.</td>
e81514210873 4167874: URL-downloaded jar files can consume all available file descriptors
michaelm
parents: 2
diff changeset
   107
 * </tr>
e81514210873 4167874: URL-downloaded jar files can consume all available file descriptors
michaelm
parents: 2
diff changeset
   108
 *
e81514210873 4167874: URL-downloaded jar files can consume all available file descriptors
michaelm
parents: 2
diff changeset
   109
 * <tr>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
 *   <td>setSecurityManager</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
 *   <td>Setting of the security manager (possibly replacing an existing one)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
 * </td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
 *   <td>The security manager is a class that allows
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
 * applications to implement a security policy. Granting the setSecurityManager
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
 * permission would allow code to change which security manager is used by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
 * installing a different, possibly less restrictive security manager,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
 * thereby bypassing checks that would have been enforced by the original
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
 * security manager.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
 *   <td>createSecurityManager</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
 *   <td>Creation of a new security manager</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
 *   <td>This gives code access to protected, sensitive methods that may
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
 * disclose information about other classes or the execution stack.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
 *   <td>getenv.{variable name}</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
 *   <td>Reading of the value of the specified environment variable</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
 *   <td>This would allow code to read the value, or determine the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
 *       existence, of a particular environment variable.  This is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
 *       dangerous if the variable contains confidential data.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
 *   <td>exitVM.{exit status}</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
 *   <td>Halting of the Java Virtual Machine with the specified exit status</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
 *   <td>This allows an attacker to mount a denial-of-service attack
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
 * by automatically forcing the virtual machine to halt.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
 * Note: The "exitVM.*" permission is automatically granted to all code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
 * loaded from the application class path, thus enabling applications
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
 * to terminate themselves. Also, the "exitVM" permission is equivalent to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
 * "exitVM.*".</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
 *   <td>shutdownHooks</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
 *   <td>Registration and cancellation of virtual-machine shutdown hooks</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
 *   <td>This allows an attacker to register a malicious shutdown
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
 * hook that interferes with the clean shutdown of the virtual machine.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
 *   <td>setFactory</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
 *   <td>Setting of the socket factory used by ServerSocket or Socket,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
 * or of the stream handler factory used by URL</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
 *   <td>This allows code to set the actual implementation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
 * for the socket, server socket, stream handler, or RMI socket factory.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
 * An attacker may set a faulty implementation which mangles the data
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
 * stream.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
 *   <td>setIO</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
 *   <td>Setting of System.out, System.in, and System.err</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
 *   <td>This allows changing the value of the standard system streams.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
 * An attacker may change System.in to monitor and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
 * steal user input, or may set System.err to a "null" OutputStream,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
 * which would hide any error messages sent to System.err. </td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
 *   <td>modifyThread</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
 *   <td>Modification of threads, e.g., via calls to Thread
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
 * <tt>interrupt</tt>, <tt>stop</tt>, <tt>suspend</tt>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
 * <tt>resume</tt>, <tt>setDaemon</tt>, <tt>setPriority</tt>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
 * <tt>setName</tt> and <tt>setUncaughtExceptionHandler</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
 * methods</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
 * <td>This allows an attacker to modify the behaviour of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
 * any thread in the system.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
 *   <td>stopThread</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
 *   <td>Stopping of threads via calls to the Thread <code>stop</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
 * method</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
 *   <td>This allows code to stop any thread in the system provided that it is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
 * already granted permission to access that thread.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
 * This poses as a threat, because that code may corrupt the system by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
 * killing existing threads.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
 *   <td>modifyThreadGroup</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
 *   <td>modification of thread groups, e.g., via calls to ThreadGroup
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
 * <code>destroy</code>, <code>getParent</code>, <code>resume</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
 * <code>setDaemon</code>, <code>setMaxPriority</code>, <code>stop</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
 * and <code>suspend</code> methods</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
 *   <td>This allows an attacker to create thread groups and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
 * set their run priority.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
 *   <td>getProtectionDomain</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
 *   <td>Retrieval of the ProtectionDomain for a class</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
 *   <td>This allows code to obtain policy information
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
 * for a particular code source. While obtaining policy information
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
 * does not compromise the security of the system, it does give
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
 * attackers additional information, such as local file names for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
 * example, to better aim an attack.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
 *   <td>getFileSystemAttributes</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
 *   <td>Retrieval of file system attributes</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
 *   <td>This allows code to obtain file system information such as disk usage
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
 *       or disk space available to the caller.  This is potentially dangerous
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
 *       because it discloses information about the system hardware
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
 *       configuration and some information about the caller's privilege to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
 *       write files.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
 *   <td>readFileDescriptor</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
 *   <td>Reading of file descriptors</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
 *   <td>This would allow code to read the particular file associated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
 *       with the file descriptor read. This is dangerous if the file
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
 *       contains confidential data.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
 *   <td>writeFileDescriptor</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
 *   <td>Writing to file descriptors</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
 *   <td>This allows code to write to a particular file associated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
 *       with the descriptor. This is dangerous because it may allow
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
 *       malicious code to plant viruses or at the very least, fill up
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
 *       your entire disk.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
 *   <td>loadLibrary.{library name}</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
 *   <td>Dynamic linking of the specified library</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
 *   <td>It is dangerous to allow an applet permission to load native code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
 * libraries, because the Java security architecture is not designed to and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
 * does not prevent malicious behavior at the level of native code.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
 *   <td>accessClassInPackage.{package name}</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
 *   <td>Access to the specified package via a class loader's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
 * <code>loadClass</code> method when that class loader calls
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
 * the SecurityManager <code>checkPackageAccess</code> method</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
 *   <td>This gives code access to classes in packages
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
 * to which it normally does not have access. Malicious code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
 * may use these classes to help in its attempt to compromise
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
 * security in the system.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
 *   <td>defineClassInPackage.{package name}</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
 *   <td>Definition of classes in the specified package, via a class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
 * loader's <code>defineClass</code> method when that class loader calls
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
 * the SecurityManager <code>checkPackageDefinition</code> method.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
 *   <td>This grants code permission to define a class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
 * in a particular package. This is dangerous because malicious
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
 * code with this permission may define rogue classes in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
 * trusted packages like <code>java.security</code> or <code>java.lang</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
 * for example.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
 *   <td>accessDeclaredMembers</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
 *   <td>Access to the declared members of a class</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
 *   <td>This grants code permission to query a class for its public,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
 * protected, default (package) access, and private fields and/or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
 * methods. Although the code would have
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
 * access to the private and protected field and method names, it would not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
 * have access to the private/protected field data and would not be able
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
 * to invoke any private methods. Nevertheless, malicious code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
 * may use this information to better aim an attack.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
 * Additionally, it may invoke any public methods and/or access public fields
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
 * in the class.  This could be dangerous if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
 * the code would normally not be able to invoke those methods and/or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
 * access the fields  because
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
 * it can't cast the object to the class/interface with those methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
 * and fields.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
 *   <td>queuePrintJob</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
 *   <td>Initiation of a print job request</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
 *   <td>This could print sensitive information to a printer,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
 * or simply waste paper.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
 *   <td>getStackTrace</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
 *   <td>Retrieval of the stack trace information of another thread.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
 *   <td>This allows retrieval of the stack trace information of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
 * another thread.  This might allow malicious code to monitor the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
 * execution of threads and discover vulnerabilities in applications.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
 *   <td>setDefaultUncaughtExceptionHandler</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
 *   <td>Setting the default handler to be used when a thread
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
 *   terminates abruptly due to an uncaught exception</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
 *   <td>This allows an attacker to register a malicious
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
 *   uncaught exception handler that could interfere with termination
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
 *   of a thread</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
 *   <td>preferences</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
 *   <td>Represents the permission required to get access to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
 *   java.util.prefs.Preferences implementations user or system root
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
 *   which in turn allows retrieval or update operations within the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
 *   Preferences persistent backing store.) </td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
 *   <td>This permission allows the user to read from or write to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
 *   preferences backing store if the user running the code has
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
 *   sufficient OS privileges to read/write to that backing store.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
 *   The actual backing store may reside within a traditional filesystem
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
 *   directory or within a registry depending on the platform OS</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
 *   <td>usePolicy</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
 *   <td>Granting this permission disables the Java Plug-In's default
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
 *   security prompting behavior.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
 *   <td>For more information, refer to Java Plug-In's guides, <a href=
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
 *   "../../../technotes/guides/plugin/developer_guide/security.html">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
 *   Applet Security Basics</a> and <a href=
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
 *   "../../../technotes/guides/plugin/developer_guide/rsa_how.html#use">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
 *   usePolicy Permission</a>.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
 * </table>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
 * @see java.security.BasicPermission
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
 * @see java.security.Permission
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
 * @see java.security.Permissions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
 * @see java.security.PermissionCollection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
 * @see java.lang.SecurityManager
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
 * @author Marianne Mueller
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
 * @author Roland Schemers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
public final class RuntimePermission extends BasicPermission {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
    private static final long serialVersionUID = 7399184964622342223L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
     * Creates a new RuntimePermission with the specified name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
     * The name is the symbolic name of the RuntimePermission, such as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
     * "exit", "setFactory", etc. An asterisk
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
     * may appear at the end of the name, following a ".", or by itself, to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
     * signify a wildcard match.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
     * @param name the name of the RuntimePermission.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
     * @throws NullPointerException if <code>name</code> is <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
     * @throws IllegalArgumentException if <code>name</code> is empty.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
    public RuntimePermission(String name)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
        super(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
    }
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 object with the specified name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
     * The name is the symbolic name of the RuntimePermission, and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
     * actions String is currently unused and should be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
     * @param name the name of the RuntimePermission.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
     * @param actions should be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
     * @throws NullPointerException if <code>name</code> is <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
     * @throws IllegalArgumentException if <code>name</code> is empty.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
    public RuntimePermission(String name, String actions)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
        super(name, actions);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
}