< prev index next >

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

Print this page




  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         }
  76     }
  77 
  78     /**
  79      * Constructs a {@code LinkPermission} with the specified name.
  80      *
  81      * @param   name
  82      *          the name of the permission. It must be "hard" or "symbolic".
  83      *
  84      * @throws  IllegalArgumentException
  85      *          if name is empty or invalid
  86      */
  87     public LinkPermission(String name) {
  88         super(name);
  89         checkName(name);




  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     @java.io.Serial
  71     static final long serialVersionUID = -1441492453772213220L;
  72 
  73     private void checkName(String name) {
  74         if (!name.equals("hard") && !name.equals("symbolic")) {
  75             throw new IllegalArgumentException("name: " + name);
  76         }
  77     }
  78 
  79     /**
  80      * Constructs a {@code LinkPermission} with the specified name.
  81      *
  82      * @param   name
  83      *          the name of the permission. It must be "hard" or "symbolic".
  84      *
  85      * @throws  IllegalArgumentException
  86      *          if name is empty or invalid
  87      */
  88     public LinkPermission(String name) {
  89         super(name);
  90         checkName(name);


< prev index next >