From 397f35cf21e2299c63388c76cda2801cc58b5489 Mon Sep 17 00:00:00 2001 From: sbiscigl Date: Wed, 25 Nov 2026 14:25:41 -0500 Subject: [PATCH] Document profile provider runtime change, warn on ignored refreshRateMs --- .../bugfix-profile-provider-changelog.json | 6 ++++ CHANGELOG.md | 5 +++ .../aws/core/auth/AWSCredentialsProvider.h | 1 - .../core/auth/ProfileCredentialsProvider.h | 30 ++++++++++++---- .../auth/ProfileCredentialsProvider.cpp | 35 +++++++++++++------ 5 files changed, 58 insertions(+), 19 deletions(-) create mode 100644 .changelog/bugfix-profile-provider-changelog.json diff --git a/.changelog/bugfix-profile-provider-changelog.json b/.changelog/bugfix-profile-provider-changelog.json new file mode 100644 index 000000000000..4e77c9f88044 --- /dev/null +++ b/.changelog/bugfix-profile-provider-changelog.json @@ -0,0 +1,6 @@ +{ + "type": "bugfix", + "category": "aws-cpp-sdk-core", + "contributor": "sbiscigl", + "description": "Add ProfileCredentialsProvider constructors without refreshRateMs, log a warning when refreshRateMs is passed or Reload is called since neither does anything, document the 1.11.760 ProfileCredentialsProvider runtime change in the CHANGELOG, and remove a stray deprecation comment from ProfileConfigFileAWSCredentialsProvider." +} diff --git a/CHANGELOG.md b/CHANGELOG.md index 845c8d0554b1..938153604b65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1116,6 +1116,11 @@ * **SecurityAgent**: Adding private and self-signed certificate configuration support for penetration tests * **Timestream InfluxDB**: Service-managed parameter groups now only apply optimized defaults to DB Clusters automatically. New field effectiveDbParameterGroupIdentifier surfaces the parameter group actually applied. +# 1.11.760 (2026-02-27) + +## SDK Highlights +* **Breaking Change**: `ProfileCredentialsProvider`, used by the default credentials provider chain, is now backed by the CRT and no longer re-reads the shared credentials file on a timer. This is a runtime behavior change: credentials from the file have no expiration, so they are loaded once, matching other AWS SDKs, and `refreshRateMs` is still accepted but ignored. Use `credential_process` or web identity for credentials that rotate, or use `ProfileConfigFileAWSCredentialsProvider` to keep re-reading the file on an interval. + # Announcement We are moving the changelog to a new format and tying it to a new release process. diff --git a/src/aws-cpp-sdk-core/include/aws/core/auth/AWSCredentialsProvider.h b/src/aws-cpp-sdk-core/include/aws/core/auth/AWSCredentialsProvider.h index a3371ccdab24..8222cdc33618 100644 --- a/src/aws-cpp-sdk-core/include/aws/core/auth/AWSCredentialsProvider.h +++ b/src/aws-cpp-sdk-core/include/aws/core/auth/AWSCredentialsProvider.h @@ -153,7 +153,6 @@ namespace Aws * Optionally a user can specify the profile and it will override the environment variable * and defaults. To alter the file this pulls from, then the user should alter the AWS_SHARED_CREDENTIALS_FILE variable. */ - // class AWS_DEPRECATED("This class is in the maintenance mode, no new updates will be released, use S3EncryptionClientV3. Please see https://docs.aws.amazon.com/general/latest/gr/aws_sdk_cryptography.html for more information.") AWS_CORE_API ProfileConfigFileAWSCredentialsProvider : public AWSCredentialsProvider class AWS_CORE_API ProfileConfigFileAWSCredentialsProvider : public AWSCredentialsProvider { public: diff --git a/src/aws-cpp-sdk-core/include/aws/core/auth/ProfileCredentialsProvider.h b/src/aws-cpp-sdk-core/include/aws/core/auth/ProfileCredentialsProvider.h index daaf9e8d17a2..c924cb298736 100644 --- a/src/aws-cpp-sdk-core/include/aws/core/auth/ProfileCredentialsProvider.h +++ b/src/aws-cpp-sdk-core/include/aws/core/auth/ProfileCredentialsProvider.h @@ -16,21 +16,37 @@ namespace Auth { class AWS_CORE_API ProfileCredentialsProvider : public AWSCredentialsProvider { public: /** - * Initializes with refreshRateMs as the frequency at which the file is reparsed in milliseconds. Defaults to 5 minutes. + * Initializes with the default profile. Credentials are refreshed when they expire, + * and credentials without an expiration are loaded once. */ - ProfileCredentialsProvider(long refreshRateMs = REFRESH_THRESHOLD); + ProfileCredentialsProvider(); /** - * Initializes with a profile override and - * refreshRateMs as the frequency at which the file is reparsed in milliseconds. Defaults to 5 minutes. + * Initializes with the default profile. refreshRateMs is ignored, only kept so existing code compiles, and logs a warning. */ - ProfileCredentialsProvider(const char* profile, long refreshRateMs = REFRESH_THRESHOLD); + ProfileCredentialsProvider(long refreshRateMs); + + /** + * Initializes with a profile override. Credentials are refreshed when they expire, + * and credentials without an expiration are loaded once. + */ + ProfileCredentialsProvider(const char* profile); + + /** + * Initializes with a profile override. refreshRateMs is ignored, only kept so existing code compiles, and logs a warning. + */ + ProfileCredentialsProvider(const char* profile, long refreshRateMs); /** * Initializes from a CredentialProviderConfiguration so settings such as allowSystemProxy can flow through. */ - ProfileCredentialsProvider(const Aws::Client::ClientConfiguration::CredentialProviderConfiguration& config, - long refreshRateMs = REFRESH_THRESHOLD); + ProfileCredentialsProvider(const Aws::Client::ClientConfiguration::CredentialProviderConfiguration& config); + + /** + * Initializes from a CredentialProviderConfiguration. refreshRateMs is ignored, only kept so existing code compiles, + * and logs a warning. + */ + ProfileCredentialsProvider(const Aws::Client::ClientConfiguration::CredentialProviderConfiguration& config, long refreshRateMs); /** * Retrieves the credentials if found, otherwise returns empty credential set. diff --git a/src/aws-cpp-sdk-core/source/auth/ProfileCredentialsProvider.cpp b/src/aws-cpp-sdk-core/source/auth/ProfileCredentialsProvider.cpp index b37ead67edda..84fdba691446 100644 --- a/src/aws-cpp-sdk-core/source/auth/ProfileCredentialsProvider.cpp +++ b/src/aws-cpp-sdk-core/source/auth/ProfileCredentialsProvider.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -22,7 +23,8 @@ namespace { const char PROFILE_AWS_CREDENTIALS_FILE[] = "AWS_SHARED_CREDENTIALS_FILE"; const char PROFILE_DEFAULT_CREDENTIALS_FILE[] = "credentials"; const char PROFILE_PROFILE_DIRECTORY[] = ".aws"; -const long DEFAULT_REFRESH_RATE_MS = 300000; +const char PROFILE_PROVIDER_LOG_TAG[] = "ProfileCredentialsProvider"; +const long PROVIDER_FUTURES_TIMEOUT_MS = 300000; std::shared_ptr GetProfileCrtProvider( const Aws::Client::ClientConfiguration::CredentialProviderConfiguration& credentialsConfig) { @@ -56,15 +58,12 @@ class ProfileCredentialsProvider::ProfileCredentialsProviderImp : public CrtCred CredentialsProviderProfileConfig config; return CredentialsProvider::CreateCredentialsProviderProfile(config); }, - std::chrono::milliseconds(DEFAULT_REFRESH_RATE_MS), UserAgentFeature::CREDENTIALS_PROFILE, "ProfileCredentialsProvider") {} + std::chrono::milliseconds(PROVIDER_FUTURES_TIMEOUT_MS), UserAgentFeature::CREDENTIALS_PROFILE, "ProfileCredentialsProvider") {} ProfileCredentialsProviderImp(const Aws::Client::ClientConfiguration::CredentialProviderConfiguration& credentialsConfig) : CrtCredentialsProvider( - [credentialsConfig]() -> std::shared_ptr { - return GetProfileCrtProvider(credentialsConfig); - }, - std::chrono::milliseconds(DEFAULT_REFRESH_RATE_MS), UserAgentFeature::CREDENTIALS_PROFILE, - "ProfileCredentialsProvider") {} + [credentialsConfig]() -> std::shared_ptr { return GetProfileCrtProvider(credentialsConfig); }, + std::chrono::milliseconds(PROVIDER_FUTURES_TIMEOUT_MS), UserAgentFeature::CREDENTIALS_PROFILE, "ProfileCredentialsProvider") {} static Aws::String GetCredentialsProfileFilename() { auto credentialsFileNameFromVar = Aws::Environment::GetEnv(PROFILE_AWS_CREDENTIALS_FILE); @@ -86,24 +85,38 @@ class ProfileCredentialsProvider::ProfileCredentialsProviderImp : public CrtCred } }; -ProfileCredentialsProvider::ProfileCredentialsProvider(long refreshRateMs) : m_impl(std::make_shared()) { +ProfileCredentialsProvider::ProfileCredentialsProvider() : m_impl(std::make_shared()) {} + +ProfileCredentialsProvider::ProfileCredentialsProvider(long refreshRateMs) : ProfileCredentialsProvider() { AWS_UNREFERENCED_PARAM(refreshRateMs); + AWS_LOGSTREAM_WARN(PROFILE_PROVIDER_LOG_TAG, "refreshRateMs is ignored, credentials refresh when they expire"); } -ProfileCredentialsProvider::ProfileCredentialsProvider(const char* profile, long refreshRateMs) { +ProfileCredentialsProvider::ProfileCredentialsProvider(const char* profile) { Aws::Client::ClientConfiguration::CredentialProviderConfiguration credentialsConfig{}; credentialsConfig.profile = profile; m_impl = std::make_shared(credentialsConfig); +} + +ProfileCredentialsProvider::ProfileCredentialsProvider(const char* profile, long refreshRateMs) : ProfileCredentialsProvider(profile) { AWS_UNREFERENCED_PARAM(refreshRateMs); + AWS_LOGSTREAM_WARN(PROFILE_PROVIDER_LOG_TAG, "refreshRateMs is ignored, credentials refresh when they expire"); } +ProfileCredentialsProvider::ProfileCredentialsProvider( + const Aws::Client::ClientConfiguration::CredentialProviderConfiguration& credentialsConfig) + : m_impl(std::make_shared(credentialsConfig)) {} + ProfileCredentialsProvider::ProfileCredentialsProvider( const Aws::Client::ClientConfiguration::CredentialProviderConfiguration& credentialsConfig, long refreshRateMs) - : m_impl(std::make_shared(credentialsConfig)) { + : ProfileCredentialsProvider(credentialsConfig) { AWS_UNREFERENCED_PARAM(refreshRateMs); + AWS_LOGSTREAM_WARN(PROFILE_PROVIDER_LOG_TAG, "refreshRateMs is ignored, credentials refresh when they expire"); } -void ProfileCredentialsProvider::Reload() {} +void ProfileCredentialsProvider::Reload() { + AWS_LOGSTREAM_WARN(PROFILE_PROVIDER_LOG_TAG, "Reload does nothing, credentials refresh when they expire"); +} Aws::String ProfileCredentialsProvider::GetCredentialsProfileFilename() { return ProfileCredentialsProviderImp::GetCredentialsProfileFilename();