src/java.base/share/classes/java/security/SecurityPermission.java
author darcy
Thu, 29 Aug 2019 10:52:21 -0700
changeset 57950 4612a3cfb927
parent 47216 71c04702a3d5
permissions -rw-r--r--
8229999: Apply java.io.Serial annotations to security types in java.base Reviewed-by: rriggs, mullan
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
57950
4612a3cfb927 8229999: Apply java.io.Serial annotations to security types in java.base
darcy
parents: 47216
diff changeset
     2
 * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
2
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
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2589
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2589
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
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
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2589
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2589
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2589
diff changeset
    23
 * questions.
2
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.security;
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
/**
32107
67aa4920495c 8077055: Allow other named SecurityPermissions, RuntimePermissions, and AuthPermissions to be used
mullan
parents: 25859
diff changeset
    34
 * This class is for security permissions. A {@code SecurityPermission}
67aa4920495c 8077055: Allow other named SecurityPermissions, RuntimePermissions, and AuthPermissions to be used
mullan
parents: 25859
diff changeset
    35
 * contains a name (also referred to as a "target name") but no actions list;
67aa4920495c 8077055: Allow other named SecurityPermissions, RuntimePermissions, and AuthPermissions to be used
mullan
parents: 25859
diff changeset
    36
 * you either have the named permission or you don't.
67aa4920495c 8077055: Allow other named SecurityPermissions, RuntimePermissions, and AuthPermissions to be used
mullan
parents: 25859
diff changeset
    37
 * <p>
67aa4920495c 8077055: Allow other named SecurityPermissions, RuntimePermissions, and AuthPermissions to be used
mullan
parents: 25859
diff changeset
    38
 * The target name is the name of a security configuration parameter
67aa4920495c 8077055: Allow other named SecurityPermissions, RuntimePermissions, and AuthPermissions to be used
mullan
parents: 25859
diff changeset
    39
 * (see below). Currently the {@code SecurityPermission} object is used to
67aa4920495c 8077055: Allow other named SecurityPermissions, RuntimePermissions, and AuthPermissions to be used
mullan
parents: 25859
diff changeset
    40
 * guard access to the {@link AccessControlContext}, {@link Policy},
67aa4920495c 8077055: Allow other named SecurityPermissions, RuntimePermissions, and AuthPermissions to be used
mullan
parents: 25859
diff changeset
    41
 * {@link Provider}, {@link Security}, {@link Signer}, and {@link Identity}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * objects.
32107
67aa4920495c 8077055: Allow other named SecurityPermissions, RuntimePermissions, and AuthPermissions to be used
mullan
parents: 25859
diff changeset
    43
 * <p>
67aa4920495c 8077055: Allow other named SecurityPermissions, RuntimePermissions, and AuthPermissions to be used
mullan
parents: 25859
diff changeset
    44
 * The following table lists the standard {@code SecurityPermission}
67aa4920495c 8077055: Allow other named SecurityPermissions, RuntimePermissions, and AuthPermissions to be used
mullan
parents: 25859
diff changeset
    45
 * target names, and for each provides a description of what the permission
67aa4920495c 8077055: Allow other named SecurityPermissions, RuntimePermissions, and AuthPermissions to be used
mullan
parents: 25859
diff changeset
    46
 * allows and a discussion of the risks of granting code the permission.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 *
45124
144479e89cdb 8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents: 32931
diff changeset
    48
 * <table class="striped">
144479e89cdb 8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents: 32931
diff changeset
    49
 * <caption style="display:none">target name, what the permission allows, and associated risks</caption>
144479e89cdb 8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents: 32931
diff changeset
    50
 * <thead>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * <tr>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
    52
 * <th scope="col">Permission Target Name</th>
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
    53
 * <th scope="col">What the Permission Allows</th>
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
    54
 * <th scope="col">Risks of Allowing this Permission</th>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * </tr>
45124
144479e89cdb 8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents: 32931
diff changeset
    56
 * </thead>
144479e89cdb 8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents: 32931
diff changeset
    57
 * <tbody>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * <tr>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
    60
 *   <th scope="row">authProvider.{provider name}</th>
32931
2ba4f06f8684 8130648: JCK test api/java_security/AuthProvider/ProviderTests_login starts failing after JDK-7191662
valeriep
parents: 32107
diff changeset
    61
 *   <td>Allow the named provider to be an AuthProvider for login and
2ba4f06f8684 8130648: JCK test api/java_security/AuthProvider/ProviderTests_login starts failing after JDK-7191662
valeriep
parents: 32107
diff changeset
    62
 * logout operations. </td>
2ba4f06f8684 8130648: JCK test api/java_security/AuthProvider/ProviderTests_login starts failing after JDK-7191662
valeriep
parents: 32107
diff changeset
    63
 *   <td>This allows the named provider to perform login and logout
2ba4f06f8684 8130648: JCK test api/java_security/AuthProvider/ProviderTests_login starts failing after JDK-7191662
valeriep
parents: 32107
diff changeset
    64
 * operations. The named provider must extend {@code AuthProvider}
2ba4f06f8684 8130648: JCK test api/java_security/AuthProvider/ProviderTests_login starts failing after JDK-7191662
valeriep
parents: 32107
diff changeset
    65
 * and care must be taken to grant to a trusted provider since
2ba4f06f8684 8130648: JCK test api/java_security/AuthProvider/ProviderTests_login starts failing after JDK-7191662
valeriep
parents: 32107
diff changeset
    66
 * login operations involve sensitive authentication information
2ba4f06f8684 8130648: JCK test api/java_security/AuthProvider/ProviderTests_login starts failing after JDK-7191662
valeriep
parents: 32107
diff changeset
    67
 * such as PINs and passwords. </td>
2ba4f06f8684 8130648: JCK test api/java_security/AuthProvider/ProviderTests_login starts failing after JDK-7191662
valeriep
parents: 32107
diff changeset
    68
 * </tr>
2ba4f06f8684 8130648: JCK test api/java_security/AuthProvider/ProviderTests_login starts failing after JDK-7191662
valeriep
parents: 32107
diff changeset
    69
 *
2ba4f06f8684 8130648: JCK test api/java_security/AuthProvider/ProviderTests_login starts failing after JDK-7191662
valeriep
parents: 32107
diff changeset
    70
 * <tr>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
    71
 *   <th scope="row">createAccessControlContext</th>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 *   <td>Creation of an AccessControlContext</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 *   <td>This allows someone to instantiate an AccessControlContext
18579
b678846778ad 8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents: 5506
diff changeset
    74
 * with a {@code DomainCombiner}.  Extreme care must be taken when
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * granting this permission. Malicious code could create a DomainCombiner
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * that augments the set of permissions granted to code, and even grant the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 * code {@link java.security.AllPermission}.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 * <tr>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
    81
 *   <th scope="row">getDomainCombiner</th>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 *   <td>Retrieval of an AccessControlContext's DomainCombiner</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 *   <td>This allows someone to retrieve an AccessControlContext's
18579
b678846778ad 8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents: 5506
diff changeset
    84
 * {@code DomainCombiner}.  Since DomainCombiners may contain
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 * sensitive information, this could potentially lead to a privacy leak.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 * <tr>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
    89
 *   <th scope="row">getPolicy</th>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 *   <td>Retrieval of the system-wide security policy (specifically, of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 * currently-installed Policy object)</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 *   <td>This allows someone to query the policy via the
18579
b678846778ad 8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents: 5506
diff changeset
    93
 * {@code getPermissions} call,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
 * which discloses which permissions would be granted to a given CodeSource.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
 * While revealing the policy does not compromise the security of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
 * the system, it does provide malicious code with additional information
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
 * which it may use to better aim an attack. It is wise
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
 * not to divulge more information than necessary.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
 * <tr>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
   102
 *   <th scope="row">setPolicy</th>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
 *   <td>Setting of the system-wide security policy (specifically,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
 * the Policy object)</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
 *   <td>Granting this permission is extremely dangerous, as malicious
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
 * code may grant itself all the necessary permissions it needs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
 * to successfully mount an attack on the system.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
 * <tr>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
   111
 *   <th scope="row">createPolicy.{policy type}</th>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
 *   <td>Getting an instance of a Policy implementation from a provider</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
 *   <td>Granting this permission enables code to obtain a Policy object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
 * Malicious code may query the Policy object to determine what permissions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
 * have been granted to code other than itself. </td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
 * <tr>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
   119
 *   <th scope="row">getProperty.{key}</th>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
 *   <td>Retrieval of the security property with the specified key</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
 *   <td>Depending on the particular key for which access has
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
 * been granted, the code may have access to the list of security
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
 * providers, as well as the location of the system-wide and user
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
 * security policies.  while revealing this information does not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
 * compromise the security of the system, it does provide malicious
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
 * code with additional information which it may use to better aim
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
 * an attack.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
 * <tr>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
   132
 *   <th scope="row">setProperty.{key}</th>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
 *   <td>Setting of the security property with the specified key</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
 *   <td>This could include setting a security provider or defining
2589
af4853bc7e87 6827153: Miscellaneous typos in javadoc
martin
parents: 2
diff changeset
   135
 * the location of the system-wide security policy.  Malicious
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
 * code that has permission to set a new security provider may
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
 * set a rogue provider that steals confidential information such
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
 * as cryptographic private keys. In addition, malicious code with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
 * permission to set the location of the system-wide security policy
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
 * may point it to a security policy that grants the attacker
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
 * all the necessary permissions it requires to successfully mount
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
 * an attack on the system.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
 * <tr>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
   147
 *   <th scope="row">insertProvider</th>
19193
103262cae675 8001319: Add SecurityPermission "insertProvider" target name
mullan
parents: 18579
diff changeset
   148
 *   <td>Addition of a new provider</td>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
 *   <td>This would allow somebody to introduce a possibly
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
 * malicious provider (e.g., one that discloses the private keys passed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
 * to it) as the highest-priority provider. This would be possible
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
 * because the Security object (which manages the installed providers)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
 * currently does not check the integrity or authenticity of a provider
19193
103262cae675 8001319: Add SecurityPermission "insertProvider" target name
mullan
parents: 18579
diff changeset
   154
 * before attaching it. The "insertProvider" permission subsumes the
103262cae675 8001319: Add SecurityPermission "insertProvider" target name
mullan
parents: 18579
diff changeset
   155
 * "insertProvider.{provider name}" permission (see the section below for
103262cae675 8001319: Add SecurityPermission "insertProvider" target name
mullan
parents: 18579
diff changeset
   156
 * more information).
103262cae675 8001319: Add SecurityPermission "insertProvider" target name
mullan
parents: 18579
diff changeset
   157
 * </td>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
 * <tr>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
   161
 *   <th scope="row">removeProvider.{provider name}</th>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
 *   <td>Removal of the specified provider</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
 *   <td>This may change the behavior or disable execution of other
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
 * parts of the program. If a provider subsequently requested by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
 * program has been removed, execution may fail. Also, if the removed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
 * provider is not explicitly requested by the rest of the program, but
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
 * it would normally be the provider chosen when a cryptography service
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
 * is requested (due to its previous order in the list of providers),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
 * a different provider will be chosen instead, or no suitable provider
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
 * will be found, thereby resulting in program failure.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
 * <tr>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
   174
 *   <th scope="row">clearProviderProperties.{provider name}</th>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
 *   <td>"Clearing" of a Provider so that it no longer contains the properties
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
 * used to look up services implemented by the provider</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
 *   <td>This disables the lookup of services implemented by the provider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
 * This may thus change the behavior or disable execution of other
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
 * parts of the program that would normally utilize the Provider, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
 * described under the "removeProvider.{provider name}" permission.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
 * <tr>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
   184
 *   <th scope="row">putProviderProperty.{provider name}</th>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
 *   <td>Setting of properties for the specified Provider</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
 *   <td>The provider properties each specify the name and location
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
 * of a particular service implemented by the provider. By granting
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
 * this permission, you let code replace the service specification
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
 * with another one, thereby specifying a different implementation.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
 * <tr>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
   193
 *   <th scope="row">removeProviderProperty.{provider name}</th>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
 *   <td>Removal of properties from the specified Provider</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
 *   <td>This disables the lookup of services implemented by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
 * provider. They are no longer accessible due to removal of the properties
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
 * specifying their names and locations. This
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
 * may change the behavior or disable execution of other
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
 * parts of the program that would normally utilize the Provider, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
 * described under the "removeProvider.{provider name}" permission.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
 *
45124
144479e89cdb 8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents: 32931
diff changeset
   203
 * </tbody>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
 * </table>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
 * <P>
19193
103262cae675 8001319: Add SecurityPermission "insertProvider" target name
mullan
parents: 18579
diff changeset
   207
 * The following permissions have been superseded by newer permissions or are
103262cae675 8001319: Add SecurityPermission "insertProvider" target name
mullan
parents: 18579
diff changeset
   208
 * associated with classes that have been deprecated: {@link Identity},
103262cae675 8001319: Add SecurityPermission "insertProvider" target name
mullan
parents: 18579
diff changeset
   209
 * {@link IdentityScope}, {@link Signer}. Use of them is discouraged. See the
103262cae675 8001319: Add SecurityPermission "insertProvider" target name
mullan
parents: 18579
diff changeset
   210
 * applicable classes for more information.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
 *
45124
144479e89cdb 8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents: 32931
diff changeset
   212
 * <table class="striped">
144479e89cdb 8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents: 32931
diff changeset
   213
 * <caption style="display:none">target name, what the permission allows, and associated risks</caption>
144479e89cdb 8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents: 32931
diff changeset
   214
 * <thead>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
 * <tr>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
   216
 * <th scope="col">Permission Target Name</th>
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
   217
 * <th scope="col">What the Permission Allows</th>
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
   218
 * <th scope="col">Risks of Allowing this Permission</th>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
 * </tr>
45124
144479e89cdb 8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents: 32931
diff changeset
   220
 * </thead>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
 *
45124
144479e89cdb 8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents: 32931
diff changeset
   222
 * <tbody>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
 * <tr>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
   224
 *   <th scope="row">insertProvider.{provider name}</th>
19193
103262cae675 8001319: Add SecurityPermission "insertProvider" target name
mullan
parents: 18579
diff changeset
   225
 *   <td>Addition of a new provider, with the specified name</td>
103262cae675 8001319: Add SecurityPermission "insertProvider" target name
mullan
parents: 18579
diff changeset
   226
 *   <td>Use of this permission is discouraged from further use because it is
103262cae675 8001319: Add SecurityPermission "insertProvider" target name
mullan
parents: 18579
diff changeset
   227
 * possible to circumvent the name restrictions by overriding the
103262cae675 8001319: Add SecurityPermission "insertProvider" target name
mullan
parents: 18579
diff changeset
   228
 * {@link java.security.Provider#getName} method. Also, there is an equivalent
103262cae675 8001319: Add SecurityPermission "insertProvider" target name
mullan
parents: 18579
diff changeset
   229
 * level of risk associated with granting code permission to insert a provider
103262cae675 8001319: Add SecurityPermission "insertProvider" target name
mullan
parents: 18579
diff changeset
   230
 * with a specific name, or any name it chooses. Users should use the
103262cae675 8001319: Add SecurityPermission "insertProvider" target name
mullan
parents: 18579
diff changeset
   231
 * "insertProvider" permission instead.
103262cae675 8001319: Add SecurityPermission "insertProvider" target name
mullan
parents: 18579
diff changeset
   232
 * <p>This would allow somebody to introduce a possibly
103262cae675 8001319: Add SecurityPermission "insertProvider" target name
mullan
parents: 18579
diff changeset
   233
 * malicious provider (e.g., one that discloses the private keys passed
103262cae675 8001319: Add SecurityPermission "insertProvider" target name
mullan
parents: 18579
diff changeset
   234
 * to it) as the highest-priority provider. This would be possible
103262cae675 8001319: Add SecurityPermission "insertProvider" target name
mullan
parents: 18579
diff changeset
   235
 * because the Security object (which manages the installed providers)
103262cae675 8001319: Add SecurityPermission "insertProvider" target name
mullan
parents: 18579
diff changeset
   236
 * currently does not check the integrity or authenticity of a provider
103262cae675 8001319: Add SecurityPermission "insertProvider" target name
mullan
parents: 18579
diff changeset
   237
 * before attaching it.</td>
103262cae675 8001319: Add SecurityPermission "insertProvider" target name
mullan
parents: 18579
diff changeset
   238
 * </tr>
103262cae675 8001319: Add SecurityPermission "insertProvider" target name
mullan
parents: 18579
diff changeset
   239
 *
103262cae675 8001319: Add SecurityPermission "insertProvider" target name
mullan
parents: 18579
diff changeset
   240
 * <tr>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
   241
 *   <th scope="row">setSystemScope</th>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
 *   <td>Setting of the system identity scope</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
 *   <td>This would allow an attacker to configure the system identity scope with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
 * certificates that should not be trusted, thereby granting applet or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
 * application code signed with those certificates privileges that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
 * would have been denied by the system's original identity scope.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
 * <tr>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
   250
 *   <th scope="row">setIdentityPublicKey</th>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
 *   <td>Setting of the public key for an Identity</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
 *   <td>If the identity is marked as "trusted", this allows an attacker to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
 * introduce a different public key (e.g., its own) that is not trusted
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
 * by the system's identity scope, thereby granting applet or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
 * application code signed with that public key privileges that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
 * would have been denied otherwise.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
 * <tr>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
   260
 *   <th scope="row">setIdentityInfo</th>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
 *   <td>Setting of a general information string for an Identity</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
 *   <td>This allows attackers to set the general description for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
 * an identity.  This may trick applications into using a different
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
 * identity than intended or may prevent applications from finding a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
 * particular identity.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
 * <tr>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
   269
 *   <th scope="row">addIdentityCertificate</th>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
 *   <td>Addition of a certificate for an Identity</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
 *   <td>This allows attackers to set a certificate for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
 * an identity's public key.  This is dangerous because it affects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
 * the trust relationship across the system. This public key suddenly
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
 * becomes trusted to a wider audience than it otherwise would be.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
 * <tr>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
   278
 *   <th scope="row">removeIdentityCertificate</th>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
 *   <td>Removal of a certificate for an Identity</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
 *   <td>This allows attackers to remove a certificate for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
 * an identity's public key. This is dangerous because it affects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
 * the trust relationship across the system. This public key suddenly
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
 * becomes considered less trustworthy than it otherwise would be.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
 * <tr>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
   287
 *  <th scope="row">printIdentity</th>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
 *  <td>Viewing the name of a principal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
 * and optionally the scope in which it is used, and whether
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
 * or not it is considered "trusted" in that scope</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
 *  <td>The scope that is printed out may be a filename, in which case
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
 * it may convey local system information. For example, here's a sample
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
 * printout of an identity named "carol", who is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
 * marked not trusted in the user's identity database:<br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
 *   carol[/home/luehe/identitydb.obj][not trusted]</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>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
   299
 *   <th scope="row">getSignerPrivateKey</th>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
 *   <td>Retrieval of a Signer's private key</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
 *   <td>It is very dangerous to allow access to a private key; private
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
 * keys are supposed to be kept secret. Otherwise, code can use the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
 * private key to sign various files and claim the signature came from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
 * the Signer.</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>
45881
aaec0fbe17ae 8184208: update class="striped" tables for accessibility
jjg
parents: 45434
diff changeset
   308
 *   <th scope="row">setSignerKeyPair</th>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
 *   <td>Setting of the key pair (public key and private key) for a Signer</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
 *   <td>This would allow an attacker to replace somebody else's (the "target's")
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
 * keypair with a possibly weaker keypair (e.g., a keypair of a smaller
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
 * keysize).  This also would allow the attacker to listen in on encrypted
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
 * communication between the target and its peers. The target's peers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
 * might wrap an encryption session key under the target's "new" public
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
 * key, which would allow the attacker (who possesses the corresponding
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
 * private key) to unwrap the session key and decipher the communication
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
 * data encrypted under that session key.</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
 *
45124
144479e89cdb 8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents: 32931
diff changeset
   320
 * </tbody>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
 * </table>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
 *
32107
67aa4920495c 8077055: Allow other named SecurityPermissions, RuntimePermissions, and AuthPermissions to be used
mullan
parents: 25859
diff changeset
   323
 * @implNote
67aa4920495c 8077055: Allow other named SecurityPermissions, RuntimePermissions, and AuthPermissions to be used
mullan
parents: 25859
diff changeset
   324
 * Implementations may define additional target names, but should use naming
67aa4920495c 8077055: Allow other named SecurityPermissions, RuntimePermissions, and AuthPermissions to be used
mullan
parents: 25859
diff changeset
   325
 * conventions such as reverse domain name notation to avoid name clashes.
67aa4920495c 8077055: Allow other named SecurityPermissions, RuntimePermissions, and AuthPermissions to be used
mullan
parents: 25859
diff changeset
   326
 *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
 * @see java.security.BasicPermission
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
 * @see java.security.Permission
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
 * @see java.security.Permissions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
 * @see java.security.PermissionCollection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
 * @see java.lang.SecurityManager
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
 * @author Marianne Mueller
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
 * @author Roland Schemers
45434
4582657c7260 8181082: class-level since tag issues in java.base & java.datatransfer module
mli
parents: 45124
diff changeset
   336
 * @since 1.2
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
public final class SecurityPermission extends BasicPermission {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
57950
4612a3cfb927 8229999: Apply java.io.Serial annotations to security types in java.base
darcy
parents: 47216
diff changeset
   341
    @java.io.Serial
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
    private static final long serialVersionUID = 5236109936224050470L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
     * Creates a new SecurityPermission with the specified name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
     * The name is the symbolic name of the SecurityPermission. An asterisk
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
     * may appear at the end of the name, following a ".", or by itself, to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
     * signify a wildcard match.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
     * @param name the name of the SecurityPermission
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
     *
18579
b678846778ad 8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents: 5506
diff changeset
   352
     * @throws NullPointerException if {@code name} is {@code null}.
b678846778ad 8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents: 5506
diff changeset
   353
     * @throws IllegalArgumentException if {@code name} is empty.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
    public SecurityPermission(String name)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
        super(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
     * Creates a new SecurityPermission object with the specified name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
     * The name is the symbolic name of the SecurityPermission, and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
     * actions String is currently unused and should be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
     * @param name the name of the SecurityPermission
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
     * @param actions should be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
     *
18579
b678846778ad 8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents: 5506
diff changeset
   368
     * @throws NullPointerException if {@code name} is {@code null}.
b678846778ad 8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents: 5506
diff changeset
   369
     * @throws IllegalArgumentException if {@code name} is empty.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
    public SecurityPermission(String name, String actions)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
        super(name, actions);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
}