Describe the bug
We are trying to upgrade from SDK version 1.11.352 to 1.11.800 and noticed the following:
STS moved to AwsSmithyClientT; its generic initialization omitted m_serviceName, here: m_endpointProvider->InitBuiltInParameters(m_clientConfiguration);.
Endpoint configuration only consults AWS_ENDPOINT_URL_STS and global AWS_ENDPOINT_URL when a service name is supplied.
It looks like
- PR #3236 [release 1.11.483] introduced the Smithy Client initialising without service name.
- PR #3597 [release 1.11.685] added service-aware endpoint initialization and updated ordinary generated clients to pass SERVICE_NAME, but did not update the shared AwsSmithyClientT call.
- PR #3793 [release 1.11.790] Migrated STS from the legacy client to AwsSmithyClientT, making STS inherit the omission. This is where the observable STS regression began.
Regression Issue
Expected Behavior
STS clients created through AwsSmithyClientT should honor the standard AWS endpoint override configuration, including the
service-specific AWS_ENDPOINT_URL_STS environment variable and the global AWS_ENDPOINT_URL environment variable.
AwsSmithyClientT should pass its stored service name to the endpoint provider during initialization:
m_endpointProvider->InitBuiltInParameters(
m_clientConfiguration,
m_serviceName
);
This should make STS endpoint resolution behave consistently with the legacy STS client and other generated AWS service
clients.
Current Behavior
AwsSmithyClientT::initClient() calls the one-argument overload:
m_endpointProvider->InitBuiltInParameters(m_clientConfiguration);
Because the stored service name is not supplied, the endpoint provider does not resolve AWS_ENDPOINT_URL_STS or the
global AWS_ENDPOINT_URL.
Starting with 1.11.790, STS uses AwsSmithyClientT, so STS requests ignore these environment-configured endpoint overrides
and instead use the normal AWS STS endpoint. Explicitly setting ClientConfiguration::endpointOverride is unaffected.
Reproduction Steps
#include <memory>
#include <string>
#include <aws/core/Aws.h>
#include <aws/core/auth/AWSCredentials.h>
#include <aws/core/client/GenericClientConfiguration.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/sts/STSClient.h>
#include <aws/sts/STSEndpointProvider.h>
#include <gtest/gtest.h>
namespace {
class AwsApi final {
public:
AwsApi() {
Aws::InitAPI(options);
}
~AwsApi() {
Aws::ShutdownAPI(options);
}
private:
Aws::SDKOptions options;
};
class RecordingStsEndpointProvider final
: public Aws::STS::Endpoint::STSEndpointProvider {
public:
void InitBuiltInParameters(
const Aws::Client::GenericClientConfiguration& config
) override {
++generic_init_calls;
Aws::STS::Endpoint::STSEndpointProvider::
InitBuiltInParameters(config);
}
void InitBuiltInParameters(
const Aws::Client::GenericClientConfiguration& config,
const Aws::String& service_name
) override {
++service_init_calls;
initialized_service_name = service_name.c_str();
Aws::STS::Endpoint::STSEndpointProvider::
InitBuiltInParameters(config, service_name);
}
int generic_init_calls = 0;
int service_init_calls = 0;
std::string initialized_service_name;
};
TEST(
AwsStsEndpointInitializationTest,
SmithyClientPassesServiceNameToEndpointProvider
) {
AwsApi aws_api;
auto endpoint_provider =
std::make_shared<RecordingStsEndpointProvider>();
const Aws::Auth::AWSCredentials credentials(
"test-access-key",
"test-secret-key"
);
const Aws::Client::GenericClientConfiguration config;
const Aws::STS::STSClient client(
credentials,
endpoint_provider,
config
);
EXPECT_EQ(endpoint_provider->service_init_calls, 1);
EXPECT_EQ(endpoint_provider->generic_init_calls, 0);
EXPECT_EQ(endpoint_provider->initialized_service_name, "sts");
}
} // namespace
Possible Solution
Would changing the call in AwsSmithyClientT::initClient() to the following be the intended fix?
m_endpointProvider->InitBuiltInParameters(
m_clientConfiguration,
m_serviceName
Additional Information/Context
No response
AWS CPP SDK version used
1.11.800
Compiler and Version used
GCC/G++ 12.3.0
Operating System and version
Debian GNU/Linux 12 (bookworm)
Describe the bug
We are trying to upgrade from SDK version 1.11.352 to 1.11.800 and noticed the following:
STS moved to
AwsSmithyClientT; its generic initialization omittedm_serviceName, here:m_endpointProvider->InitBuiltInParameters(m_clientConfiguration);.Endpoint configuration only consults
AWS_ENDPOINT_URL_STSand globalAWS_ENDPOINT_URLwhen a service name is supplied.It looks like
Regression Issue
Expected Behavior
STS clients created through
AwsSmithyClientTshould honor the standard AWS endpoint override configuration, including theservice-specific
AWS_ENDPOINT_URL_STSenvironment variable and the globalAWS_ENDPOINT_URLenvironment variable.AwsSmithyClientTshould pass its stored service name to the endpoint provider during initialization:This should make STS endpoint resolution behave consistently with the legacy STS client and other generated AWS service
clients.
Current Behavior
AwsSmithyClientT::initClient()calls the one-argument overload:Because the stored service name is not supplied, the endpoint provider does not resolve
AWS_ENDPOINT_URL_STSor theglobal
AWS_ENDPOINT_URL.Starting with 1.11.790, STS uses
AwsSmithyClientT, so STS requests ignore these environment-configured endpoint overridesand instead use the normal AWS STS endpoint. Explicitly setting
ClientConfiguration::endpointOverrideis unaffected.Reproduction Steps
Possible Solution
Would changing the call in AwsSmithyClientT::initClient() to the following be the intended fix?
Additional Information/Context
No response
AWS CPP SDK version used
1.11.800
Compiler and Version used
GCC/G++ 12.3.0
Operating System and version
Debian GNU/Linux 12 (bookworm)