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

Improve coverage of enhanced exception messages

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • 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 and IP addresses from exception messages, 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.

      Note. This is an update to the previously approved version of this CSR. The change from the approved version is to reduce and simplify the number of category values. Now, all networking related enhanced exceptions can be enabled with the single value "hostInfo" except for the userInfo category defined below (which hasn't changed from the approved version).

      Solution

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

      What used to be covered by the hostInfo value is now covered by the hostInfoExclSocket value, since what it covered actually related more closely to low level socket exceptions The hostInfo value scope is extended and now refers to all networking related exceptions (except for userInfo). This preserves compatibility with previous releases when that value was specified.

      A new value is added called userInfo which controls networking exceptions that relate to user credentials.

      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 command line. This default value is hostInfoExclSocket.

      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..f4eadb9e4438d 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,17 +1294,28 @@ 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
      -#             java.nio.channels package will contain enhanced exception
      -#             message information
      +#  hostInfo - All networking related exceptions will contain enhanced
      +#             exception message information.
      +#
      +#  hostInfoExclSocket - The hostInfo category defined above, excluding
      +#             IOExceptions thrown by java.net.Socket and the NetworkChannel
      +#             types in the java.nio.channels package, will contain enhanced
      +#             exception message information
       #
       #  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=hostInfoExclSocket
      
       #
       # Disabled mechanisms for the Simple Authentication and Security Layer (SASL)

            michaelm Michael McMahon
            michaelm Michael McMahon
            Alan Bateman, Daniel Fuchs
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: