001/* SecurityPermission.java -- Class for named security permissions
002   Copyright (C) 1998, 2002 Free Software Foundation, Inc.
003
004This file is part of GNU Classpath.
005
006GNU Classpath is free software; you can redistribute it and/or modify
007it under the terms of the GNU General Public License as published by
008the Free Software Foundation; either version 2, or (at your option)
009any later version.
010
011GNU Classpath is distributed in the hope that it will be useful, but
012WITHOUT ANY WARRANTY; without even the implied warranty of
013MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014General Public License for more details.
015
016You should have received a copy of the GNU General Public License
017along with GNU Classpath; see the file COPYING.  If not, write to the
018Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
01902110-1301 USA.
020
021Linking this library statically or dynamically with other modules is
022making a combined work based on this library.  Thus, the terms and
023conditions of the GNU General Public License cover the whole
024combination.
025
026As a special exception, the copyright holders of this library give you
027permission to link this library with independent modules to produce an
028executable, regardless of the license terms of these independent
029modules, and to copy and distribute the resulting executable under
030terms of your choice, provided that you also meet, for each linked
031independent module, the terms and conditions of the license of that
032module.  An independent module is a module which is not derived from
033or based on this library.  If you modify this library, you may extend
034this exception to your version of the library, but you are not
035obligated to do so.  If you do not wish to do so, delete this
036exception statement from your version. */
037
038package java.security;
039
040/**
041 * This class provides a mechanism for specified named permissions
042 * related to the Java security framework.  These permissions have no
043 * associated actions list.  They are either granted or not granted.
044 *
045 * <p>The list of valid permission names is:<br>
046 * <table border=1>
047 * <tr><th>Permission Name</th><th>Permission Allows</th><th>Risks</th</tr>
048 * <tr>
049 *   <td><code>createAccessControlContext</code></td>
050 *   <td>Allows creation of an AccessControlContext</td>
051 *   <td>The new control context can have a rogue DomainCombiner, leading
052 *       to a privacy leak</td></tr>
053 * <tr>
054 *   <td><code>getDomainCombiner</code></td>
055 *   <td>Get a DomainCombiner from an AccessControlContext</td>
056 *   <td>Access to a DomainCombiner can lead to a privacy leak</td></tr>
057 * <tr>
058 *   <td><code>getPolicy</code></td>
059 *   <td>Allows retrieval of the system security policy</td>
060 *   <td>Malicious code can use information from the policy to better plan
061 *       an attack</td></tr>
062 * <tr>
063 *   <td><code>setPolicy</code></td>
064 *   <td>Allows the security policy to be changed</td>
065 *   <td>Malicious code can give itself any permission it wants</td></tr>
066 * <tr>
067 *   <td><code>getProperty.</code><em>key</em></td>
068 *   <td>Retrieve the property specified by the key</td>
069 *   <td>Malicious code can use information from the property to better plan
070 *       an attack</td></tr>
071 * <tr>
072 *   <td><code>setProperty.</code><em>key</em></td>
073 *   <td>Allows changing of the value of all properties implied by key</td>
074 *   <td>Malicious code can insert rogue classes to steal keys or recreate
075 *       the security policy with whatever permissions it desires</td></tr>
076 * <tr>
077 *   <td><code>insertProvider.</code><em>key</em></td>
078 *   <td>Allows the named provider to be added</td>
079 *   <td>Malicious code can insert rogue providers that steal data</td></tr>
080 * <tr>
081 *   <td><code>removeProvider.</code><em>key</em></td>
082 *   <td>Allows the named provider to be removed</td>
083 *   <td>A missing provider can cripple code that relies on it</td></tr>
084 * <tr>
085 *   <td><code>setSystemScope</code></td>
086 *   <td>Allows the system identity scope to be set</td>
087 *   <td>Malicious code can add certificates not available in the original
088 *       identity scope, to gain more permissions</td></tr>
089 * <tr>
090 *   <td><code>setIdentityPublicKey</code></td>
091 *   <td>Allows the public key of an Identity to be set</td>
092 *   <td>Malicious code can install its own key to gain permissions not
093 *       allowed by the original identity scope</td></tr>
094 * <tr>
095 *   <td><code>SetIdentityInfo</code></td>
096 *   <td>Allows the description of an Identity to be set</td>
097 *   <td>Malicious code can spoof users into trusting a fake identity</td></tr>
098 * <tr>
099 *   <td><code>addIdentityCertificate</code></td>
100 *   <td>Allows a certificate to be set for the public key of an identity</td>
101 *   <td>The public key can become trusted to a wider audience than originally
102 *       intended</td></tr>
103 * <tr>
104 *   <td><code>removeIdentityCertificate</code></td>
105 *   <td>Allows removal of a certificate from an identity's public key</td>
106 *   <td>The public key can become less trusted than it should be</td></tr>
107 * <tr>
108 *   <td><code>printIdentity</code></td>
109 *   <td>View the name of the identity and scope, and whether they are
110 *       trusted</td>
111 *   <td>The scope may include a filename, which provides an entry point for
112 *       further security breaches</td></tr>
113 * <tr>
114 *   <td><code>clearProviderProperties.</code><em>key</em></td>
115 *   <td>Allows the properties of the named provider to be cleared</td>
116 *   <td>This can disable parts of the program which depend on finding the
117 *       provider</td></tr>
118 * <tr>
119 *   <td><code>putProviderProperty.</code><em>key</em></td>
120 *   <td>Allows the properties of the named provider to be changed</td>
121 *   <td>Malicious code can replace the implementation of a provider</td></tr>
122 * <tr>
123 *   <td><code>removeProviderProperty.</code><em>key</em></td>
124 *   <td>Allows the properties of the named provider to be deleted</td>
125 *   <td>This can disable parts of the program which depend on finding the
126 *       provider</td></tr>
127 * <tr>
128 *   <td><code>getSignerPrivateKey</code></td>
129 *   <td>Allows the retrieval of the private key for a signer</td>
130 *   <td>Anyone that can access the private key can claim to be the
131 *       Signer</td></tr>
132 * <tr>
133 *   <td><code>setSignerKeyPair</code></td>
134 *   <td>Allows the public and private key of a Signer to be changed</td>
135 *   <td>The replacement might be a weaker encryption, or the attacker
136 *       can use knowledge of the replaced key to decrypt an entire
137 *       communication session</td></tr>
138 * </table>
139 *
140 * <p>There is some degree of security risk in granting any of these
141 * permissions. Some of them can completely compromise system security.
142 * Please exercise extreme caution in granting these permissions.
143 *
144 * @author Aaron M. Renn (arenn@urbanophile.com)
145 * @see Permission
146 * @see SecurityManager
147 * @since 1.1
148 * @status updated to 1.4
149 */
150public final class SecurityPermission extends BasicPermission
151{
152  /**
153   * Compatible with JDK 1.1+.
154   */
155  private static final long serialVersionUID = 5236109936224050470L;
156
157  /**
158   * Create a new instance with the specified name.
159   *
160   * @param name the name to assign to this permission
161   */
162  public SecurityPermission(String name)
163  {
164    super(name);
165  }
166
167  /**
168   * Create a new instance with the specified name. As SecurityPermission
169   * carries no actions, the second parameter is ignored.
170   *
171   * @param name the name to assign to this permission
172   * @param actions ignored
173   */
174  public SecurityPermission(String name, String actions)
175  {
176    super(name);
177  }
178} // class SecurityPermission