SecurityPermission.java 7.39 KB
Newer Older
1
/* SecurityPermission.java -- Class for named security permissions
2
   Copyright (C) 1998, 2002 Free Software Foundation, Inc.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

This file is part of GNU Classpath.

GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.

GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING.  If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.

21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
Linking this library statically or dynamically with other modules is
making a combined work based on this library.  Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.

As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module.  An independent module is a module which is not derived from
or based on this library.  If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so.  If you do not wish to do so, delete this
exception statement from your version. */
37 38 39 40

package java.security;

/**
41
 * This class provides a mechanism for specified named permissions
42
 * related to the Java security framework.  These permissions have no
43
 * associated actions list.  They are either granted or not granted.
44
 *
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
 * <p>The list of valid permission names is:<br>
 * <table border=1>
 * <tr><th>Permission Name</th><th>Permission Allows</th><th>Risks</th</tr>
 * <tr>
 *   <td><code>createAccessControlContext</code></td>
 *   <td>Allows creation of an AccessControlContext</td>
 *   <td>The new control context can have a rogue DomainCombiner, leading
 *       to a privacy leak</td></tr>
 * <tr>
 *   <td><code>getDomainCombiner</code></td>
 *   <td>Get a DomainCombiner from an AccessControlContext</td>
 *   <td>Access to a DomainCombiner can lead to a privacy leak</td></tr>
 * <tr>
 *   <td><code>getPolicy</code></td>
 *   <td>Allows retrieval of the system security policy</td>
 *   <td>Malicious code can use information from the policy to better plan
 *       an attack</td></tr>
 * <tr>
 *   <td><code>setPolicy</code></td>
 *   <td>Allows the security policy to be changed</td>
 *   <td>Malicious code can give itself any permission it wants</td></tr>
 * <tr>
 *   <td><code>getProperty.</code><em>key</em></td>
 *   <td>Retrieve the property specified by the key</td>
 *   <td>Malicious code can use information from the property to better plan
 *       an attack</td></tr>
 * <tr>
 *   <td><code>setProperty.</code><em>key</em></td>
 *   <td>Allows changing of the value of all properties implied by key</td>
 *   <td>Malicious code can insert rogue classes to steal keys or recreate
 *       the security policy with whatever permissions it desires</td></tr>
 * <tr>
 *   <td><code>insertProvider.</code><em>key</em></td>
 *   <td>Allows the named provider to be added</td>
 *   <td>Malicious code can insert rogue providers that steal data</td></tr>
 * <tr>
 *   <td><code>removeProvider.</code><em>key</em></td>
 *   <td>Allows the named provider to be removed</td>
 *   <td>A missing provider can cripple code that relies on it</td></tr>
 * <tr>
 *   <td><code>setSystemScope</code></td>
 *   <td>Allows the system identity scope to be set</td>
 *   <td>Malicious code can add certificates not available in the original
 *       identity scope, to gain more permissions</td></tr>
 * <tr>
 *   <td><code>setIdentityPublicKey</code></td>
 *   <td>Allows the public key of an Identity to be set</td>
 *   <td>Malicious code can install its own key to gain permissions not
 *       allowed by the original identity scope</td></tr>
 * <tr>
 *   <td><code>SetIdentityInfo</code></td>
 *   <td>Allows the description of an Identity to be set</td>
 *   <td>Malicious code can spoof users into trusting a fake identity</td></tr>
 * <tr>
 *   <td><code>addIdentityCertificate</code></td>
 *   <td>Allows a certificate to be set for the public key of an identity</td>
 *   <td>The public key can become trusted to a wider audience than originally
 *       intended</td></tr>
 * <tr>
 *   <td><code>removeIdentityCertificate</code></td>
 *   <td>Allows removal of a certificate from an identity's public key</td>
 *   <td>The public key can become less trusted than it should be</td></tr>
 * <tr>
 *   <td><code>printIdentity</code></td>
 *   <td>View the name of the identity and scope, and whether they are
 *       trusted</td>
 *   <td>The scope may include a filename, which provides an entry point for
 *       further security breaches</td></tr>
 * <tr>
 *   <td><code>clearProviderProperties.</code><em>key</em></td>
 *   <td>Allows the properties of the named provider to be cleared</td>
 *   <td>This can disable parts of the program which depend on finding the
 *       provider</td></tr>
 * <tr>
 *   <td><code>putProviderProperty.</code><em>key</em></td>
 *   <td>Allows the properties of the named provider to be changed</td>
 *   <td>Malicious code can replace the implementation of a provider</td></tr>
 * <tr>
 *   <td><code>removeProviderProperty.</code><em>key</em></td>
 *   <td>Allows the properties of the named provider to be deleted</td>
 *   <td>This can disable parts of the program which depend on finding the
 *       provider</td></tr>
 * <tr>
 *   <td><code>getSignerPrivateKey</code></td>
 *   <td>Allows the retrieval of the private key for a signer</td>
 *   <td>Anyone that can access the private key can claim to be the
 *       Signer</td></tr>
 * <tr>
 *   <td><code>setSignerKeyPair</code></td>
 *   <td>Allows the public and private key of a Signer to be changed</td>
 *   <td>The replacement might be a weaker encryption, or the attacker
 *       can use knowledge of the replaced key to decrypt an entire
 *       communication session</td></tr>
 * </table>
 *
 * <p>There is some degree of security risk in granting any of these
 * permissions. Some of them can completely compromise system security.
 * Please exercise extreme caution in granting these permissions.
143 144
 *
 * @author Aaron M. Renn (arenn@urbanophile.com)
145 146 147 148
 * @see Permission
 * @see SecurityManager
 * @since 1.1
 * @status updated to 1.4
149 150 151 152
 */
public final class SecurityPermission extends BasicPermission
{
  /**
153 154 155 156 157 158
   * Compatible with JDK 1.1+.
   */
  private static final long serialVersionUID = 5236109936224050470L;

  /**
   * Create a new instance with the specified name.
159
   *
160
   * @param name the name to assign to this permission
161 162 163 164 165 166 167
   */
  public SecurityPermission(String name)
  {
    super(name);
  }

  /**
168 169
   * Create a new instance with the specified name. As SecurityPermission
   * carries no actions, the second parameter is ignored.
170
   *
171 172
   * @param name the name to assign to this permission
   * @param actions ignored
173 174 175
   */
  public SecurityPermission(String name, String actions)
  {
176
    super(name);
177
  }
178
} // class SecurityPermission