All Downloads are FREE. Search and download functionalities are using the official Maven repository.

java.lang.RuntimePermission Maven / Gradle / Ivy

There is a newer version: 1.3.1
Show newest version
/*

This is not an official specification document, and usage is restricted.

NOTICE


(c) 2005-2007 Sun Microsystems, Inc. All Rights Reserved.

Neither this file nor any files generated from it describe a complete specification, and they may only be used as described below. For example, no permission is given for you to incorporate this file, in whole or in part, in an implementation of a Java specification.

Sun Microsystems Inc. owns the copyright in this file and it is provided to you for informative, as opposed to normative, use. The file and any files generated from it may be used to generate other informative documentation, such as a unified set of documents of API signatures for a platform that includes technologies expressed as Java APIs. The file may also be used to produce "compilation stubs," which allow applications to be compiled and validated for such platforms.

Any work generated from this file, such as unified javadocs or compiled stub files, must be accompanied by this notice in its entirety.

This work corresponds to the API signatures of JSR 219: Foundation Profile 1.1. In the event of a discrepency between this work and the JSR 219 specification, which is available at http://www.jcp.org/en/jsr/detail?id=219, the latter takes precedence. */ package java.lang; import java.security.*; import java.util.Enumeration; import java.util.Hashtable; import java.util.StringTokenizer; /** * This class is for runtime permissions. A RuntimePermission * contains a name (also referred to as a "target name") but * no actions list; you either have the named permission * or you don't. * *

* The target name is the name of the runtime permission (see below). The * naming convention follows the hierarchical property naming convention. * Also, an asterisk * may appear at the end of the name, following a ".", or by itself, to * signify a wildcard match. For example: "loadLibrary.*" or "*" is valid, * "*loadLibrary" or "a*b" is not valid. *

* The following table lists all the possible RuntimePermission target names, * and for each provides a description of what the permission allows * and a discussion of the risks of granting code the permission. *

* *

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Permission Target NameWhat the Permission AllowsRisks of Allowing this Permission
createClassLoaderCreation of a class loaderThis is an extremely dangerous permission to grant. * Malicious applications that can instantiate their own class * loaders could then load their own rogue classes into the system. * These newly loaded classes could be placed into any protection * domain by the class loader, thereby automatically granting the * classes the permissions for that domain.
getClassLoaderRetrieval of a class loader (e.g., the class loader for the calling * class)This would grant an attacker permission to get the * class loader for a particular class. This is dangerous because * having access to a class's class loader allows the attacker to * load other classes available to that class loader. The attacker * would typically otherwise not have access to those classes.
setContextClassLoaderSetting of the context class loader used by a threadThe context class loader is used by system code and extensions * when they need to lookup resources that might not exist in the system * class loader. Granting setContextClassLoader permission would allow * code to change which context class loader is used * for a particular thread, including system threads.
setSecurityManagerSetting of the security manager (possibly replacing an existing one) * The security manager is a class that allows * applications to implement a security policy. Granting the setSecurityManager * permission would allow code to change which security manager is used by * installing a different, possibly less restrictive security manager, * thereby bypassing checks that would have been enforced by the original * security manager.
createSecurityManagerCreation of a new security managerThis gives code access to protected, sensitive methods that may * disclose information about other classes or the execution stack.
exitVMHalting of the Java Virtual MachineThis allows an attacker to mount a denial-of-service attack * by automatically forcing the virtual machine to halt. * Note: The "exitVM" permission is automatically granted to all code * loaded from the application class path, thus enabling applications * to terminate themselves.
shutdownHooksRegistration and cancellation of virtual-machine shutdown hooksThis allows an attacker to register a malicious shutdown * hook that interferes with the clean shutdown of the virtual machine.
setFactorySetting of the socket factory used by ServerSocket or Socket, * or of the stream handler factory used by URLThis allows code to set the actual implementation * for the socket, server socket, stream handler, or RMI socket factory. * NOTE: java.net.ServerSocket, java.net.Socket are found in J2ME * CDC profiles such as J2ME Foundation Profile. * An attacker may set a faulty implementation which mangles the data * stream.
setIOSetting of System.out, System.in, and System.errThis allows changing the value of the standard system streams. * An attacker may change System.in to monitor and * steal user input, or may set System.err to a "null" OutputSteam, * which would hide any error messages sent to System.err.
modifyThreadModification of threads, e.g., via calls to Thread stop, * suspend, resume, setPriority, * and setName methodsThis allows an attacker to start or suspend any thread * in the system.
stopThreadStopping of threads via calls to the Thread stop * methodThis allows code to stop any thread in the system provided that it is * already granted permission to access that thread. * This poses as a threat, because that code may corrupt the system by * killing existing threads.
modifyThreadGroupmodification of thread groups, e.g., via calls to ThreadGroup * destroy, getParent, resume, * setDaemon, setMaxPriority, stop, * and suspend methodsThis allows an attacker to create thread groups and * set their run priority.
getProtectionDomainRetrieval of the ProtectionDomain for a classThis allows code to obtain policy information * for a particular code source. While obtaining policy information * does not compromise the security of the system, it does give * attackers additional information, such as local file names for * example, to better aim an attack.
readFileDescriptorReading of file descriptorsThis would allow code to read the particular file associated * with the file descriptor read. This is dangerous if the file * contains confidential data.
writeFileDescriptorWriting to file descriptorsThis allows code to write to a particular file associated * with the descriptor. This is dangerous because it may allow * malicious code to plant viruses or at the very least, fill up * your entire disk.
loadLibrary.{library name}Dynamic linking of the specified libraryIt is dangerous to allow an applet permission to load native code * libraries, because the Java security architecture is not designed to and * does not prevent malicious behavior at the level of native code.
accessClassInPackage.{package name}Access to the specified package via a class loader's * loadClass method when that class loader calls * the SecurityManager checkPackageAcesss methodThis gives code access to classes in packages * to which it normally does not have access. Malicious code * may use these classes to help in its attempt to compromise * security in the system.
defineClassInPackage.{package name}Definition of classes in the specified package, via a class * loader's defineClass method when that class loader calls * the SecurityManager checkPackageDefinition method.This grants code permission to define a class * in a particular package. This is dangerous because malicious * code with this permission may define rogue classes in * trusted packages like java.security or java.lang, * for example.
accessDeclaredMembersAccess to the declared members of a classThis grants code permission to query a class for its public, * protected, default (package) access, and private fields and/or * methods. Although the code would have * access to the private and protected field and method names, it would not * have access to the private/protected field data and would not be able * to invoke any private methods. Nevertheless, malicious code * may use this information to better aim an attack. * Additionally, it may invoke any public methods and/or access public fields * in the class. This could be dangerous if * the code would normally not be able to invoke those methods and/or * access the fields because * it can't cast the object to the class/interface with those methods * and fields. *
queuePrintJobInitiation of a print job requestThis could print sensitive information to a printer, * or simply waste paper.
* * @see java.security.BasicPermission * @see java.security.Permission * @see java.security.Permissions * @see java.security.PermissionCollection * @see java.lang.SecurityManager * * @version 1.37 00/02/02 * * @author Marianne Mueller * @author Roland Schemers */ public final class RuntimePermission extends BasicPermission { /** * Creates a new RuntimePermission with the specified name. * The name is the symbolic name of the RuntimePermission, such as * "exit", "setFactory", etc. An asterisk * may appear at the end of the name, following a ".", or by itself, to * signify a wildcard match. * * @param name the name of the RuntimePermission. */ public RuntimePermission(java.lang.String name) { super(name); } /** * Creates a new RuntimePermission object with the specified name. * The name is the symbolic name of the RuntimePermission, and the * actions String is currently unused and should be null. * * @param name the name of the RuntimePermission. * @param actions should be null. */ public RuntimePermission(java.lang.String name, java.lang.String actions) { super(name, actions); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy