jdk/src/share/classes/java/lang/RuntimePermission.java
author martin
Mon, 10 Mar 2008 14:32:51 -0700
changeset 48 dc5744ca15ea
parent 2 90ce3da70b43
child 1940 e81514210873
permissions -rw-r--r--
4960438: (process) Need IO redirection API for subprocesses Reviewed-by: alanb, iris
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * Copyright 1997-2005 Sun Microsystems, Inc.  All Rights Reserved.
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
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
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
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
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>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
 *   <td>setSecurityManager</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
 *   <td>Setting of the security manager (possibly replacing an existing one)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
 * </td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
 *   <td>The security manager is a class that allows
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
 * applications to implement a security policy. Granting the setSecurityManager
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
 * permission would allow code to change which security manager is used by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
 * installing a different, possibly less restrictive security manager,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
 * thereby bypassing checks that would have been enforced by the original
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
 * security manager.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
 *   <td>createSecurityManager</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
 *   <td>Creation of a new security manager</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
 *   <td>This gives code access to protected, sensitive methods that may
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
 * disclose information about other classes or the execution stack.</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>getenv.{variable name}</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
 *   <td>Reading of the value of the specified environment variable</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
 *   <td>This would allow code to read the value, or determine the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
 *       existence, of a particular environment variable.  This is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
 *       dangerous if the variable contains confidential data.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
 *   <td>exitVM.{exit status}</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
 *   <td>Halting of the Java Virtual Machine with the specified exit status</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
 *   <td>This allows an attacker to mount a denial-of-service attack
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
 * by automatically forcing the virtual machine to halt.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
 * Note: The "exitVM.*" permission is automatically granted to all code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
 * loaded from the application class path, thus enabling applications
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
 * to terminate themselves. Also, the "exitVM" permission is equivalent to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
 * "exitVM.*".</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
 *   <td>shutdownHooks</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
 *   <td>Registration and cancellation of virtual-machine shutdown hooks</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
 *   <td>This allows an attacker to register a malicious shutdown
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
 * hook that interferes with the clean shutdown of the virtual machine.</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>setFactory</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
 *   <td>Setting of the socket factory used by ServerSocket or Socket,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
 * or of the stream handler factory used by URL</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
 *   <td>This allows code to set the actual implementation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
 * for the socket, server socket, stream handler, or RMI socket factory.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
 * An attacker may set a faulty implementation which mangles the data
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
 * stream.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
 *   <td>setIO</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
 *   <td>Setting of System.out, System.in, and System.err</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
 *   <td>This allows changing the value of the standard system streams.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
 * An attacker may change System.in to monitor and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
 * steal user input, or may set System.err to a "null" OutputStream,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
 * which would hide any error messages sent to System.err. </td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
 *   <td>modifyThread</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
 *   <td>Modification of threads, e.g., via calls to Thread
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
 * <tt>interrupt</tt>, <tt>stop</tt>, <tt>suspend</tt>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
 * <tt>resume</tt>, <tt>setDaemon</tt>, <tt>setPriority</tt>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
 * <tt>setName</tt> and <tt>setUncaughtExceptionHandler</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
 * methods</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
 * <td>This allows an attacker to modify the behaviour of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
 * any thread in the system.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
 *   <td>stopThread</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
 *   <td>Stopping of threads via calls to the Thread <code>stop</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
 * method</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
 *   <td>This allows code to stop any thread in the system provided that it is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
 * already granted permission to access that thread.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
 * This poses as a threat, because that code may corrupt the system by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
 * killing existing threads.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
 *   <td>modifyThreadGroup</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
 *   <td>modification of thread groups, e.g., via calls to ThreadGroup
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
 * <code>destroy</code>, <code>getParent</code>, <code>resume</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
 * <code>setDaemon</code>, <code>setMaxPriority</code>, <code>stop</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
 * and <code>suspend</code> methods</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
 *   <td>This allows an attacker to create thread groups and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
 * set their run priority.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
 *   <td>getProtectionDomain</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
 *   <td>Retrieval of the ProtectionDomain for a class</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
 *   <td>This allows code to obtain policy information
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
 * for a particular code source. While obtaining policy information
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
 * does not compromise the security of the system, it does give
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
 * attackers additional information, such as local file names for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
 * example, to better aim an attack.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
 *   <td>getFileSystemAttributes</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
 *   <td>Retrieval of file system attributes</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
 *   <td>This allows code to obtain file system information such as disk usage
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
 *       or disk space available to the caller.  This is potentially dangerous
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
 *       because it discloses information about the system hardware
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
 *       configuration and some information about the caller's privilege to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
 *       write files.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
 *   <td>readFileDescriptor</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
 *   <td>Reading of file descriptors</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
 *   <td>This would allow code to read the particular file associated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
 *       with the file descriptor read. This is dangerous if the file
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
 *       contains confidential data.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
 *   <td>writeFileDescriptor</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
 *   <td>Writing to file descriptors</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
 *   <td>This allows code to write to a particular file associated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
 *       with the descriptor. This is dangerous because it may allow
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
 *       malicious code to plant viruses or at the very least, fill up
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
 *       your entire disk.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
 *   <td>loadLibrary.{library name}</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
 *   <td>Dynamic linking of the specified library</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
 *   <td>It is dangerous to allow an applet permission to load native code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
 * libraries, because the Java security architecture is not designed to and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
 * does not prevent malicious behavior at the level of native code.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
 *   <td>accessClassInPackage.{package name}</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
 *   <td>Access to the specified package via a class loader's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
 * <code>loadClass</code> method when that class loader calls
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
 * the SecurityManager <code>checkPackageAccess</code> method</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
 *   <td>This gives code access to classes in packages
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
 * to which it normally does not have access. Malicious code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
 * may use these classes to help in its attempt to compromise
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
 * security in the system.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
 *   <td>defineClassInPackage.{package name}</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
 *   <td>Definition of classes in the specified package, via a class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
 * loader's <code>defineClass</code> method when that class loader calls
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
 * the SecurityManager <code>checkPackageDefinition</code> method.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
 *   <td>This grants code permission to define a class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
 * in a particular package. This is dangerous because malicious
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
 * code with this permission may define rogue classes in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
 * trusted packages like <code>java.security</code> or <code>java.lang</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
 * for example.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
 *   <td>accessDeclaredMembers</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
 *   <td>Access to the declared members of a class</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
 *   <td>This grants code permission to query a class for its public,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
 * protected, default (package) access, and private fields and/or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
 * methods. Although the code would have
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
 * access to the private and protected field and method names, it would not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
 * have access to the private/protected field data and would not be able
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
 * to invoke any private methods. Nevertheless, malicious code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
 * may use this information to better aim an attack.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
 * Additionally, it may invoke any public methods and/or access public fields
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
 * in the class.  This could be dangerous if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
 * the code would normally not be able to invoke those methods and/or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
 * access the fields  because
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
 * it can't cast the object to the class/interface with those methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
 * and fields.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
 *   <td>queuePrintJob</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
 *   <td>Initiation of a print job request</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
 *   <td>This could print sensitive information to a printer,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
 * or simply waste paper.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
 *   <td>getStackTrace</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
 *   <td>Retrieval of the stack trace information of another thread.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
 *   <td>This allows retrieval of the stack trace information of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
 * another thread.  This might allow malicious code to monitor the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
 * execution of threads and discover vulnerabilities in applications.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
 *   <td>setDefaultUncaughtExceptionHandler</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
 *   <td>Setting the default handler to be used when a thread
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
 *   terminates abruptly due to an uncaught exception</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
 *   <td>This allows an attacker to register a malicious
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
 *   uncaught exception handler that could interfere with termination
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
 *   of a thread</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
 *   <td>preferences</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
 *   <td>Represents the permission required to get access to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
 *   java.util.prefs.Preferences implementations user or system root
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
 *   which in turn allows retrieval or update operations within the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
 *   Preferences persistent backing store.) </td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
 *   <td>This permission allows the user to read from or write to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
 *   preferences backing store if the user running the code has
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
 *   sufficient OS privileges to read/write to that backing store.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
 *   The actual backing store may reside within a traditional filesystem
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
 *   directory or within a registry depending on the platform OS</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
 *   <td>usePolicy</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
 *   <td>Granting this permission disables the Java Plug-In's default
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
 *   security prompting behavior.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
 *   <td>For more information, refer to Java Plug-In's guides, <a href=
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
 *   "../../../technotes/guides/plugin/developer_guide/security.html">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
 *   Applet Security Basics</a> and <a href=
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
 *   "../../../technotes/guides/plugin/developer_guide/rsa_how.html#use">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
 *   usePolicy Permission</a>.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
 * </table>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
 * @see java.security.BasicPermission
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
 * @see java.security.Permission
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
 * @see java.security.Permissions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
 * @see java.security.PermissionCollection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
 * @see java.lang.SecurityManager
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
 * @author Marianne Mueller
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
 * @author Roland Schemers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
public final class RuntimePermission extends BasicPermission {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
    private static final long serialVersionUID = 7399184964622342223L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
     * Creates a new RuntimePermission with the specified name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     * The name is the symbolic name of the RuntimePermission, such as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
     * "exit", "setFactory", etc. An asterisk
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
     * may appear at the end of the name, following a ".", or by itself, to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
     * signify a wildcard match.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
     * @param name the name of the RuntimePermission.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
     * @throws NullPointerException if <code>name</code> is <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
     * @throws IllegalArgumentException if <code>name</code> is empty.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
    public RuntimePermission(String name)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
        super(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
     * Creates a new RuntimePermission object with the specified name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
     * The name is the symbolic name of the RuntimePermission, and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
     * actions String is currently unused and should be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
     * @param name the name of the RuntimePermission.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
     * @param actions should be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
     * @throws NullPointerException if <code>name</code> is <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
     * @throws IllegalArgumentException if <code>name</code> is empty.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
    public RuntimePermission(String name, String actions)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
        super(name, actions);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
}