0N/A/*
3909N/A * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage java.net;
0N/A
0N/Aimport java.security.*;
0N/Aimport java.util.Enumeration;
0N/Aimport java.util.Hashtable;
0N/Aimport java.util.StringTokenizer;
0N/A
0N/A/**
0N/A * This class is for various network permissions.
0N/A * A NetPermission contains a name (also referred to as a "target name") but
0N/A * no actions list; you either have the named permission
0N/A * or you don't.
0N/A * <P>
0N/A * The target name is the name of the network permission (see below). The naming
0N/A * convention follows the hierarchical property naming convention.
0N/A * Also, an asterisk
0N/A * may appear at the end of the name, following a ".", or by itself, to
0N/A * signify a wildcard match. For example: "foo.*" or "*" is valid,
0N/A * "*foo" or "a*b" is not valid.
0N/A * <P>
0N/A * The following table lists all the possible NetPermission target names,
0N/A * and for each provides a description of what the permission allows
0N/A * and a discussion of the risks of granting code the permission.
0N/A * <P>
0N/A *
0N/A * <table border=1 cellpadding=5 summary="Permission target name, what the permission allows, and associated risks">
0N/A * <tr>
0N/A * <th>Permission Target Name</th>
0N/A * <th>What the Permission Allows</th>
0N/A * <th>Risks of Allowing this Permission</th>
0N/A * </tr>
0N/A * <tr>
2909N/A * <td>allowHttpTrace</td>
2909N/A * <td>The ability to use the HTTP TRACE method in HttpURLConnection.</td>
2909N/A * <td>Malicious code using HTTP TRACE could get access to security sensitive
2909N/A * information in the HTTP headers (such as cookies) that it might not
2909N/A * otherwise have access to.</td>
2909N/A * </tr>
0N/A *
0N/A * <tr>
2909N/A * <td>getCookieHandler</td>
2909N/A * <td>The ability to get the cookie handler that processes highly
2909N/A * security sensitive cookie information for an Http session.</td>
2909N/A * <td>Malicious code can get a cookie handler to obtain access to
2909N/A * highly security sensitive cookie information. Some web servers
2909N/A * use cookies to save user private information such as access
2909N/A * control information, or to track user browsing habit.</td>
2909N/A * </tr>
0N/A *
0N/A * <tr>
3669N/A * <td>getNetworkInformation</td>
3669N/A * <td>The ability to retrieve all information about local network interfaces.</td>
3669N/A * <td>Malicious code can read information about network hardware such as
3669N/A * MAC addresses, which could be used to construct local IPv6 addresses.</td>
3669N/A * </tr>
3669N/A *
3669N/A * <tr>
0N/A * <td>getProxySelector</td>
0N/A * <td>The ability to get the proxy selector used to make decisions
0N/A * on which proxies to use when making network connections.</td>
0N/A * <td>Malicious code can get a ProxySelector to discover proxy
0N/A * hosts and ports on internal networks, which could then become
0N/A * targets for attack.</td>
0N/A * </tr>
0N/A *
0N/A * <tr>
2909N/A * <td>getResponseCache</td>
2909N/A * <td>The ability to get the response cache that provides
2909N/A * access to a local response cache.</td>
2909N/A * <td>Malicious code getting access to the local response cache
2909N/A * could access security sensitive information.</td>
2909N/A * </tr>
2909N/A *
2909N/A * <tr>
2909N/A * <td>requestPasswordAuthentication</td>
2909N/A * <td>The ability
2909N/A * to ask the authenticator registered with the system for
2909N/A * a password</td>
2909N/A * <td>Malicious code may steal this password.</td>
2909N/A * </tr>
2909N/A *
2909N/A * <tr>
0N/A * <td>setCookieHandler</td>
0N/A * <td>The ability to set the cookie handler that processes highly
0N/A * security sensitive cookie information for an Http session.</td>
0N/A * <td>Malicious code can set a cookie handler to obtain access to
0N/A * highly security sensitive cookie information. Some web servers
0N/A * use cookies to save user private information such as access
0N/A * control information, or to track user browsing habit.</td>
0N/A * </tr>
0N/A *
0N/A * <tr>
2909N/A * <td>setDefaultAuthenticator</td>
2909N/A * <td>The ability to set the
2909N/A * way authentication information is retrieved when
2909N/A * a proxy or HTTP server asks for authentication</td>
2909N/A * <td>Malicious
2909N/A * code can set an authenticator that monitors and steals user
2909N/A * authentication input as it retrieves the input from the user.</td>
2909N/A * </tr>
2909N/A *
2909N/A * <tr>
2909N/A * <td>setProxySelector</td>
2909N/A * <td>The ability to set the proxy selector used to make decisions
2909N/A * on which proxies to use when making network connections.</td>
2909N/A * <td>Malicious code can set a ProxySelector that directs network
2909N/A * traffic to an arbitrary network host.</td>
2909N/A * </tr>
0N/A *
0N/A * <tr>
0N/A * <td>setResponseCache</td>
0N/A * <td>The ability to set the response cache that provides access to
0N/A * a local response cache.</td>
0N/A * <td>Malicious code getting access to the local response cache
0N/A * could access security sensitive information, or create false
0N/A * entries in the response cache.</td>
0N/A * </tr>
0N/A *
0N/A * <tr>
2909N/A * <td>specifyStreamHandler</td>
2909N/A * <td>The ability
2909N/A * to specify a stream handler when constructing a URL</td>
2909N/A * <td>Malicious code may create a URL with resources that it would
2909N/Anormally not have access to (like file:/foo/fum/), specifying a
2909N/Astream handler that gets the actual bytes from someplace it does
2909N/Ahave access to. Thus it might be able to trick the system into
2909N/Acreating a ProtectionDomain/CodeSource for a class even though
2909N/Athat class really didn't come from that location.</td>
2909N/A * </tr>
0N/A * </table>
0N/A *
0N/A * @see java.security.BasicPermission
0N/A * @see java.security.Permission
0N/A * @see java.security.Permissions
0N/A * @see java.security.PermissionCollection
0N/A * @see java.lang.SecurityManager
0N/A *
0N/A *
0N/A * @author Marianne Mueller
0N/A * @author Roland Schemers
0N/A */
0N/A
0N/Apublic final class NetPermission extends BasicPermission {
0N/A private static final long serialVersionUID = -8343910153355041693L;
0N/A
0N/A /**
0N/A * Creates a new NetPermission with the specified name.
0N/A * The name is the symbolic name of the NetPermission, such as
0N/A * "setDefaultAuthenticator", etc. An asterisk
0N/A * may appear at the end of the name, following a ".", or by itself, to
0N/A * signify a wildcard match.
0N/A *
0N/A * @param name the name of the NetPermission.
0N/A *
0N/A * @throws NullPointerException if <code>name</code> is <code>null</code>.
0N/A * @throws IllegalArgumentException if <code>name</code> is empty.
0N/A */
0N/A
0N/A public NetPermission(String name)
0N/A {
0N/A super(name);
0N/A }
0N/A
0N/A /**
0N/A * Creates a new NetPermission object with the specified name.
0N/A * The name is the symbolic name of the NetPermission, and the
0N/A * actions String is currently unused and should be null.
0N/A *
0N/A * @param name the name of the NetPermission.
0N/A * @param actions should be null.
0N/A *
0N/A * @throws NullPointerException if <code>name</code> is <code>null</code>.
0N/A * @throws IllegalArgumentException if <code>name</code> is empty.
0N/A */
0N/A
0N/A public NetPermission(String name, String actions)
0N/A {
0N/A super(name, actions);
0N/A }
0N/A}