Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/com/sun/jdi/JDIPermission.java
38831 views
/*1* Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package com.sun.jdi;2627/**28* The <code>JDIPermission</code> class represents access rights to29* the <code>VirtualMachineManager</code>. This is the permission30* which the SecurityManager will check when code that is running with31* a SecurityManager requests access to the VirtualMachineManager, as32* defined in the Java Debug Interface (JDI) for the Java platform.33* <P>34* A <code>JDIPermission</code> object contains a name (also referred35* to as a "target name") but no actions list; you either have the36* named permission or you don't.37* <P>38* The following table provides a summary description of what the39* permission allows, and discusses the risks of granting code the40* permission.41* <P>42* <table border=1 cellpadding=5 summary="Table shows permission43* target name, what the permission allows, and associated risks">44* <tr>45* <th>Permission Target Name</th>46* <th>What the Permission Allows</th>47* <th>Risks of Allowing this Permission</th>48* </tr>49*50* <tr>51* <td>virtualMachineManager</td>52* <td>Ability to inspect and modify the JDI objects in the53* <code>VirtualMachineManager</code>54* </td>55* <td>This allows an attacker to control the56* <code>VirtualMachineManager</code> and cause the system to57* misbehave.58* </td>59* </tr>60*61* </table>62*63* <p>64* Programmers do not normally create JDIPermission objects directly.65* Instead they are created by the security policy code based on reading66* the security policy file.67*68* @author Tim Bell69* @since 1.570*71* @see com.sun.jdi.Bootstrap72* @see java.security.BasicPermission73* @see java.security.Permission74* @see java.security.Permissions75* @see java.security.PermissionCollection76* @see java.lang.SecurityManager77*78*/7980@jdk.Exported81public final class JDIPermission extends java.security.BasicPermission {82private static final long serialVersionUID = -6988461416938786271L;83/**84* The <code>JDIPermission</code> class represents access rights to the85* <code>VirtualMachineManager</code>86* @param name Permission name. Must be "virtualMachineManager".87* @throws IllegalArgumentException if the name argument is invalid.88*/89public JDIPermission(String name) {90super(name);91if (!name.equals("virtualMachineManager")) {92throw new IllegalArgumentException("name: " + name);93}94}9596/**97* Constructs a new JDIPermission object.98*99* @param name Permission name. Must be "virtualMachineManager".100* @param actions Must be either null or the empty string.101* @throws IllegalArgumentException if arguments are invalid.102*/103public JDIPermission(String name, String actions)104throws IllegalArgumentException {105super(name);106if (!name.equals("virtualMachineManager")) {107throw new IllegalArgumentException("name: " + name);108}109if (actions != null && actions.length() > 0) {110throw new IllegalArgumentException("actions: " + actions);111}112}113}114115116