< prev index next >

src/java.base/share/classes/java/nio/file/LinkPermission.java

Print this page




  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package java.nio.file;
  27 
  28 import java.security.BasicPermission;
  29 
  30 /**
  31  * The {@code Permission} class for link creation operations.
  32  *
  33  * <p> The following table provides a summary description of what the permission
  34  * allows, and discusses the risks of granting code the permission.
  35  *
  36  * <table class="striped">
  37  * <caption style="display:none">Table shows permission target name, what the permission allows, and associated risks</caption>
  38  * <thead>
  39  * <tr>
  40  * <th>Permission Target Name</th>
  41  * <th>What the Permission Allows</th>
  42  * <th>Risks of Allowing this Permission</th>
  43  * </tr>
  44  * </thead>
  45  * <tbody>
  46  * <tr>
  47  *   <td>hard</td>
  48  *   <td> Ability to add an existing file to a directory. This is sometimes
  49  *   known as creating a link, or hard link. </td>
  50  *   <td> Extreme care should be taken when granting this permission. It allows
  51  *   linking to any file or directory in the file system thus allowing the
  52  *   attacker access to all files. </td>
  53  * </tr>
  54  * <tr>
  55  *   <td>symbolic</td>
  56  *   <td> Ability to create symbolic links. </td>
  57  *   <td> Extreme care should be taken when granting this permission. It allows
  58  *   linking to any file or directory in the file system thus allowing the
  59  *   attacker to access to all files. </td>
  60  * </tr>
  61  * </tbody>
  62  * </table>
  63  *
  64  * @since 1.7
  65  *
  66  * @see Files#createLink
  67  * @see Files#createSymbolicLink
  68  */
  69 public final class LinkPermission extends BasicPermission {
  70     static final long serialVersionUID = -1441492453772213220L;
  71 
  72     private void checkName(String name) {
  73         if (!name.equals("hard") && !name.equals("symbolic")) {
  74             throw new IllegalArgumentException("name: " + name);
  75         }




  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package java.nio.file;
  27 
  28 import java.security.BasicPermission;
  29 
  30 /**
  31  * The {@code Permission} class for link creation operations.
  32  *
  33  * <p> The following table provides a summary description of what the permission
  34  * allows, and discusses the risks of granting code the permission.
  35  *
  36  * <table class="striped">
  37  * <caption style="display:none">Table shows permission target name, what the permission allows, and associated risks</caption>
  38  * <thead>
  39  * <tr>
  40  * <th scope="col">Permission Target Name</th>
  41  * <th scope="col">What the Permission Allows</th>
  42  * <th scope="col">Risks of Allowing this Permission</th>
  43  * </tr>
  44  * </thead>
  45  * <tbody>
  46  * <tr>
  47  *   <th scope="row">hard</th>
  48  *   <td> Ability to add an existing file to a directory. This is sometimes
  49  *   known as creating a link, or hard link. </td>
  50  *   <td> Extreme care should be taken when granting this permission. It allows
  51  *   linking to any file or directory in the file system thus allowing the
  52  *   attacker access to all files. </td>
  53  * </tr>
  54  * <tr>
  55  *   <th scope="row">symbolic</th>
  56  *   <td> Ability to create symbolic links. </td>
  57  *   <td> Extreme care should be taken when granting this permission. It allows
  58  *   linking to any file or directory in the file system thus allowing the
  59  *   attacker to access to all files. </td>
  60  * </tr>
  61  * </tbody>
  62  * </table>
  63  *
  64  * @since 1.7
  65  *
  66  * @see Files#createLink
  67  * @see Files#createSymbolicLink
  68  */
  69 public final class LinkPermission extends BasicPermission {
  70     static final long serialVersionUID = -1441492453772213220L;
  71 
  72     private void checkName(String name) {
  73         if (!name.equals("hard") && !name.equals("symbolic")) {
  74             throw new IllegalArgumentException("name: " + name);
  75         }


< prev index next >