From 110670c3dddf10b8d76da82bd148359d0c5c4055 Mon Sep 17 00:00:00 2001 From: John Viegas Date: Fri, 1 Dec 2023 10:00:38 -0800 Subject: [PATCH] Disable useEnvironmentVariableValues by default because of regression issue #4728 --- .../bugfix-AWSSDKforJavav2-34a2686.json | 6 ++++++ .../awssdk/crtcore/CrtProxyConfiguration.java | 12 +++++++----- .../awssdk/http/apache/ProxyConfiguration.java | 16 ++++++++-------- .../http/nio/netty/ProxyConfiguration.java | 14 +++++++------- .../http/urlconnection/ProxyConfiguration.java | 11 ++++++----- .../http/proxy/ProxyConfigCommonTestData.java | 4 ++-- 6 files changed, 36 insertions(+), 27 deletions(-) create mode 100644 .changes/next-release/bugfix-AWSSDKforJavav2-34a2686.json diff --git a/.changes/next-release/bugfix-AWSSDKforJavav2-34a2686.json b/.changes/next-release/bugfix-AWSSDKforJavav2-34a2686.json new file mode 100644 index 000000000000..dafe218926a5 --- /dev/null +++ b/.changes/next-release/bugfix-AWSSDKforJavav2-34a2686.json @@ -0,0 +1,6 @@ +{ + "type": "bugfix", + "category": "AWS SDK for Java v2\"", + "contributor": "", + "description": "Disabling the useEnvironmentVariableValues by default for all Http clients since it caused regression issues as Issue [#4728](https://github.com/aws/aws-sdk-java-v2/issues/4728)" +} diff --git a/core/crt-core/src/main/java/software/amazon/awssdk/crtcore/CrtProxyConfiguration.java b/core/crt-core/src/main/java/software/amazon/awssdk/crtcore/CrtProxyConfiguration.java index a53b74dfc5d2..d82ce99d8e72 100644 --- a/core/crt-core/src/main/java/software/amazon/awssdk/crtcore/CrtProxyConfiguration.java +++ b/core/crt-core/src/main/java/software/amazon/awssdk/crtcore/CrtProxyConfiguration.java @@ -20,6 +20,7 @@ import java.util.Objects; import software.amazon.awssdk.annotations.SdkPublicApi; import software.amazon.awssdk.utils.ProxyConfigProvider; +import software.amazon.awssdk.utils.ProxyEnvironmentSetting; import software.amazon.awssdk.utils.ProxySystemSetting; import software.amazon.awssdk.utils.StringUtils; @@ -240,10 +241,11 @@ public interface Builder { Builder useSystemPropertyValues(Boolean useSystemPropertyValues); /** - * The option whether to use environment variable values from {@link ProxySystemSetting} if any of the config options are - * missing. The value is set to "true" by default which means SDK will automatically use environment variable values if - * options are not provided during building the {@link CrtProxyConfiguration} object. To disable this behavior, set this - * value to false.It is important to note that when this property is set to "true," all proxy settings will exclusively + * The option whether to use environment variable values from {@link ProxyEnvironmentSetting} if any of the config options + * are missing. + * The value is set to "false" by default which means SDK will not automatically use environment variable values if + * options are not provided during building the {@link CrtProxyConfiguration} object. To enable this behavior, set this + * value to true. It is important to note that when this property is set to "true," all proxy settings will exclusively * originate from environment variableValues, and no partial settings will be obtained from SystemPropertyValues. * * @param useEnvironmentVariableValues The option whether to use environment variable values @@ -263,7 +265,7 @@ protected abstract static class DefaultBuilder implements Bui private String username; private String password; private Boolean useSystemPropertyValues = Boolean.TRUE; - private Boolean useEnvironmentVariableValues = Boolean.TRUE; + private Boolean useEnvironmentVariableValues = Boolean.FALSE; protected DefaultBuilder() { } diff --git a/http-clients/apache-client/src/main/java/software/amazon/awssdk/http/apache/ProxyConfiguration.java b/http-clients/apache-client/src/main/java/software/amazon/awssdk/http/apache/ProxyConfiguration.java index 07600267b528..c6fb8995748d 100644 --- a/http-clients/apache-client/src/main/java/software/amazon/awssdk/http/apache/ProxyConfiguration.java +++ b/http-clients/apache-client/src/main/java/software/amazon/awssdk/http/apache/ProxyConfiguration.java @@ -24,6 +24,7 @@ import java.util.Set; import software.amazon.awssdk.annotations.SdkPublicApi; import software.amazon.awssdk.utils.ProxyConfigProvider; +import software.amazon.awssdk.utils.ProxyEnvironmentSetting; import software.amazon.awssdk.utils.ProxySystemSetting; import software.amazon.awssdk.utils.ToString; import software.amazon.awssdk.utils.Validate; @@ -285,13 +286,12 @@ public interface Builder extends CopyableBuilder { Builder useSystemPropertyValues(Boolean useSystemPropertyValues); /** - * Option whether to use environment variable values for proxy configuration if any of the config options are missing. - *

- * This value is set to "true" by default, which means the SDK will automatically use environment variable values for - * proxy configuration options that are not provided during the building of the {@link ProxyConfiguration} object. To - * disable this behavior, set this value to "false". It is important to note that when this property is set to "true," all - * proxy settings will exclusively originate from environment variableValues, and no partial settings will be obtained - * from SystemPropertyValues. + * Option whether to use environment variable values from {@link ProxyEnvironmentSetting} if any of the config options are + * missing. This value is set to "false" by default, which means SDK will not automatically use environment variable + * values for options that are not provided during building of {@link ProxyConfiguration} object. To enable this + * behavior, set this value to "true".It is important to note that when this property is set to "true," all proxy + * settings will exclusively originate from environment variableValues, and no partial settings will be obtained from + * SystemPropertyValues. * * @param useEnvironmentVariableValues The option whether to use environment variable values. * @return This object for method chaining. @@ -323,7 +323,7 @@ private static final class DefaultClientProxyConfigurationBuilder implements Bui private Set nonProxyHosts; private Boolean preemptiveBasicAuthenticationEnabled; private Boolean useSystemPropertyValues = Boolean.TRUE; - private Boolean useEnvironmentVariableValues = Boolean.TRUE; + private Boolean useEnvironmentVariableValues = Boolean.FALSE; private String scheme = "http"; @Override diff --git a/http-clients/netty-nio-client/src/main/java/software/amazon/awssdk/http/nio/netty/ProxyConfiguration.java b/http-clients/netty-nio-client/src/main/java/software/amazon/awssdk/http/nio/netty/ProxyConfiguration.java index d1d91bcd0f63..da039764fe23 100644 --- a/http-clients/netty-nio-client/src/main/java/software/amazon/awssdk/http/nio/netty/ProxyConfiguration.java +++ b/http-clients/netty-nio-client/src/main/java/software/amazon/awssdk/http/nio/netty/ProxyConfiguration.java @@ -273,12 +273,12 @@ public interface Builder extends CopyableBuilder { /** - * Set the option whether to use environment variable values for {@link ProxyEnvironmentSetting} if any of the config - * options are missing. The value is set to "true" by default, enabling the SDK to automatically use environment variable - * values for proxy configuration options that are not provided during building the {@link ProxyConfiguration} object. To - * disable this behavior, set this value to "false".It is important to note that when this property is set to "true," all - * proxy settings will exclusively originate from Environment Variable Values, and no partial settings will be obtained - * from System Property Values. + * Option whether to use environment variable values from {@link ProxyEnvironmentSetting} if any of the config options are + * missing. This value is set to "false" by default, which means SDK will not automatically use environment variable + * values for options that are not provided during building of {@link ProxyConfiguration} object. To enable this + * behavior, set this value to "true".It is important to note that when this property is set to "true," all proxy + * settings will exclusively originate from environment variableValues, and no partial settings will be obtained from + * SystemPropertyValues. * * @param useEnvironmentVariablesValues The option whether to use environment variable values * @return This object for method chaining. @@ -295,7 +295,7 @@ private static final class BuilderImpl implements Builder { private String password; private Set nonProxyHosts; private Boolean useSystemPropertyValues = Boolean.TRUE; - private Boolean useEnvironmentVariablesValues = Boolean.TRUE; + private Boolean useEnvironmentVariablesValues = Boolean.FALSE; private BuilderImpl() { } diff --git a/http-clients/url-connection-client/src/main/java/software/amazon/awssdk/http/urlconnection/ProxyConfiguration.java b/http-clients/url-connection-client/src/main/java/software/amazon/awssdk/http/urlconnection/ProxyConfiguration.java index 5103817d1eef..e96034c3070a 100644 --- a/http-clients/url-connection-client/src/main/java/software/amazon/awssdk/http/urlconnection/ProxyConfiguration.java +++ b/http-clients/url-connection-client/src/main/java/software/amazon/awssdk/http/urlconnection/ProxyConfiguration.java @@ -241,10 +241,11 @@ public interface Builder extends CopyableBuilder { /** * Option whether to use environment variable values from {@link ProxyEnvironmentSetting} if any of the config options are - * missing. This value is set to "true" by default, which means SDK will automatically use environment variable values for - * options that are not provided during building the {@link ProxyConfiguration} object. To disable this behavior, set this - * value to "false".It is important to note that when this property is set to "true," all proxy settings will exclusively - * originate from environment variableValues, and no partial settings will be obtained from SystemPropertyValues. + * missing. This value is set to "false" by default, which means SDK will not automatically use environment variable + * values for options that are not provided during building of {@link ProxyConfiguration} object. To enable this + * behavior, set this value to "true".It is important to note that when this property is set to "true," all proxy + * settings will exclusively originate from environment variableValues, and no partial settings will be obtained from + * SystemPropertyValues. * * @param useEnvironmentVariablesValues The option whether to use environment variable values * @return This object for method chaining. @@ -273,7 +274,7 @@ private static final class DefaultClientProxyConfigurationBuilder implements Bui private String password; private Set nonProxyHosts; private Boolean useSystemPropertyValues = Boolean.TRUE; - private Boolean useEnvironmentVariablesValues = Boolean.TRUE; + private Boolean useEnvironmentVariablesValues = Boolean.FALSE; @Override public Builder endpoint(URI endpoint) { diff --git a/test/http-client-tests/src/main/java/software/amazon/awssdk/http/proxy/ProxyConfigCommonTestData.java b/test/http-client-tests/src/main/java/software/amazon/awssdk/http/proxy/ProxyConfigCommonTestData.java index 4dc1d58be2c7..e507bafa4c0c 100644 --- a/test/http-client-tests/src/main/java/software/amazon/awssdk/http/proxy/ProxyConfigCommonTestData.java +++ b/test/http-client-tests/src/main/java/software/amazon/awssdk/http/proxy/ProxyConfigCommonTestData.java @@ -90,7 +90,7 @@ public static Stream proxyConfigurationSetting() { + "when using the default proxy builder, the proxy configuration is resolved to use environment variables.", Collections.singletonList(Pair.of("", "")), environmentSettings(), - new TestProxySetting(), null, null, getEnvironmentVariableProxySettings()), + new TestProxySetting(), null, null, new TestProxySetting()), Arguments.of( "Provided with no system property and valid environment variables, when using the host," @@ -119,7 +119,7 @@ public static Stream proxyConfigurationSetting() { + "then proxy resolved to environment", Collections.singletonList(Pair.of("", "")), environmentSettings(), - null, true, null, getEnvironmentVariableProxySettings()), + null, true, null, new TestProxySetting()), Arguments.of( "Provided only environment variable when useEnvironmentVariable set to false then proxy resolved "