AWTPermission.java 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /* AWTPermission.java -- AWT related permissions
  2. Copyright (C) 2000, 2002 Free Software Foundation
  3. This file is part of GNU Classpath.
  4. GNU Classpath is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2, or (at your option)
  7. any later version.
  8. GNU Classpath is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GNU Classpath; see the file COPYING. If not, write to the
  14. Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  15. 02111-1307 USA.
  16. Linking this library statically or dynamically with other modules is
  17. making a combined work based on this library. Thus, the terms and
  18. conditions of the GNU General Public License cover the whole
  19. combination.
  20. As a special exception, the copyright holders of this library give you
  21. permission to link this library with independent modules to produce an
  22. executable, regardless of the license terms of these independent
  23. modules, and to copy and distribute the resulting executable under
  24. terms of your choice, provided that you also meet, for each linked
  25. independent module, the terms and conditions of the license of that
  26. module. An independent module is a module which is not derived from
  27. or based on this library. If you modify this library, you may extend
  28. this exception to your version of the library, but you are not
  29. obligated to do so. If you do not wish to do so, delete this
  30. exception statement from your version. */
  31. package java.awt;
  32. import java.security.BasicPermission;
  33. /**
  34. * This class implements permissions for AWT. This is a named
  35. * permission. No actions are defined.
  36. *
  37. * <p>The following table provides a list of all the possible AWTPermission
  38. * permission names with a description of what that permission allows.<br>
  39. * <table border=1>
  40. * <tr><th>Permission Name</th><th>Permission Allows</th><th>Risks</th</tr>
  41. * <tr>
  42. * <td><code>accessClipboard</code></td>
  43. * <td>posting and reading the AWT clipboard</td>
  44. * <td>the clipboard may contain sensitive data</td></tr>
  45. * <tr>
  46. * <td><code>accessEventQueue</code></td>
  47. * <td>access to the AWT event queue</td>
  48. * <td>malicious code could remove real events and replace them with bogus
  49. * ones, including simulating the user granting permission</td></tr>
  50. * <tr>
  51. * <td><code>listenToAllAWTEvents</code></td>
  52. * <td>listen to system-wide AWT events</td>
  53. * <td>malicious code can read passwords entered in an AWT event, and in
  54. * combination with accessEventQueue, could fake system events</td></tr>
  55. * <tr>
  56. * <td><code>showWindowWithoutWarningBanner</code></td>
  57. * <td>display a window without a banner notification of insecurity</td>
  58. * <td>malicious code could install a Trojan horse applet that looks like
  59. * a normal window, and thus steal data like passwords</td></tr>
  60. * <tr>
  61. * <td><code>readDisplayPixels</code></td>
  62. * <td>read back pixels from the display screen</td>
  63. * <td>malicious code could snoop on the user's actions</td></tr>
  64. * <tr>
  65. * <td><code>createRobot</code></td>
  66. * <td>create an instance of java.awt.Robot</td>
  67. * <td>these objects can generate events as though they were the user; so
  68. * malicious code could control the system</td></tr>
  69. * <tr>
  70. * <td><code>fullScreenExclusive</code></td>
  71. * <td>enter full-screen exclusive mode</td>
  72. * <td>malicious code could masquerade as a trusted program</td><tr>
  73. * </table>
  74. *
  75. * @author Tom Tromey <tromey@redhat.com>
  76. * @since 1.2
  77. * @status updated to 1.4
  78. */
  79. public final class AWTPermission extends BasicPermission
  80. {
  81. /**
  82. * Compatible with JDK 1.2+.
  83. */
  84. private static final long serialVersionUID = 8890392402588814465L;
  85. /**
  86. * Construct a AWTPermission with the given name.
  87. *
  88. * @param name the permission name
  89. * @throws NullPointerException if name is null
  90. * @throws IllegalArgumentException if name is invalid
  91. */
  92. public AWTPermission(String name)
  93. {
  94. super(name);
  95. }
  96. /**
  97. * Create a new permission with the specified name. The actions argument
  98. * is ignored, as AWT permissions have no actions.
  99. *
  100. * @param name the permission name
  101. * @param actions ignored
  102. * @throws NullPointerException if name is null
  103. * @throws IllegalArgumentException if name is invalid
  104. */
  105. public AWTPermission(String name, String actions)
  106. {
  107. super(name);
  108. }
  109. } // class AWTPermission