Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8354677

Improve coverage of enhanced exception messages

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Unresolved
    • Icon: P3 P3
    • 25
    • core-libs
    • None
    • behavioral
    • minimal
    • The change introduces new values for an existing system/security property. The default "out of the box" behavior will be the same as before. Also, the behavior will be the same if the existing defined value of the property is used.
    • System or security property
    • JDK

      Summary

      Increase coverage of enhanced exception messages

      Problem

      Enhanced exception messages are designed to hide sensitive information such as hostnames, IP addresses from exception message strings, unless the enhanced mode for the specific category has been explicitly enabled. This capability was originally added for networking code in JDK-8204233. It was then generalised to work with other code categories in JDK-8207846.

      This issue aims to extend the use of this capability throughout all networking code by introducing new categories.

      Solution

      The solution is to add some new values for the jdk.includeInExceptions system/security property and modify the existing hostInfo value while maintaining the existing behavior.

      The hostInfo value is renamed to socket since it relates more closely to low level socket exceptions. A new value is added called addressLookup which controls InetAddress / DNS lookup exceptions. A new value is added called userInfo which controls networking exceptions that relate to user credentials. A new value is added called net which controls all other networking related exceptions.

      To maintain compatibility, the value hostInfo will now have the same effect as if socket,addressLookup,net were specified. Also, a default value will be specified in the java.security properties file which maintains compatibility when the user does not specify any value for the property on the comman dine. This default value is addressLookup,net,userInfo.

      Specification

      The following is the diff for the java.security config file which explains the new values of the property and the change to the existing values

      diff --git a/src/java.base/share/conf/security/java.security b/src/java.base/share/conf/security/java.security
      index b115d47983848..5785c3b3144e9 100644
      --- a/src/java.base/share/conf/security/java.security
      +++ b/src/java.base/share/conf/security/java.security
      @@ -1277,8 +1277,11 @@ jceks.key.serialFilter = java.base/java.lang.Enum;java.base/java.security.KeyRep
       #       
       # Enhanced exception message information
       #       
      -# By default, exception messages should not include potentially sensitive
      -# information such as file names, host names, or port numbers. This property
      +# Exception messages may include potentially sensitive information such as file
      +# names, host names, or port numbers. By default, socket related exceptions
      +# have this information restricted (meaning the sensitive details are removed).
      +# This property can be used to relax this restriction or to place further
      +# restrictions on other categories, defined below. The property
       # accepts one or more comma separated values, each of which represents a
       # category of enhanced exception message information to enable. Values are
       # case-insensitive. Leading and trailing whitespaces, surrounding each value,
      @@ -1291,18 +1294,35 @@ jceks.key.serialFilter = java.base/java.lang.Enum;java.base/java.security.KeyRep
       #
       # The categories are:
       #
      -#  hostInfo - IOExceptions thrown by java.net.Socket and the socket types in the
      +#  socket   - IOExceptions thrown by java.net.Socket and the socket types in the
       #             java.nio.channels package will contain enhanced exception
       #             message information
       #
      +#  addressLookup - UnknownHostExceptions and other exceptions thrown by the
      +#             java.net.InetAddress class 
      +#   
      +#  net      - All other exceptions thrown in networking code not included
      +#             in the categories above. This include URL/URI, NetworkInterface
      +#             and URLConnection among others.
      +#
      +#  hostInfo - Special value which signifies the three categories above combined
      +#             (socket, addressLookup, net). This is provided for compatibility
      +#             with previous releases.
      +#
       #  jar      - enables more detailed information in the IOExceptions thrown
       #             by classes in the java.util.jar package
       #
      +#  userInfo - enables more detailed information in exceptions which may contain
      +#             user identity information
      +#
       # The property setting in this file can be overridden by a system property of
       # the same name, with the same syntax and possible values.
       #
       -#jdk.includeInExceptions=hostInfo,jar
       -
       +# If the property is not set or set to an empty string, then this is the most
       +# restricted setting with all categories disabled. The following is the default
       +# (out of the box) setting, meaning these categories are not restricted.
       +#
       +jdk.includeInExceptions=addressLookup,net,userInfo
       #
       # Disabled mechanisms for the Simple Authentication and Security Layer (SASL)
       #
      

            michaelm Michael McMahon
            michaelm Michael McMahon
            Daniel Fuchs
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: